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 "GeoDataLocation.h"
11#include "GeoDataOrientation.h"
12#include "GeoDataResourceMap.h"
13#include "GeoDataScale.h"
14#include "GeoDataTypes.h"
15
16#include <cstdio>
17
18namespace Marble
19{
20
21class GeoDataModelPrivate : public GeoDataGeometryPrivate
22{
23public:
24 GeoDataModelPrivate();
25
26 GeoDataGeometryPrivate *copy() const override
27 {
28 return new GeoDataModelPrivate(*this);
29 }
30
31 GeoDataCoordinates m_coordinates;
32
33 GeoDataScale m_scale;
34 GeoDataOrientation m_orientation;
35 GeoDataLocation m_location;
36 GeoDataLink m_link;
37 GeoDataResourceMap m_map;
38 QString m_targetHref;
39 QString m_sourceHref;
40};
41
42GeoDataModelPrivate::GeoDataModelPrivate()
43 : m_coordinates()
44 , m_scale()
45 , m_orientation()
46 , m_location()
47 , m_link()
48 , m_map()
49 , m_targetHref()
50 , m_sourceHref()
51{
52}
53
54GeoDataModel::GeoDataModel()
55 : GeoDataGeometry(new GeoDataModelPrivate)
56{
57 setAltitudeMode(ClampToGround);
58}
59
60GeoDataModel::GeoDataModel(const GeoDataModel &other)
61 : GeoDataGeometry(other)
62{
63 // nothing to do
64}
65
66GeoDataModel &GeoDataModel::operator=(const GeoDataModel &other) = default;
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
83bool GeoDataModel::operator==(const GeoDataModel &other) const
84{
85 Q_D(const GeoDataModel);
86 const GeoDataModelPrivate *other_d = other.d_func();
87
88 return equals(other) && d->m_coordinates == other_d->m_coordinates && d->m_scale == other_d->m_scale && d->m_orientation == other_d->m_orientation
89 && 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
90 && d->m_sourceHref == other_d->m_sourceHref;
91}
92
93bool GeoDataModel::operator!=(const GeoDataModel &other) const
94{
95 return !this->operator==(other);
96}
97
98GeoDataModel::~GeoDataModel() = default;
99
100const GeoDataCoordinates &GeoDataModel::coordinates() const
101{
102 Q_D(const GeoDataModel);
103 return d->m_coordinates;
104}
105
106GeoDataCoordinates &GeoDataModel::coordinates()
107{
108 detach();
109
110 Q_D(GeoDataModel);
111 return d->m_coordinates;
112}
113
114const GeoDataLocation &GeoDataModel::location() const
115{
116 Q_D(const GeoDataModel);
117 return d->m_location;
118}
119
120GeoDataLocation &GeoDataModel::location()
121{
122 detach();
123
124 Q_D(GeoDataModel);
125 return d->m_location;
126}
127
128void GeoDataModel::setCoordinates(const GeoDataCoordinates &coordinates)
129{
130 detach();
131
132 Q_D(GeoDataModel);
133 d->m_coordinates = coordinates;
134}
135
136void GeoDataModel::setLocation(const GeoDataLocation &location)
137{
138 detach();
139
140 Q_D(GeoDataModel);
141 d->m_location = location;
142}
143
144const GeoDataLink &GeoDataModel::link() const
145{
146 Q_D(const GeoDataModel);
147 return d->m_link;
148}
149
150GeoDataLink &GeoDataModel::link()
151{
152 detach();
153
154 Q_D(GeoDataModel);
155 return d->m_link;
156}
157
158void GeoDataModel::setLink(const GeoDataLink &link)
159{
160 detach();
161
162 Q_D(GeoDataModel);
163 d->m_link = link;
164}
165
166const GeoDataScale &GeoDataModel::scale() const
167{
168 Q_D(const GeoDataModel);
169 return d->m_scale;
170}
171
172GeoDataScale &GeoDataModel::scale()
173{
174 detach();
175
176 Q_D(GeoDataModel);
177 return d->m_scale;
178}
179
180void GeoDataModel::setScale(const GeoDataScale &scale)
181{
182 detach();
183
184 Q_D(GeoDataModel);
185 d->m_scale = scale;
186}
187
188const GeoDataOrientation &GeoDataModel::orientation() const
189{
190 Q_D(const GeoDataModel);
191 return d->m_orientation;
192}
193
194GeoDataOrientation &GeoDataModel::orientation()
195{
196 detach();
197
198 Q_D(GeoDataModel);
199 return d->m_orientation;
200}
201
202void GeoDataModel::setOrientation(const GeoDataOrientation &orientation)
203{
204 detach();
205
206 Q_D(GeoDataModel);
207 d->m_orientation = orientation;
208}
209
210const GeoDataResourceMap &GeoDataModel::resourceMap() const
211{
212 Q_D(const GeoDataModel);
213 return d->m_map;
214}
215
216GeoDataResourceMap &GeoDataModel::resourceMap()
217{
218 detach();
219
220 Q_D(GeoDataModel);
221 return d->m_map;
222}
223
224void GeoDataModel::setResourceMap(const GeoDataResourceMap &map)
225{
226 detach();
227
228 Q_D(GeoDataModel);
229 d->m_map = map;
230}
231
232QString GeoDataModel::targetHref() const
233{
234 Q_D(const GeoDataModel);
235 return d->m_map.targetHref();
236}
237
238void GeoDataModel::setTargetHref(const QString &targetHref)
239{
240 detach();
241
242 Q_D(GeoDataModel);
243 d->m_map.setTargetHref(targetHref);
244}
245
246QString GeoDataModel::sourceHref() const
247{
248 Q_D(const GeoDataModel);
249 return d->m_map.sourceHref();
250}
251
252void GeoDataModel::setSourceHref(const QString &sourceHref)
253{
254 detach();
255
256 Q_D(GeoDataModel);
257 d->m_map.setSourceHref(sourceHref);
258}
259
260}
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
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.
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 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.