Marble

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

KDE's Doxygen guidelines are available online.