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) && d->m_coordinates == other.d->m_coordinates && d->m_range == other.d->m_range;
41}
42
43bool GeoDataLookAt::operator!=(const GeoDataLookAt &other) const
44{
45 return !this->operator==(other);
46}
47
48GeoDataLookAt::~GeoDataLookAt()
49{
50 if (!d->ref.deref())
51 delete d;
52}
53
54GeoDataAbstractView *GeoDataLookAt::copy() const
55{
56 return new GeoDataLookAt(*this);
57}
58
59void GeoDataLookAt::setCoordinates(const GeoDataCoordinates &coordinates)
60{
61 d->m_coordinates = coordinates;
62}
63
64const char *GeoDataLookAt::nodeType() const
65{
66 return GeoDataTypes::GeoDataLookAtType;
67}
68
69void GeoDataLookAt::setAltitude(qreal altitude)
70{
71 detach();
72 d->m_coordinates.setAltitude(altitude);
73}
74
75qreal GeoDataLookAt::altitude() const
76{
77 return d->m_coordinates.altitude();
78}
79
80void GeoDataLookAt::setLatitude(qreal latitude, GeoDataCoordinates::Unit unit)
81{
82 detach();
83 d->m_coordinates.setLatitude(latitude, unit);
84}
85
86qreal GeoDataLookAt::latitude(GeoDataCoordinates::Unit unit) const
87{
88 return d->m_coordinates.latitude(unit);
89}
90
91void GeoDataLookAt::setLongitude(qreal longitude, GeoDataCoordinates::Unit unit)
92{
93 detach();
94 d->m_coordinates.setLongitude(longitude, unit);
95}
96
97qreal GeoDataLookAt::longitude(GeoDataCoordinates::Unit unit) const
98{
99 return d->m_coordinates.longitude(unit);
100}
101
102GeoDataCoordinates GeoDataLookAt::coordinates() const
103{
104 return d->m_coordinates;
105}
106
107void GeoDataLookAt::setRange(qreal range)
108{
109 detach();
110 d->m_range = range;
111}
112
113qreal GeoDataLookAt::range() const
114{
115 return d->m_range;
116}
117
118void GeoDataLookAt::detach()
119{
120 qAtomicDetach(d);
121}
122
123}
bool equals(const QVariant &lhs, const QVariant &rhs)
bool operator==(const StyleDelim &l, const StyleDelim &r)
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 Mon Nov 18 2024 12:15:45 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.