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#include "GeoDataPoint.h"
9#include "GeoDataPoint_p.h"
10
11#include "MarbleDebug.h"
12#include "MarbleGlobal.h"
13
14#include "GeoDataLatLonAltBox.h"
15#include "GeoDataTypes.h"
16
17namespace Marble
18{
19
20GeoDataPoint::GeoDataPoint(qreal lon, qreal lat, qreal alt, GeoDataCoordinates::Unit unit)
21 : GeoDataGeometry(new GeoDataPointPrivate)
22{
24 d->m_coordinates = GeoDataCoordinates(lon, lat, alt, unit);
25 d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
26}
27
28GeoDataPoint::GeoDataPoint(const GeoDataPoint &other)
29 : GeoDataGeometry(other)
30{
32 const GeoDataPointPrivate *const otherD = other.d_func();
33
34 d->m_coordinates = otherD->m_coordinates;
35 d->m_latLonAltBox = otherD->m_latLonAltBox;
36}
37
38GeoDataPoint::GeoDataPoint(const GeoDataCoordinates &other)
39 : GeoDataGeometry(new GeoDataPointPrivate)
40{
41 Q_D(GeoDataPoint);
42 d->m_coordinates = other;
43 d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
44}
45
46GeoDataPoint::GeoDataPoint()
47 : GeoDataGeometry(new GeoDataPointPrivate)
48{
49 // nothing to do
50}
51
52GeoDataPoint::~GeoDataPoint()
53{
54 // nothing to do
55}
56
57EnumGeometryId GeoDataPoint::geometryId() const
58{
59 return GeoDataPointId;
60}
61
62GeoDataGeometry *GeoDataPoint::copy() const
63{
64 return new GeoDataPoint(*this);
65}
66
67bool GeoDataPoint::operator==(const GeoDataPoint &other) const
68{
69 return equals(other) && coordinates() == other.coordinates();
70}
71
72bool GeoDataPoint::operator!=(const GeoDataPoint &other) const
73{
74 return !this->operator==(other);
75}
76
77void GeoDataPoint::setCoordinates(const GeoDataCoordinates &coordinates)
78{
79 detach();
80
81 Q_D(GeoDataPoint);
82 d->m_coordinates = coordinates;
83 d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
84}
85
86const GeoDataCoordinates &GeoDataPoint::coordinates() const
87{
88 Q_D(const GeoDataPoint);
89 return d->m_coordinates;
90}
91
92const char *GeoDataPoint::nodeType() const
93{
94 return GeoDataTypes::GeoDataPointType;
95}
96
97void GeoDataPoint::detach()
98{
99 GeoDataGeometry::detach();
100}
101
102void GeoDataPoint::pack(QDataStream &stream) const
103{
104 Q_D(const GeoDataPoint);
105 d->m_coordinates.pack(stream);
106 // TODO: what about m_latLonAltBox and base class?
107}
108
109void GeoDataPoint::unpack(QDataStream &stream)
110{
111 Q_D(GeoDataPoint);
112 d->m_coordinates.unpack(stream);
113 // TODO: what about m_latLonAltBox and base class?
114}
115
116}
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 Sat Dec 21 2024 17:04:14 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.