1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287 | /* ============================================================
*
* This file is a part of digiKam project
* https://www.digikam.org
*
* Date : 2023-05-15
* Description : geolocation engine based on Marble.
* (c) 2007-2022 Marble Team
* https://invent.kde.org/education/marble/-/raw/master/data/credits_authors.html
*
* SPDX-FileCopyrightText: 2023-2026 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* ============================================================ */
#include "GeoDataModel.h"
#include "GeoDataGeometry_p.h"
// C++ includes
#include <cstdio>
// Local includes
#include "GeoDataTypes.h"
#include "GeoDataLocation.h"
#include "GeoDataOrientation.h"
#include "GeoDataResourceMap.h"
#include "GeoDataScale.h"
namespace Marble
{
class Q_DECL_HIDDEN GeoDataModelPrivate : public GeoDataGeometryPrivate
{
public:
GeoDataModelPrivate();
GeoDataGeometryPrivate* copy() const override
{
return new GeoDataModelPrivate(*this);
}
GeoDataCoordinates m_coordinates;
GeoDataScale m_scale;
GeoDataOrientation m_orientation;
GeoDataLocation m_location;
GeoDataLink m_link;
GeoDataResourceMap m_map;
QString m_targetHref;
QString m_sourceHref;
};
GeoDataModelPrivate::GeoDataModelPrivate()
: m_coordinates(),
m_scale(),
m_orientation(),
m_location(),
m_link(),
m_map(),
m_targetHref(),
m_sourceHref()
{
}
GeoDataModel::GeoDataModel()
: GeoDataGeometry(new GeoDataModelPrivate)
{
setAltitudeMode(ClampToGround);
}
GeoDataModel::GeoDataModel(const GeoDataModel& other) :
GeoDataGeometry(other)
{
// nothing to do
}
GeoDataModel& GeoDataModel::operator=(const GeoDataModel& other)
{
GeoDataGeometry::operator=(other);
return *this;
}
const char* GeoDataModel::nodeType() const
{
return GeoDataTypes::GeoDataModelType;
}
EnumGeometryId GeoDataModel::geometryId() const
{
return GeoDataModelId;
}
GeoDataGeometry* GeoDataModel::copy() const
{
return new GeoDataModel(*this);
}
bool GeoDataModel::operator==(const GeoDataModel& other) const
{
Q_D(const GeoDataModel);
const GeoDataModelPrivate* other_d = other.d_func();
return equals(other) &&
d->m_coordinates == other_d->m_coordinates &&
d->m_scale == other_d->m_scale &&
d->m_orientation == other_d->m_orientation &&
d->m_location == other_d->m_location &&
d->m_link == other_d->m_link &&
d->m_map == other_d->m_map &&
d->m_targetHref == other_d->m_targetHref &&
d->m_sourceHref == other_d->m_sourceHref;
}
bool GeoDataModel::operator!=(const GeoDataModel& other) const
{
return !this->operator==(other);
}
GeoDataModel::~GeoDataModel()
{
}
const GeoDataCoordinates& GeoDataModel::coordinates() const
{
Q_D(const GeoDataModel);
return d->m_coordinates;
}
GeoDataCoordinates& GeoDataModel::coordinates()
{
detach();
Q_D(GeoDataModel);
return d->m_coordinates;
}
const GeoDataLocation& GeoDataModel::location() const
{
Q_D(const GeoDataModel);
return d->m_location;
}
GeoDataLocation& GeoDataModel::location()
{
detach();
Q_D(GeoDataModel);
return d->m_location;
}
void GeoDataModel::setCoordinates(const GeoDataCoordinates& coordinates)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_coordinates = coordinates;
}
void GeoDataModel::setLocation(const GeoDataLocation& location)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_location = location;
}
const GeoDataLink& GeoDataModel::link() const
{
Q_D(const GeoDataModel);
return d->m_link;
}
GeoDataLink& GeoDataModel::link()
{
detach();
Q_D(GeoDataModel);
return d->m_link;
}
void GeoDataModel::setLink(const GeoDataLink& link)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_link = link;
}
const GeoDataScale& GeoDataModel::scale() const
{
Q_D(const GeoDataModel);
return d->m_scale;
}
GeoDataScale& GeoDataModel::scale()
{
detach();
Q_D(GeoDataModel);
return d->m_scale;
}
void GeoDataModel::setScale(const GeoDataScale& scale)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_scale = scale;
}
const GeoDataOrientation& GeoDataModel::orientation() const
{
Q_D(const GeoDataModel);
return d->m_orientation;
}
GeoDataOrientation& GeoDataModel::orientation()
{
detach();
Q_D(GeoDataModel);
return d->m_orientation;
}
void GeoDataModel::setOrientation(const GeoDataOrientation& orientation)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_orientation = orientation;
}
const GeoDataResourceMap& GeoDataModel::resourceMap() const
{
Q_D(const GeoDataModel);
return d->m_map;
}
GeoDataResourceMap& GeoDataModel::resourceMap()
{
detach();
Q_D(GeoDataModel);
return d->m_map;
}
void GeoDataModel::setResourceMap(const GeoDataResourceMap& map)
{
detach();
Q_D(GeoDataModel);
d->m_map = map;
}
QString GeoDataModel::targetHref() const
{
Q_D(const GeoDataModel);
return d->m_map.targetHref();
}
void GeoDataModel::setTargetHref(const QString& targetHref)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_map.setTargetHref(targetHref);
}
QString GeoDataModel::sourceHref() const
{
Q_D(const GeoDataModel);
return d->m_map.sourceHref();
}
void GeoDataModel::setSourceHref(const QString& sourceHref)<--- Shadow argument
{
detach();
Q_D(GeoDataModel);
d->m_map.setSourceHref(sourceHref);
}
} // namespace Marble
|