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
43QString GeoDataStyleMap::lastKey() const
44{
45 return d->lastKey;
46}
47
48void GeoDataStyleMap::setLastKey(const QString &key)
49{
50 d->lastKey = key;
51}
52
53GeoDataStyleMap &GeoDataStyleMap::operator=(const GeoDataStyleMap &other)
54{
56 GeoDataStyleSelector::operator=(other);
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
75void GeoDataStyleMap::pack(QDataStream &stream) const
76{
77 GeoDataStyleSelector::pack(stream);
78 // lastKey doesn't need to be stored as it is needed at runtime only
79 stream << *this;
80}
81
82void GeoDataStyleMap::unpack(QDataStream &stream)
83{
84 GeoDataStyleSelector::unpack(stream);
85
86 stream >> *this;
87}
88
89}
a class to map different styles to one style
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
Binds a QML item to a specific geodetic location in screen coordinates.
QMap< Key, T > & operator=(QMap< Key, T > &&other)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:37:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.