Marble

GeoDataStyleMap.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
4//
5
6#include "GeoDataStyleMap.h"
7#include <QDataStream>
8
9#include "GeoDataTypes.h"
10
11namespace Marble
12{
13
14class GeoDataStyleMapPrivate
15{
16public:
17 QString lastKey;
18};
19
20GeoDataStyleMap::GeoDataStyleMap()
21 : d(new GeoDataStyleMapPrivate)
22{
23}
24
25GeoDataStyleMap::GeoDataStyleMap(const GeoDataStyleMap &other)
26 : GeoDataStyleSelector(other)
27 , QMap<QString, QString>(other)
28 , d(new GeoDataStyleMapPrivate(*other.d))
29
30{
31}
32
33GeoDataStyleMap::~GeoDataStyleMap()
34{
35 delete d;
36}
37
38const 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
53GeoDataStyleMap &GeoDataStyleMap::operator=(const GeoDataStyleMap &other)
54{
57 *d = *other.d;
58 return *this;
59}
60
61bool GeoDataStyleMap::operator==(const GeoDataStyleMap &other) const
62{
63 if (GeoDataStyleSelector::operator!=(other)) {
64 return false;
65 }
66
67 return d->lastKey == other.d->lastKey;
68}
69
70bool GeoDataStyleMap::operator!=(const GeoDataStyleMap &other) const
71{
72 return !this->operator==(other);
73}
74
76{
78 // lastKey doesn't need to be stored as it is needed at runtime only
79 stream << *this;
80}
81
83{
85
86 stream >> *this;
87}
88
89}
a class to map different styles to one style
QString lastKey() const
return the last key
const char * nodeType() const override
Provides type information for downcasting a GeoNode.
GeoDataStyleMap & operator=(const GeoDataStyleMap &other)
assignment operator
void unpack(QDataStream &stream) override
Unserialize the stylemap from a stream.
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...
void pack(QDataStream &stream) const override
Serialize the stylemap to a stream.
GeoDataStyleSelector & operator=(const GeoDataStyleSelector &other)
assignment operator
void unpack(QDataStream &stream) override
Unserialize the styleselector from a stream.
void pack(QDataStream &stream) const override
Serialize the styleselector to a stream.
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
Binds a QML item to a specific geodetic location in screen coordinates.
Key key(const T &value, const Key &defaultKey) const const
QMap< Key, T > & operator=(QMap< Key, T > &&other)
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 24 2025 11:52:09 by doxygen 1.13.2 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.