Marble

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

KDE's Doxygen guidelines are available online.