Marble

GeoDataCamera.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2013 Mayank Madan <maddiemadan@gmail.com>
4//
5
6#include "GeoDataCamera.h"
7#include "GeoDataCamera_p.h"
8
9#include "GeoDataTypes.h"
10
11#include <QDataStream>
12
13namespace Marble
14{
15
16GeoDataCamera::GeoDataCamera()
17 : GeoDataAbstractView()
18 , d(new GeoDataCameraPrivate)
19{
20}
21
22GeoDataCamera::GeoDataCamera(const GeoDataCamera &other)
23 : GeoDataAbstractView()
24 , d(other.d)
25{
26 d->ref.ref();
27}
28
29GeoDataCamera &GeoDataCamera::operator=(const GeoDataCamera &other)
30{
31 GeoDataAbstractView::operator=(other);
32 qAtomicAssign(d, other.d);
33 return *this;
34}
35
36bool GeoDataCamera::operator==(const GeoDataCamera &other) const
37{
38 return equals(other) && d->m_coordinates == other.d->m_coordinates && d->m_roll == other.d->m_roll && d->m_heading == other.d->m_heading
39 && d->m_tilt == other.d->m_tilt && altitudeMode() == other.altitudeMode();
40}
41
42bool GeoDataCamera::operator!=(const GeoDataCamera &other) const
43{
44 return !this->operator==(other);
45}
46
47GeoDataCamera::~GeoDataCamera()
48{
49 if (!d->ref.deref()) {
50 delete d;
51 }
52}
53
54GeoDataAbstractView *GeoDataCamera::copy() const
55{
56 return new GeoDataCamera(*this);
57}
58
59void GeoDataCamera::setCoordinates(const GeoDataCoordinates &coordinates)
60{
61 detach();
62 d->m_coordinates = coordinates;
63}
64
65const char *GeoDataCamera::nodeType() const
66{
67 return GeoDataTypes::GeoDataCameraType;
68}
69
70void GeoDataCamera::setAltitude(qreal altitude)
71{
72 detach();
73 d->m_coordinates.setAltitude(altitude);
74}
75
76qreal GeoDataCamera::altitude() const
77{
78 return d->m_coordinates.altitude();
79}
80
81void GeoDataCamera::setLatitude(qreal latitude, GeoDataCoordinates::Unit unit)
82{
83 detach();
84 d->m_coordinates.setLatitude(latitude, unit);
85}
86
87qreal GeoDataCamera::latitude(GeoDataCoordinates::Unit unit) const
88{
89 return d->m_coordinates.latitude(unit);
90}
91
92void GeoDataCamera::setLongitude(qreal longitude, GeoDataCoordinates::Unit unit)
93{
94 detach();
95 d->m_coordinates.setLongitude(longitude, unit);
96}
97
98qreal GeoDataCamera::longitude(GeoDataCoordinates::Unit unit) const
99{
100 return d->m_coordinates.longitude(unit);
101}
102
103GeoDataCoordinates GeoDataCamera::coordinates() const
104{
105 return d->m_coordinates;
106}
107
108void GeoDataCamera::setRoll(qreal roll)
109{
110 detach();
111 d->m_roll = roll;
112}
113
114qreal GeoDataCamera::roll() const
115{
116 return d->m_roll;
117}
118
119qreal GeoDataCamera::heading() const
120{
121 return d->m_heading;
122}
123
124void GeoDataCamera::setHeading(qreal heading)
125{
126 detach();
127 d->m_heading = heading;
128}
129
130qreal GeoDataCamera::tilt() const
131{
132 return d->m_tilt;
133}
134
135void GeoDataCamera::setTilt(qreal tilt)
136{
137 detach();
138 d->m_tilt = tilt;
139}
140
141void GeoDataCamera::detach()
142{
143 qAtomicDetach(d);
144}
145
146}
QAction * roll(const QObject *recvr, const char *slot, QObject *parent)
KIOCORE_EXPORT bool operator==(const UDSEntry &entry, const UDSEntry &other)
bool equals(const QVariant &lhs, const QVariant &rhs)
Binds a QML item to a specific geodetic location in screen coordinates.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Dec 20 2024 11:52:12 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.