Marble

GeoDataLinearRing.h
1 // SPDX-License-Identifier: LGPL-2.1-or-later
2 //
3 // SPDX-FileCopyrightText: 2008 Torsten Rahn <[email protected]>
4 //
5 
6 
7 #ifndef MARBLE_GEODATALINEARRING_H
8 #define MARBLE_GEODATALINEARRING_H
9 
10 
11 #include "geodata_export.h"
12 #include "GeoDataLineString.h"
13 
14 
15 namespace Marble
16 {
17 
18 class GeoDataLinearRingPrivate;
19 
20 /*!
21  \class GeoDataLinearRing
22  \brief A LinearRing that allows to store a closed, contiguous set of line segments.
23 
24  GeoDataLinearRing is a tool class that implements the LinearRing tag/class
25  of the Open Geospatial Consortium standard KML 2.2.
26 
27  Unlike suggested in the KML spec GeoDataLinearRing extends GeoDataLineString
28  to store a closed LineString (the KML specification suggests to inherit from
29  the Geometry class directly).
30 
31  In the QPainter API LinearRings are also referred to as "polygons".
32  As such they are similar to QPolygons.
33 
34  Whenever a LinearRing is painted GeoDataLineStyle should be used to assign a
35  color and line width.
36 
37  A GeoDataLinearRing consists of several (geodetic) nodes which are each
38  connected through line segments. The nodes are stored as GeoDataCoordinates
39  objects.
40 
41  The API which provides access to the nodes is similar to the API of
42  QVector.
43 
44  GeoDataLinearRing allows LinearRings to be tessellated in order to make them
45  follow the terrain and the curvature of the earth. The tessellation options
46  allow for different ways of visualization:
47 
48  \li Not tessellated: A LinearRing that connects each two nodes directly and
49  straight in screen coordinate space.
50  \li A tessellated line: Each line segment is bent so that the LinearRing
51  follows the curvature of the earth and its terrain. A tessellated
52  line segment connects two nodes at the shortest possible distance
53  ("along great circles").
54  \li A tessellated line that follows latitude circles whenever possible:
55  In this case Latitude circles are followed as soon as two subsequent
56  nodes have exactly the same amount of latitude. In all other places the
57  line segments follow great circles.
58 
59  Some convenience methods have been added that allow to calculate the
60  geodesic bounding box or the length of a LinearRing.
61 */
62 class GEODATA_EXPORT GeoDataLinearRing : public GeoDataLineString
63 {
64 
65  public:
66 /*!
67  \brief Creates a new LinearRing.
68 */
69  explicit GeoDataLinearRing( TessellationFlags f = NoTessellation);
70 
71 
72 /*!
73  \brief Creates a LinearRing from an existing geometry object.
74 */
75  explicit GeoDataLinearRing(const GeoDataGeometry &other);
76 
77 
78 /*!
79  \brief Destroys a LinearRing.
80 */
81  ~GeoDataLinearRing() override;
82 
83  const char *nodeType() const override;
84 
85  EnumGeometryId geometryId() const override;
86 
87  GeoDataGeometry *copy() const override;
88 
89 
90 /*!
91  \brief Returns true/false depending on whether this and other are/are not equal.
92 */
93 
94  bool operator==( const GeoDataLinearRing &other ) const;
95  bool operator!=( const GeoDataLinearRing &other ) const;
96 
97 
98 /*!
99  \brief Returns whether a LinearRing is a closed polygon.
100 
101  \return <code>true</code> for a LinearRing.
102 */
103  bool isClosed() const override;
104 
105 
106 /*!
107  \brief Returns the length of the LinearRing across a sphere.
108 
109  As a parameter the \a planetRadius needs to be passed.
110 
111  \return The return value is the length of the LinearRing.
112  The unit used for the resulting length matches the unit of the planet
113  radius.
114 
115  This method can be used as an approximation for the circumference of a
116  LinearRing.
117 */
118  qreal length( qreal planetRadius, int offset = 0 ) const override;
119 
120 /*!
121  \brief Returns whether the given coordinates lie within the polygon.
122 
123  \return <code>true</code> if the coordinates lie within the polygon, false otherwise.
124 */
125  virtual bool contains( const GeoDataCoordinates &coordinates ) const;
126 
127 /*!
128  * \brief Returns whether the orientaion of ring is coloskwise or not
129  * \return Return value is true if ring is clockwise orientated
130  */
131  virtual bool isClockwise() const;
132 };
133 
134 }
135 
136 #endif
A 3d point representation.
A LinearRing that allows to store a closed, contiguous set of line segments.
Binds a QML item to a specific geodetic location in screen coordinates.
A base class for all geodata features.
A LineString that allows to store a contiguous set of line segments.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Nov 26 2021 23:23:27 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.