Marble

GeoDataLatLonAltBox.h
1// SPDX-License-Identifier: LGPL-2.1-or-later
2//
3// SPDX-FileCopyrightText: 2007 Andrew Manson <g.real.ate@gmail.com>
4// SPDX-FileCopyrightText: 2008 Torsten Rahn <rahn@kde.org>
5//
6
7#ifndef MARBLE_GEODATALATLONALTBOX_H
8#define MARBLE_GEODATALATLONALTBOX_H
9
10#include "MarbleGlobal.h"
11
12#include "geodata_export.h"
13
14#include "GeoDataLatLonBox.h"
15
16#include <QHash>
17
18namespace Marble
19{
20
21class GeoDataLatLonAltBoxPrivate;
22
23class GeoDataLineString;
24
25/**
26 * @short A class that defines a 3D bounding box for geographic data.
27 *
28 * GeoDataLatLonAltBox is a 3D bounding box that describes a geographic area
29 * in terms of latitude, longitude and altitude.
30 *
31 * The bounding box gets described by assigning the northern, southern,
32 * eastern and western boundary.
33 * So usually the value of the eastern boundary is bigger than the
34 * value of the western boundary. Only if the bounding box crosses the
35 * date line then the eastern boundary has got a smaller value than
36 * the western one.
37 */
38
39class GEODATA_EXPORT GeoDataLatLonAltBox : public GeoDataLatLonBox
40{
41 friend bool GEODATA_EXPORT operator==(GeoDataLatLonAltBox const &lhs, GeoDataLatLonAltBox const &rhs);
42
43public:
46 GeoDataLatLonAltBox(const GeoDataLatLonBox &other, qreal minAltitude, qreal maxAltitude);
47 /**
48 * @brief A LatLonAltBox with the data from a GeoDataCoordinate
49 * This way of creating a GeoDataLatLonAltBox sets the north and south
50 * values of this box to the Latitude value in the GeoDataCoordinate,
51 * resulting in a Box that has a 0 Area. This is useful for building
52 * LatLonAltBoxes from GeoDataCoordinates.
53 */
54 explicit GeoDataLatLonAltBox(const GeoDataCoordinates &coordinates);
55
56 ~GeoDataLatLonAltBox() override;
57
58 GeoDataLatLonAltBox &operator=(const GeoDataLatLonAltBox &other);
59 GeoDataLatLonAltBox &operator=(const GeoDataCoordinates &other);
60
61 /// Provides type information for downcasting a GeoData
62 const char *nodeType() const override;
63
64 /**
65 * @brief qHash, for using GeoDataLatLonAltBox in a QCache as Key
66 * @return the hash of the GeoDataLatLonAltBox
67 */
69
70 /**
71 * @brief Get the lower altitude boundary of the bounding box.
72 * @return the height of the lower altitude boundary in meters.
73 */
74 qreal minAltitude() const;
75 void setMinAltitude(const qreal minAltitude);
76
77 /**
78 * @brief Get the upper altitude boundary of the bounding box.
79 * @return the height of the upper altitude boundary in meters.
80 */
81 qreal maxAltitude() const;
82 void setMaxAltitude(const qreal maxAltitude);
83
84 /**
85 * @brief Get the reference system for the altitude.
86 * @return the point of reference which marks the origin
87 * for measuring the altitude.
88 */
89 AltitudeMode altitudeMode() const;
90 void setAltitudeMode(const AltitudeMode altitudeMode);
91
92 bool contains(const GeoDataCoordinates &) const override;
93 bool contains(const GeoDataLatLonAltBox &) const;
94
95 /**
96 * @brief Check if this GeoDataLatLonAltBox intersects with the given one.
97 */
98 virtual bool intersects(const GeoDataLatLonAltBox &) const;
99
100 using GeoDataLatLonBox::intersects;
101
102 /**
103 * @brief Create the smallest bounding box from a line string.
104 * @return the smallest bounding box that contains the linestring.
105 */
106 static GeoDataLatLonAltBox fromLineString(const GeoDataLineString &lineString);
107
108 /**
109 * @brief Indicates whether the bounding box only contains a single 2D point ("singularity").
110 * @return Return value is true if the height and the width of the bounding box equal zero.
111 */
112 bool isNull() const override;
113
114 /**
115 * @brief Resets the bounding box to its uninitialised state (and thus contains nothing).
116 */
117 void clear() override;
118
119 /**
120 * @brief returns the center of this box
121 * @return a coordinate, body-center of the box
122 */
123 GeoDataCoordinates center() const override;
124
125 /// Serialize the contents of the feature to @p stream.
126 void pack(QDataStream &stream) const override;
127 /// Unserialize the contents of the feature from @p stream.
128 void unpack(QDataStream &stream) override;
129
130private:
131 GeoDataLatLonAltBoxPrivate *const d;
132};
133
134uint GEODATA_EXPORT qHash(const GeoDataLatLonAltBox &box, uint seed = 0);
135
136bool GEODATA_EXPORT operator==(GeoDataLatLonAltBox const &lhs, GeoDataLatLonAltBox const &rhs);
137
138}
139
140Q_DECLARE_METATYPE(Marble::GeoDataLatLonAltBox)
141
142#endif
A 3d point representation.
A class that defines a 3D bounding box for geographic data.
uint qHash(const GeoDataLatLonAltBox &)
qHash, for using GeoDataLatLonAltBox in a QCache as Key
A class that defines a 2D bounding box for geographic data.
A LineString that allows to store a contiguous set of line segments.
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.