Marble

GeoDataPoint.cpp
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2004-2007 Torsten Rahn <[email protected]>
4 // SPDX-FileCopyrightText: 2007 Inge Wallin <[email protected]>
5 // SPDX-FileCopyrightText: 2008 Patrick Spendrin <[email protected]>
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 
20 namespace Marble
21 {
22 
23 GeoDataPoint::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 
32 GeoDataPoint::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 
42 GeoDataPoint::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 
50 GeoDataPoint::GeoDataPoint()
51  : GeoDataGeometry( new GeoDataPointPrivate )
52 {
53  // nothing to do
54 }
55 
56 GeoDataPoint::~GeoDataPoint()
57 {
58  // nothing to do
59 }
60 
61 EnumGeometryId GeoDataPoint::geometryId() const
62 {
63  return GeoDataPointId;
64 }
65 
66 GeoDataGeometry *GeoDataPoint::copy() const
67 {
68  return new GeoDataPoint(*this);
69 }
70 
71 bool GeoDataPoint::operator==( const GeoDataPoint &other ) const
72 {
73  return equals(other) &&
74  coordinates() == other.coordinates();
75 }
76 
77 bool GeoDataPoint::operator!=( const GeoDataPoint &other ) const
78 {
79  return !this->operator==(other);
80 }
81 
82 void 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 
91 const GeoDataCoordinates &GeoDataPoint::coordinates() const
92 {
93  Q_D(const GeoDataPoint);
94  return d->m_coordinates;
95 }
96 
97 const char* GeoDataPoint::nodeType() const
98 {
99  return GeoDataTypes::GeoDataPointType;
100 }
101 
102 void GeoDataPoint::detach()
103 {
104  GeoDataGeometry::detach();
105 }
106 
107 void 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 
114 void 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.
A class that defines a 3D bounding box for geographic data.
A base class for all geodata features.
A Geometry object representing a 3d point.
Definition: GeoDataPoint.h:42
Binds a QML item to a specific geodetic location in screen coordinates.
const char * nodeType() const override
Provides type information for downcasting a GeoData.
Unit
enum used constructor to specify the units used
Q_D(Todo)
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.