Marble

GeoDataModel.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2013 Mayank Madan <[email protected]>
4 // SPDX-FileCopyrightText: 2013 Sanjiban Bairagya <[email protected]>
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 
18 namespace Marble {
19 
20 class GeoDataModelPrivate : public GeoDataGeometryPrivate
21 {
22 public:
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 
38 GeoDataModelPrivate::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 
50 GeoDataModel::GeoDataModel() :
51  GeoDataGeometry( new GeoDataModelPrivate )
52 {
53  setAltitudeMode( ClampToGround );
54 }
55 
56 GeoDataModel::GeoDataModel( const GeoDataModel &other ) :
57  GeoDataGeometry( other )
58 {
59  // nothing to do
60 }
61 
62 GeoDataModel &GeoDataModel::operator=( const GeoDataModel &other )
63 {
64  GeoDataGeometry::operator=( other );
65  return *this;
66 }
67 
68 const char *GeoDataModel::nodeType() const
69 {
70  return GeoDataTypes::GeoDataModelType;
71 }
72 
73 EnumGeometryId GeoDataModel::geometryId() const
74 {
75  return GeoDataModelId;
76 }
77 
78 GeoDataGeometry *GeoDataModel::copy() const
79 {
80  return new GeoDataModel(*this);
81 }
82 
83 
84 bool 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 
100 bool GeoDataModel::operator!=( const GeoDataModel &other ) const
101 {
102  return !this->operator==( other );
103 }
104 
105 GeoDataModel::~GeoDataModel()
106 {
107 }
108 
109 const GeoDataCoordinates &GeoDataModel::coordinates() const
110 {
111  Q_D(const GeoDataModel);
112  return d->m_coordinates;
113 }
114 
115 GeoDataCoordinates &GeoDataModel::coordinates()
116 {
117  detach();
118 
119  Q_D(GeoDataModel);
120  return d->m_coordinates;
121 }
122 
123 const GeoDataLocation &GeoDataModel::location() const
124 {
125  Q_D(const GeoDataModel);
126  return d->m_location;
127 }
128 
129 GeoDataLocation &GeoDataModel::location()
130 {
131  detach();
132 
133  Q_D(GeoDataModel);
134  return d->m_location;
135 }
136 
137 void GeoDataModel::setCoordinates(const GeoDataCoordinates &coordinates)
138 {
139  detach();
140 
141  Q_D(GeoDataModel);
142  d->m_coordinates = coordinates;
143 }
144 
145 void GeoDataModel::setLocation(const GeoDataLocation &location)
146 {
147  detach();
148 
149  Q_D(GeoDataModel);
150  d->m_location = location;
151 }
152 
153 const GeoDataLink &GeoDataModel::link() const
154 {
155  Q_D(const GeoDataModel);
156  return d->m_link;
157 }
158 
159 GeoDataLink &GeoDataModel::link()
160 {
161  detach();
162 
163  Q_D(GeoDataModel);
164  return d->m_link;
165 }
166 
167 void GeoDataModel::setLink( const GeoDataLink &link )
168 {
169  detach();
170 
171  Q_D(GeoDataModel);
172  d->m_link = link;
173 }
174 
175 const GeoDataScale &GeoDataModel::scale() const
176 {
177  Q_D(const GeoDataModel);
178  return d->m_scale;
179 }
180 
181 GeoDataScale &GeoDataModel::scale()
182 {
183  detach();
184 
185  Q_D(GeoDataModel);
186  return d->m_scale;
187 }
188 
189 void GeoDataModel::setScale(const GeoDataScale &scale)
190 {
191  detach();
192 
193  Q_D(GeoDataModel);
194  d->m_scale = scale;
195 }
196 
197 const GeoDataOrientation &GeoDataModel::orientation() const
198 {
199  Q_D(const GeoDataModel);
200  return d->m_orientation;
201 }
202 
203 GeoDataOrientation &GeoDataModel::orientation()
204 {
205  detach();
206 
207  Q_D(GeoDataModel);
208  return d->m_orientation;
209 }
210 
211 void GeoDataModel::setOrientation(const GeoDataOrientation &orientation)
212 {
213  detach();
214 
215  Q_D(GeoDataModel);
216  d->m_orientation = orientation;
217 }
218 
219 const GeoDataResourceMap &GeoDataModel::resourceMap() const
220 {
221  Q_D(const GeoDataModel);
222  return d->m_map;
223 }
224 
225 GeoDataResourceMap &GeoDataModel::resourceMap()
226 {
227  detach();
228 
229  Q_D(GeoDataModel);
230  return d->m_map;
231 }
232 
233 void GeoDataModel::setResourceMap(const GeoDataResourceMap &map)
234 {
235  detach();
236 
237  Q_D(GeoDataModel);
238  d->m_map = map;
239 }
240 
241 QString GeoDataModel::targetHref() const
242 {
243  Q_D(const GeoDataModel);
244  return d->m_map.targetHref();
245 }
246 
247 void GeoDataModel::setTargetHref(const QString &targetHref)
248 {
249  detach();
250 
251  Q_D(GeoDataModel);
252  d->m_map.setTargetHref( targetHref );
253 }
254 
255 QString GeoDataModel::sourceHref() const
256 {
257  Q_D(const GeoDataModel);
258  return d->m_map.sourceHref();
259 }
260 
261 void GeoDataModel::setSourceHref(const QString &sourceHref)
262 {
263  detach();
264 
265  Q_D(GeoDataModel);
266  d->m_map.setSourceHref( sourceHref );
267 }
268 
269 }
QVariant location(const QVariant &res)
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
Binds a QML item to a specific geodetic location in screen coordinates.
@ ClampToGround
Altitude always sticks to ground level.
Definition: MarbleGlobal.h:132
QFuture< void > map(Sequence &sequence, MapFunctor function)
const QList< QKeySequence > & copy()
Q_D(Todo)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Oct 2 2023 03:52:08 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.