Marble

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

KDE's Doxygen guidelines are available online.