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

KDE's Doxygen guidelines are available online.