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 | /* ============================================================
*
* 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-2024 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* SPDX-License-Identifier: LGPL-2.1-or-later
*
* ============================================================ */
#include "GeoDataAbstractView.h"
// Local includes
#include "GeoDataCamera.h"
#include "GeoDataLookAt.h"
#include "GeoDataTypes.h"
#include "GeoDataTimeSpan.h"
#include "GeoDataTimeStamp.h"
namespace Marble
{
class Q_DECL_HIDDEN GeoDataAbstractViewPrivate
{
public:
GeoDataAbstractViewPrivate();
GeoDataTimeSpan m_timeSpan;
GeoDataTimeStamp m_timeStamp;
AltitudeMode m_altitudeMode;
};
GeoDataAbstractViewPrivate::GeoDataAbstractViewPrivate() :
m_timeSpan(),
m_timeStamp(),
m_altitudeMode(ClampToGround)
{
// do nothing
}
GeoDataAbstractView::GeoDataAbstractView() :
d(new GeoDataAbstractViewPrivate())
{
// do nothing
}
GeoDataAbstractView::~GeoDataAbstractView()
{
delete d;
}
GeoDataAbstractView::GeoDataAbstractView(const GeoDataAbstractView& other) :
GeoDataObject(other),
d(new GeoDataAbstractViewPrivate(*other.d))
{
// nothing to do
}
GeoDataAbstractView& GeoDataAbstractView::operator =(const GeoDataAbstractView& other)
{
GeoDataObject::operator=(other);
*d = *other.d;
return *this;
}
bool GeoDataAbstractView::operator==(const GeoDataAbstractView& other) const
{
if (nodeType() != other.nodeType())
{
return false;
}
if (nodeType() == GeoDataTypes::GeoDataCameraType)
{
const GeoDataCamera& thisCam = static_cast<const GeoDataCamera&>(*this);
const GeoDataCamera& otherCam = static_cast<const GeoDataCamera&>(other);
return thisCam == otherCam;
}
else if (nodeType() == GeoDataTypes::GeoDataLookAtType)
{
const GeoDataLookAt& thisLookAt = static_cast<const GeoDataLookAt&>(*this);
const GeoDataLookAt& otherLookAt = static_cast<const GeoDataLookAt&>(other);
return thisLookAt == otherLookAt;
}
return false;
}
GeoDataCoordinates GeoDataAbstractView::coordinates() const
{
if (nodeType() == GeoDataTypes::GeoDataLookAtType)
{
const GeoDataLookAt* lookAt = static_cast<const GeoDataLookAt*>(this);
if (lookAt)<--- Condition 'lookAt' is always true
{
return lookAt->coordinates();
}
}
else if (nodeType() == GeoDataTypes::GeoDataCameraType)
{
const GeoDataCamera* camera = static_cast<const GeoDataCamera*>(this);
if (camera)<--- Condition 'camera' is always true
{
return camera->coordinates();
}
}
return GeoDataCoordinates();
}
bool GeoDataAbstractView::equals(const GeoDataAbstractView& other) const
{
return GeoDataObject::equals(other) &&
d->m_timeSpan == other.d->m_timeSpan &&
d->m_timeStamp == other.d->m_timeStamp &&
d->m_altitudeMode == other.d->m_altitudeMode;
}
const GeoDataTimeSpan& GeoDataAbstractView::timeSpan() const
{
return d->m_timeSpan;
}
GeoDataTimeSpan& GeoDataAbstractView::timeSpan()
{
return d->m_timeSpan;
}
void GeoDataAbstractView::setTimeSpan(const GeoDataTimeSpan& timeSpan)
{
d->m_timeSpan = timeSpan;
}
GeoDataTimeStamp& GeoDataAbstractView::timeStamp()
{
return d->m_timeStamp;
}
const GeoDataTimeStamp& GeoDataAbstractView::timeStamp() const
{
return d->m_timeStamp;
}
void GeoDataAbstractView::setTimeStamp(const GeoDataTimeStamp& timeStamp)
{
d->m_timeStamp = timeStamp;
}
AltitudeMode GeoDataAbstractView::altitudeMode() const
{
return d->m_altitudeMode;
}
void GeoDataAbstractView::setAltitudeMode(const AltitudeMode altitudeMode)
{
d->m_altitudeMode = altitudeMode;
}
} // namespace Marble
|