Marble

GeoDataUpdate.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mohammed Nafees <nafees.technocool@gmail.com>
4//
5
6#include "GeoDataUpdate.h"
7
8#include "GeoDataCreate.h"
9#include "GeoDataDelete.h"
10#include "GeoDataChange.h"
11#include "GeoDataTypes.h"
12
13#include <QString>
14
15namespace Marble
16{
17
18class GeoDataUpdatePrivate
19{
20public:
21 GeoDataUpdatePrivate();
22 GeoDataCreate* m_create;
23 GeoDataDelete* m_delete;
24 GeoDataChange* m_change;
25 QString m_targetHref;
26};
27
28GeoDataUpdatePrivate::GeoDataUpdatePrivate() :
29 m_create( nullptr ), m_delete( nullptr ), m_change( nullptr )
30{
31}
32
33GeoDataUpdate::GeoDataUpdate() :
34 d( new GeoDataUpdatePrivate )
35{
36}
37
38GeoDataUpdate::GeoDataUpdate( const Marble::GeoDataUpdate &other ) :
39 GeoDataObject(), d( new GeoDataUpdatePrivate( *other.d ) )
40{
41}
42
43GeoDataUpdate &GeoDataUpdate::operator=( const GeoDataUpdate &other )
44{
45 GeoDataObject::operator =( other );
46 *d = *other.d;
47 return *this;
48}
49
50bool GeoDataUpdate::operator==(const GeoDataUpdate& other) const
51{
52 bool const changeEmpty = !d->m_change || d->m_change->size() == 0;
53 bool const otherChangeEmpty = !other.d->m_change || other.d->m_change->size() == 0;
54
55 if( changeEmpty != otherChangeEmpty ) {
56 return false;
57 } else if( d->m_change && other.d->m_change && *d->m_change != *other.d->m_change ) {
58 return false;
59 }
60
61 return d->m_targetHref == other.d->m_targetHref;
62}
63
64bool GeoDataUpdate::operator!=(const GeoDataUpdate& other) const
65{
66 return !this->operator==(other);
67}
68
69GeoDataUpdate::~GeoDataUpdate()
70{
71 delete d;
72}
73
74const char *GeoDataUpdate::nodeType() const
75{
76 return GeoDataTypes::GeoDataUpdateType;
77}
78
79QString GeoDataUpdate::targetHref() const
80{
81 return d->m_targetHref;
82}
83
84void GeoDataUpdate::setTargetHref( const QString &targetHref )
85{
86 d->m_targetHref = targetHref;
87}
88
89const GeoDataChange *GeoDataUpdate::change() const
90{
91 return d->m_change;
92}
93
94GeoDataChange *GeoDataUpdate::change()
95{
96 return d->m_change;
97}
98
99void GeoDataUpdate::setChange( GeoDataChange* change )
100{
101 delete d->m_change;
102 d->m_change = change;
103 if ( d->m_change ) {
104 d->m_change->setParent( this );
105 }
106}
107
108const GeoDataCreate *GeoDataUpdate::create() const
109{
110 return d->m_create;
111}
112
113GeoDataCreate *GeoDataUpdate::create()
114{
115 return d->m_create;
116}
117
118void GeoDataUpdate::setCreate( GeoDataCreate* create )
119{
120 delete d->m_create;
121 d->m_create = create;
122 if ( d->m_create ) {
123 d->m_create->setParent( this );
124 }
125}
126
127const GeoDataDelete *GeoDataUpdate::getDelete() const
128{
129 return d->m_delete;
130}
131
132GeoDataDelete *GeoDataUpdate::getDelete()
133{
134 return d->m_delete;
135}
136
137void GeoDataUpdate::setDelete( GeoDataDelete* dataDelete )
138{
139 delete d->m_delete;
140 d->m_delete = dataDelete;
141 if ( d->m_delete ) {
142 d->m_delete->setParent( this );
143 }
144}
145
146}
QAction * create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
Binds a QML item to a specific geodetic location in screen coordinates.
void setParent(QObject *parent)
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Jun 21 2024 12:00:06 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.