Marble

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

KDE's Doxygen guidelines are available online.