Marble

GeoDataModel.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
4// SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <sanjiban22393@gmail.com>
5//
6
7#include "GeoDataModel.h"
8#include "GeoDataGeometry_p.h"
9
10#include "GeoDataTypes.h"
11#include "GeoDataLocation.h"
12#include "GeoDataOrientation.h"
13#include "GeoDataResourceMap.h"
14#include "GeoDataScale.h"
15
16#include <cstdio>
17
18namespace Marble {
19
20class GeoDataModelPrivate : public GeoDataGeometryPrivate
21{
22public:
23 GeoDataModelPrivate();
24
25 GeoDataGeometryPrivate *copy() const override { return new GeoDataModelPrivate( *this ); }
26
27 GeoDataCoordinates m_coordinates;
28
29 GeoDataScale m_scale;
30 GeoDataOrientation m_orientation;
31 GeoDataLocation m_location;
32 GeoDataLink m_link;
33 GeoDataResourceMap m_map;
34 QString m_targetHref;
35 QString m_sourceHref;
36};
37
38GeoDataModelPrivate::GeoDataModelPrivate() :
39 m_coordinates(),
40 m_scale(),
41 m_orientation(),
42 m_location(),
43 m_link(),
44 m_map(),
45 m_targetHref(),
46 m_sourceHref()
47{
48}
49
50GeoDataModel::GeoDataModel() :
51 GeoDataGeometry( new GeoDataModelPrivate )
52{
53 setAltitudeMode( ClampToGround );
54}
55
56GeoDataModel::GeoDataModel( const GeoDataModel &other ) :
57 GeoDataGeometry( other )
58{
59 // nothing to do
60}
61
62GeoDataModel &GeoDataModel::operator=( const GeoDataModel &other )
63{
64 GeoDataGeometry::operator=( other );
65 return *this;
66}
67
68const char *GeoDataModel::nodeType() const
69{
70 return GeoDataTypes::GeoDataModelType;
71}
72
73EnumGeometryId GeoDataModel::geometryId() const
74{
75 return GeoDataModelId;
76}
77
78GeoDataGeometry *GeoDataModel::copy() const
79{
80 return new GeoDataModel(*this);
81}
82
83
84bool GeoDataModel::operator==( const GeoDataModel &other ) const
85{
86 Q_D(const GeoDataModel);
87 const GeoDataModelPrivate *other_d = other.d_func();
88
89 return equals(other) &&
90 d->m_coordinates == other_d->m_coordinates &&
91 d->m_scale == other_d->m_scale &&
92 d->m_orientation == other_d->m_orientation &&
93 d->m_location == other_d->m_location &&
94 d->m_link == other_d->m_link &&
95 d->m_map == other_d->m_map &&
96 d->m_targetHref == other_d->m_targetHref &&
97 d->m_sourceHref == other_d->m_sourceHref;
98}
99
100bool GeoDataModel::operator!=( const GeoDataModel &other ) const
101{
102 return !this->operator==( other );
103}
104
105GeoDataModel::~GeoDataModel()
106{
107}
108
109const GeoDataCoordinates &GeoDataModel::coordinates() const
110{
111 Q_D(const GeoDataModel);
112 return d->m_coordinates;
113}
114
115GeoDataCoordinates &GeoDataModel::coordinates()
116{
117 detach();
118
119 Q_D(GeoDataModel);
120 return d->m_coordinates;
121}
122
123const GeoDataLocation &GeoDataModel::location() const
124{
125 Q_D(const GeoDataModel);
126 return d->m_location;
127}
128
129GeoDataLocation &GeoDataModel::location()
130{
131 detach();
132
133 Q_D(GeoDataModel);
134 return d->m_location;
135}
136
137void GeoDataModel::setCoordinates(const GeoDataCoordinates &coordinates)
138{
139 detach();
140
141 Q_D(GeoDataModel);
142 d->m_coordinates = coordinates;
143}
144
145void GeoDataModel::setLocation(const GeoDataLocation &location)
146{
147 detach();
148
149 Q_D(GeoDataModel);
150 d->m_location = location;
151}
152
153const GeoDataLink &GeoDataModel::link() const
154{
155 Q_D(const GeoDataModel);
156 return d->m_link;
157}
158
159GeoDataLink &GeoDataModel::link()
160{
161 detach();
162
163 Q_D(GeoDataModel);
164 return d->m_link;
165}
166
167void GeoDataModel::setLink( const GeoDataLink &link )
168{
169 detach();
170
171 Q_D(GeoDataModel);
172 d->m_link = link;
173}
174
175const GeoDataScale &GeoDataModel::scale() const
176{
177 Q_D(const GeoDataModel);
178 return d->m_scale;
179}
180
181GeoDataScale &GeoDataModel::scale()
182{
183 detach();
184
185 Q_D(GeoDataModel);
186 return d->m_scale;
187}
188
189void GeoDataModel::setScale(const GeoDataScale &scale)
190{
191 detach();
192
193 Q_D(GeoDataModel);
194 d->m_scale = scale;
195}
196
197const GeoDataOrientation &GeoDataModel::orientation() const
198{
199 Q_D(const GeoDataModel);
200 return d->m_orientation;
201}
202
203GeoDataOrientation &GeoDataModel::orientation()
204{
205 detach();
206
207 Q_D(GeoDataModel);
208 return d->m_orientation;
209}
210
211void GeoDataModel::setOrientation(const GeoDataOrientation &orientation)
212{
213 detach();
214
215 Q_D(GeoDataModel);
216 d->m_orientation = orientation;
217}
218
219const GeoDataResourceMap &GeoDataModel::resourceMap() const
220{
221 Q_D(const GeoDataModel);
222 return d->m_map;
223}
224
225GeoDataResourceMap &GeoDataModel::resourceMap()
226{
227 detach();
228
229 Q_D(GeoDataModel);
230 return d->m_map;
231}
232
233void GeoDataModel::setResourceMap(const GeoDataResourceMap &map)
234{
235 detach();
236
237 Q_D(GeoDataModel);
238 d->m_map = map;
239}
240
241QString GeoDataModel::targetHref() const
242{
243 Q_D(const GeoDataModel);
244 return d->m_map.targetHref();
245}
246
247void GeoDataModel::setTargetHref(const QString &targetHref)
248{
249 detach();
250
251 Q_D(GeoDataModel);
252 d->m_map.setTargetHref( targetHref );
253}
254
255QString GeoDataModel::sourceHref() const
256{
257 Q_D(const GeoDataModel);
258 return d->m_map.sourceHref();
259}
260
261void GeoDataModel::setSourceHref(const QString &sourceHref)
262{
263 detach();
264
265 Q_D(GeoDataModel);
266 d->m_map.setSourceHref( sourceHref );
267}
268
269}
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
QVariant location(const QVariant &res)
bool equals(const QVariant &lhs, const QVariant &rhs)
Binds a QML item to a specific geodetic location in screen coordinates.
bool operator==(const QGraphicsApiFilter &reference, const QGraphicsApiFilter &sample)
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
Q_D(Todo)
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.