• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdeedu API Reference
  • KDE Home
  • Contact Us
 

marble

  • sources
  • kde-4.14
  • kdeedu
  • marble
  • src
  • lib
  • marble
  • geodata
  • data
GeoDataStyleMap.cpp
Go to the documentation of this file.
1 //
2 // This file is part of the Marble Virtual Globe.
3 //
4 // This program is free software licensed under the GNU LGPL. You can
5 // find a copy of this license in LICENSE.txt in the top directory of
6 // the source code.
7 //
8 // Copyright 2008 Patrick Spendrin <ps_ml@gmx.de>
9 //
10 
11 
12 #include "GeoDataStyleMap.h"
13 #include <QDataStream>
14 
15 #include "GeoDataTypes.h"
16 
17 namespace Marble
18 {
19 
20 class GeoDataStyleMapPrivate
21 {
22  public:
23  const char* nodeType() const
24  {
25  return GeoDataTypes::GeoDataStyleMapType;
26  }
27 
28  QString lastKey;
29 };
30 
31 
32 GeoDataStyleMap::GeoDataStyleMap()
33  : d( new GeoDataStyleMapPrivate )
34 {
35 }
36 
37 GeoDataStyleMap::GeoDataStyleMap( const GeoDataStyleMap& other )
38  : GeoDataStyleSelector( other ) , QMap<QString,QString>(other), d( new GeoDataStyleMapPrivate( *other.d ) )
39 
40 {
41 }
42 
43 GeoDataStyleMap::~GeoDataStyleMap()
44 {
45  delete d;
46 }
47 
48 const char* GeoDataStyleMap::nodeType() const
49 {
50  return d->nodeType();
51 }
52 
53 QString GeoDataStyleMap::lastKey() const
54 {
55  return d->lastKey;
56 }
57 
58 void GeoDataStyleMap::setLastKey( QString key )
59 {
60  d->lastKey = key;
61 }
62 
63 GeoDataStyleMap& GeoDataStyleMap::operator=( const GeoDataStyleMap& other )
64 {
65  QMap<QString, QString>::operator=( other );
66  GeoDataStyleSelector::operator=( other );
67  *d = *other.d;
68  return *this;
69 }
70 
71 bool GeoDataStyleMap::operator==( const GeoDataStyleMap &other ) const
72 {
73  if ( GeoDataStyleSelector::operator!=( other ) ||
74  QMap<QString, QString>::operator!=( other ) )
75  {
76  return false;
77  }
78 
79  return d->lastKey == other.d->lastKey;
80 }
81 
82 bool GeoDataStyleMap::operator!=( const GeoDataStyleMap &other ) const
83 {
84  return !this->operator==( other );
85 }
86 
87 void GeoDataStyleMap::pack( QDataStream& stream ) const
88 {
89  GeoDataStyleSelector::pack( stream );
90  // lastKey doesn't need to be stored as it is needed at runtime only
91  stream << *this;
92 }
93 
94 void GeoDataStyleMap::unpack( QDataStream& stream )
95 {
96  GeoDataStyleSelector::unpack( stream );
97 
98  stream >> *this;
99 }
100 
101 }
Marble::GeoDataTypes::GeoDataStyleMapType
const char * GeoDataStyleMapType
Definition: GeoDataTypes.cpp:78
QDataStream
QMap
Marble::GeoDataStyleMap::operator=
GeoDataStyleMap & operator=(const GeoDataStyleMap &other)
assignment operator
Definition: GeoDataStyleMap.cpp:63
Marble::GeoDataStyleMap::GeoDataStyleMap
GeoDataStyleMap()
Definition: GeoDataStyleMap.cpp:32
Marble::GeoDataStyleMap
a class to map different styles to one style
Definition: GeoDataStyleMap.h:38
Marble::GeoDataStyleMap::lastKey
QString lastKey() const
return the last key
Definition: GeoDataStyleMap.cpp:53
Marble::GeoDataStyleMap::setLastKey
void setLastKey(QString key)
Set the last key this property is needed to set an entry in the kml parser after the parser has set t...
Definition: GeoDataStyleMap.cpp:58
Marble::GeoDataStyleSelector::unpack
virtual void unpack(QDataStream &stream)
Unserialize the styleselector from a stream.
Definition: GeoDataStyleSelector.cpp:66
Marble::GeoDataStyleMap::nodeType
virtual const char * nodeType() const
Provides type information for downcasting a GeoNode.
Definition: GeoDataStyleMap.cpp:48
Marble::GeoDataStyleMap::operator!=
bool operator!=(const GeoDataStyleMap &other) const
Definition: GeoDataStyleMap.cpp:82
Marble::GeoDataStyleSelector::operator=
GeoDataStyleSelector & operator=(const GeoDataStyleSelector &other)
assignment operator
Definition: GeoDataStyleSelector.cpp:39
Marble::GeoDataStyleMap::operator==
bool operator==(const GeoDataStyleMap &other) const
Definition: GeoDataStyleMap.cpp:71
QString
Marble::GeoDataStyleMap::~GeoDataStyleMap
~GeoDataStyleMap()
Definition: GeoDataStyleMap.cpp:43
Marble::GeoDataStyleSelector::pack
virtual void pack(QDataStream &stream) const
Serialize the styleselector to a stream.
Definition: GeoDataStyleSelector.cpp:61
GeoDataStyleMap.h
Marble::GeoDataStyleMap::pack
virtual void pack(QDataStream &stream) const
Serialize the stylemap to a stream.
Definition: GeoDataStyleMap.cpp:87
QMap::operator=
QMap< Key, T > & operator=(const QMap< Key, T > &other)
QMap< QString, QString >::key
const Key key(const T &value) const
GeoDataTypes.h
Marble::GeoDataStyleSelector
a base class for the style classes
Definition: GeoDataStyleSelector.h:40
Marble::GeoDataStyleMap::unpack
virtual void unpack(QDataStream &stream)
Unserialize the stylemap from a stream.
Definition: GeoDataStyleMap.cpp:94
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:13:39 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

marble

Skip menu "marble"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdeedu API Reference

Skip menu "kdeedu API Reference"
  • Analitza
  •     lib
  • kalgebra
  • kalzium
  •   libscience
  • kanagram
  • kig
  •   lib
  • klettres
  • marble
  • parley
  • rocs
  •   App
  •   RocsCore
  •   VisualEditor
  •   stepcore

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal