Marble

GeoDataPoint.cpp
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2004-2007 Torsten Rahn <tackat@kde.org>
4// SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
5// SPDX-FileCopyrightText: 2008 Patrick Spendrin <ps_ml@gmx.de>
6//
7
8
9#include "GeoDataPoint.h"
10#include "GeoDataPoint_p.h"
11
12
13#include "MarbleDebug.h"
14#include "MarbleGlobal.h"
15
16#include "GeoDataTypes.h"
17#include "GeoDataLatLonAltBox.h"
18
19
20namespace Marble
21{
22
23GeoDataPoint::GeoDataPoint( qreal lon, qreal lat, qreal alt,
25 : GeoDataGeometry( new GeoDataPointPrivate )
26{
28 d->m_coordinates = GeoDataCoordinates(lon, lat, alt, unit);
29 d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
30}
31
32GeoDataPoint::GeoDataPoint( const GeoDataPoint& other )
33 : GeoDataGeometry( other )
34{
36 const GeoDataPointPrivate * const otherD = other.d_func();
37
38 d->m_coordinates = otherD->m_coordinates;
39 d->m_latLonAltBox = otherD->m_latLonAltBox;
40}
41
42GeoDataPoint::GeoDataPoint( const GeoDataCoordinates& other )
43 : GeoDataGeometry ( new GeoDataPointPrivate )
44{
45 Q_D(GeoDataPoint);
46 d->m_coordinates = other;
47 d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
48}
49
50GeoDataPoint::GeoDataPoint()
51 : GeoDataGeometry( new GeoDataPointPrivate )
52{
53 // nothing to do
54}
55
56GeoDataPoint::~GeoDataPoint()
57{
58 // nothing to do
59}
60
61EnumGeometryId GeoDataPoint::geometryId() const
62{
63 return GeoDataPointId;
64}
65
66GeoDataGeometry *GeoDataPoint::copy() const
67{
68 return new GeoDataPoint(*this);
69}
70
71bool GeoDataPoint::operator==( const GeoDataPoint &other ) const
72{
73 return equals(other) &&
74 coordinates() == other.coordinates();
75}
76
77bool GeoDataPoint::operator!=( const GeoDataPoint &other ) const
78{
79 return !this->operator==(other);
80}
81
82void GeoDataPoint::setCoordinates( const GeoDataCoordinates &coordinates )
83{
84 detach();
85
86 Q_D(GeoDataPoint);
87 d->m_coordinates = coordinates;
88 d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
89}
90
91const GeoDataCoordinates &GeoDataPoint::coordinates() const
92{
93 Q_D(const GeoDataPoint);
94 return d->m_coordinates;
95}
96
97const char* GeoDataPoint::nodeType() const
98{
99 return GeoDataTypes::GeoDataPointType;
100}
101
102void GeoDataPoint::detach()
103{
104 GeoDataGeometry::detach();
105}
106
107void GeoDataPoint::pack( QDataStream& stream ) const
108{
109 Q_D(const GeoDataPoint);
110 d->m_coordinates.pack(stream);
111 // TODO: what about m_latLonAltBox and base class?
112}
113
114void GeoDataPoint::unpack( QDataStream& stream )
115{
116 Q_D(GeoDataPoint);
117 d->m_coordinates.unpack(stream);
118 // TODO: what about m_latLonAltBox and base class?
119}
120
121}
A 3d point representation.
Unit
enum used constructor to specify the units used
A base class for all geodata features.
A class that defines a 3D bounding box for geographic data.
A Geometry object representing a 3d point.
const char * nodeType() const override
Provides type information for downcasting a GeoData.
Binds a QML item to a specific geodetic location in screen coordinates.
Q_D(Todo)
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.