8#include "GeoDataGeometry.h"
9#include "GeoDataGeometry_p.h"
11#include "GeoDataLineString.h"
12#include "GeoDataLinearRing.h"
13#include "GeoDataModel.h"
14#include "GeoDataMultiGeometry.h"
15#include "GeoDataMultiTrack.h"
16#include "GeoDataPoint.h"
17#include "GeoDataPolygon.h"
18#include "GeoDataTrack.h"
19#include "GeoDataTypes.h"
21#include "MarbleDebug.h"
28GeoDataGeometry::GeoDataGeometry(
const GeoDataGeometry &other)
35GeoDataGeometry::GeoDataGeometry(GeoDataGeometryPrivate *priv)
42GeoDataGeometry::~GeoDataGeometry()
44 if (!d_ptr->ref.deref())
48void GeoDataGeometry::detach()
50 if (d_ptr->ref.fetchAndAddRelaxed(0) == 1) {
54 GeoDataGeometryPrivate *new_d = d_ptr->copy();
56 if (!d_ptr->ref.deref())
63GeoDataGeometry &GeoDataGeometry::operator=(
const GeoDataGeometry &other)
65 GeoDataObject::operator=(other);
67 if (!d_ptr->ref.deref())
76bool GeoDataGeometry::operator==(
const GeoDataGeometry &other)
const
78 if (nodeType() != other.nodeType()) {
82 if (nodeType() == GeoDataTypes::GeoDataPolygonType) {
83 const auto &thisPoly =
static_cast<const GeoDataPolygon &
>(*this);
84 const auto &otherPoly =
static_cast<const GeoDataPolygon &
>(other);
86 return thisPoly == otherPoly;
87 }
else if (nodeType() == GeoDataTypes::GeoDataLinearRingType) {
88 const auto &thisRing =
static_cast<const GeoDataLinearRing &
>(*this);
89 const auto &otherRing =
static_cast<const GeoDataLinearRing &
>(other);
91 return thisRing == otherRing;
92 }
else if (nodeType() == GeoDataTypes::GeoDataLineStringType) {
93 const auto &thisLine =
static_cast<const GeoDataLineString &
>(*this);
94 const auto &otherLine =
static_cast<const GeoDataLineString &
>(other);
96 return thisLine == otherLine;
97 }
else if (nodeType() == GeoDataTypes::GeoDataModelType) {
98 const auto &thisModel =
static_cast<const GeoDataModel &
>(*this);
99 const auto &otherModel =
static_cast<const GeoDataModel &
>(other);
101 return thisModel == otherModel;
102 }
else if (nodeType() == GeoDataTypes::GeoDataMultiGeometryType) {
103 const auto &thisMG =
static_cast<const GeoDataMultiGeometry &
>(*this);
104 const auto &otherMG =
static_cast<const GeoDataMultiGeometry &
>(other);
106 return thisMG == otherMG;
107 }
else if (nodeType() == GeoDataTypes::GeoDataTrackType) {
108 const auto &thisTrack =
static_cast<const GeoDataTrack &
>(*this);
109 const auto &otherTrack =
static_cast<const GeoDataTrack &
>(other);
111 return thisTrack == otherTrack;
112 }
else if (nodeType() == GeoDataTypes::GeoDataMultiTrackType) {
113 const auto &thisMT =
static_cast<const GeoDataMultiTrack &
>(*this);
114 const auto &otherMT =
static_cast<const GeoDataMultiTrack &
>(other);
116 return thisMT == otherMT;
117 }
else if (nodeType() == GeoDataTypes::GeoDataPointType) {
118 const auto &thisPoint =
static_cast<const GeoDataPoint &
>(*this);
119 const auto &otherPoint =
static_cast<const GeoDataPoint &
>(other);
121 return thisPoint == otherPoint;
127bool GeoDataGeometry::extrude()
const
129 return d_ptr->m_extrude;
132void GeoDataGeometry::setExtrude(
bool extrude)
135 d_ptr->m_extrude = extrude;
138AltitudeMode GeoDataGeometry::altitudeMode()
const
140 return d_ptr->m_altitudeMode;
143void GeoDataGeometry::setAltitudeMode(
const AltitudeMode altitudeMode)
146 d_ptr->m_altitudeMode = altitudeMode;
149const GeoDataLatLonAltBox &GeoDataGeometry::latLonAltBox()
const
151 return d_ptr->m_latLonAltBox;
156 GeoDataObject::pack(stream);
158 stream << d_ptr->m_extrude;
159 stream << d_ptr->m_altitudeMode;
165 GeoDataObject::unpack(stream);
168 stream >> d_ptr->m_extrude;
175 return GeoDataObject::equals(other) && d_ptr->m_extrude == other.d_ptr->m_extrude && d_ptr->m_altitudeMode == other.d_ptr->m_altitudeMode;
A base class for all geodata features.
Binds a QML item to a specific geodetic location in screen coordinates.