Marble

GeoDataStyleMap.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2008 Patrick Spendrin <[email protected]>
4 //
5 
6 
7 #include "GeoDataStyleMap.h"
8 #include <QDataStream>
9 
10 #include "GeoDataTypes.h"
11 
12 namespace Marble
13 {
14 
15 class GeoDataStyleMapPrivate
16 {
17  public:
18  QString lastKey;
19 };
20 
21 
22 GeoDataStyleMap::GeoDataStyleMap()
23  : d( new GeoDataStyleMapPrivate )
24 {
25 }
26 
27 GeoDataStyleMap::GeoDataStyleMap( const GeoDataStyleMap& other )
28  : GeoDataStyleSelector( other ) , QMap<QString,QString>(other), d( new GeoDataStyleMapPrivate( *other.d ) )
29 
30 {
31 }
32 
33 GeoDataStyleMap::~GeoDataStyleMap()
34 {
35  delete d;
36 }
37 
38 const char* GeoDataStyleMap::nodeType() const
39 {
40  return GeoDataTypes::GeoDataStyleMapType;
41 }
42 
44 {
45  return d->lastKey;
46 }
47 
49 {
50  d->lastKey = key;
51 }
52 
54 {
57  *d = *other.d;
58  return *this;
59 }
60 
61 bool GeoDataStyleMap::operator==( const GeoDataStyleMap &other ) const
62 {
63  if ( GeoDataStyleSelector::operator!=( other ) ||
65  {
66  return false;
67  }
68 
69  return d->lastKey == other.d->lastKey;
70 }
71 
72 bool GeoDataStyleMap::operator!=( const GeoDataStyleMap &other ) const
73 {
74  return !this->operator==( other );
75 }
76 
77 void GeoDataStyleMap::pack( QDataStream& stream ) const
78 {
80  // lastKey doesn't need to be stored as it is needed at runtime only
81  stream << *this;
82 }
83 
85 {
87 
88  stream >> *this;
89 }
90 
91 }
const char * nodeType() const override
Provides type information for downcasting a GeoNode.
Binds a QML item to a specific geodetic location in screen coordinates.
GeoDataStyleMap & operator=(const GeoDataStyleMap &other)
assignment operator
a class to map different styles to one style
void unpack(QDataStream &stream) override
Unserialize the stylemap from a stream.
QString lastKey() const
return the last key
void setLastKey(const QString &key)
Set the last key this property is needed to set an entry in the kml parser after the parser has set t...
QMap< Key, T > & operator=(const QMap< Key, T > &other)
GeoDataStyleSelector & operator=(const GeoDataStyleSelector &other)
assignment operator
void pack(QDataStream &stream) const override
Serialize the stylemap to a stream.
void unpack(QDataStream &stream) override
Unserialize the styleselector from a stream.
void pack(QDataStream &stream) const override
Serialize the styleselector to a stream.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Nov 29 2021 23:11:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.