Marble

GeoDataLookAt.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2009 Gaurav Gupta <[email protected]>
4 // SPDX-FileCopyrightText: 2010 Bastian Holst <[email protected]>
5 //
6 
7 //own
8 #include "GeoDataLookAt.h"
9 #include "GeoDataLookAt_p.h"
10 
11 #include "GeoDataTypes.h"
12 
13 #include "MarbleDebug.h"
14 
15 namespace Marble
16 {
17 
18 GeoDataLookAt::GeoDataLookAt() :
19  GeoDataAbstractView(),
20  d( new GeoDataLookAtPrivate )
21 {
22 }
23 
24 GeoDataLookAt::GeoDataLookAt( const GeoDataLookAt& other ) :
25  GeoDataAbstractView(),
26  d( other.d )
27 {
28  d->ref.ref();
29 }
30 
31 GeoDataLookAt& GeoDataLookAt::operator=( const GeoDataLookAt &other )
32 {
33  GeoDataAbstractView::operator=( other );
34  qAtomicAssign( d, other.d );
35  return *this;
36 }
37 
38 bool GeoDataLookAt::operator==(const GeoDataLookAt &other) const
39 {
40  return equals(other) &&
41  d->m_coordinates == other.d->m_coordinates &&
42  d->m_range == other.d->m_range;
43 }
44 
45 bool GeoDataLookAt::operator!=(const GeoDataLookAt &other) const
46 {
47  return !this->operator==( other );
48 }
49 
50 GeoDataLookAt::~GeoDataLookAt()
51 {
52  if( !d->ref.deref() )
53  delete d;
54 }
55 
56 GeoDataAbstractView *GeoDataLookAt::copy() const
57 {
58  return new GeoDataLookAt( *this );
59 }
60 
61 void GeoDataLookAt::setCoordinates( const GeoDataCoordinates& coordinates )
62 {
63  d->m_coordinates = coordinates;
64 }
65 
66 const char* GeoDataLookAt::nodeType() const
67 {
68  return GeoDataTypes::GeoDataLookAtType;
69 }
70 
71 void GeoDataLookAt::setAltitude( qreal altitude )
72 {
73  detach();
74  d->m_coordinates.setAltitude( altitude );
75 }
76 
77 qreal GeoDataLookAt::altitude() const
78 {
79  return d->m_coordinates.altitude();
80 }
81 
82 void GeoDataLookAt::setLatitude( qreal latitude, GeoDataCoordinates::Unit unit )
83 {
84  detach();
85  d->m_coordinates.setLatitude( latitude,unit );
86 }
87 
88 qreal GeoDataLookAt::latitude( GeoDataCoordinates::Unit unit ) const
89 {
90  return d->m_coordinates.latitude( unit );
91 }
92 
93 void GeoDataLookAt::setLongitude( qreal longitude, GeoDataCoordinates::Unit unit )
94 {
95  detach();
96  d->m_coordinates.setLongitude( longitude, unit );
97 }
98 
99 qreal GeoDataLookAt::longitude( GeoDataCoordinates::Unit unit ) const
100 {
101  return d->m_coordinates.longitude( unit );
102 }
103 
104 GeoDataCoordinates GeoDataLookAt::coordinates() const
105 {
106  return d->m_coordinates;
107 }
108 
109 void GeoDataLookAt::setRange( qreal range )
110 {
111  detach();
112  d->m_range = range;
113 }
114 
115 qreal GeoDataLookAt::range() const
116 {
117  return d->m_range;
118 }
119 
120 void GeoDataLookAt::detach()
121 {
122  qAtomicDetach( d );
123 }
124 
125 }
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 Sep 25 2023 03:50:18 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.