Changeset View
Changeset View
Standalone View
Standalone View
src/lib/marble/geodata/data/GeoDataPoint.cpp
Show All 25 Lines | |||||
26 | 26 | | |||
27 | namespace Marble | 27 | namespace Marble | ||
28 | { | 28 | { | ||
29 | 29 | | |||
30 | GeoDataPoint::GeoDataPoint( qreal lon, qreal lat, qreal alt, | 30 | GeoDataPoint::GeoDataPoint( qreal lon, qreal lat, qreal alt, | ||
31 | GeoDataCoordinates::Unit unit ) | 31 | GeoDataCoordinates::Unit unit ) | ||
32 | : GeoDataGeometry( new GeoDataPointPrivate ) | 32 | : GeoDataGeometry( new GeoDataPointPrivate ) | ||
33 | { | 33 | { | ||
34 | p()->m_coordinates = GeoDataCoordinates( lon, lat, alt, unit ); | 34 | Q_D(GeoDataPoint); | ||
35 | p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates ); | 35 | d->m_coordinates = GeoDataCoordinates(lon, lat, alt, unit); | ||
36 | d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates); | ||||
36 | } | 37 | } | ||
37 | 38 | | |||
38 | GeoDataPoint::GeoDataPoint( const GeoDataPoint& other ) | 39 | GeoDataPoint::GeoDataPoint( const GeoDataPoint& other ) | ||
39 | : GeoDataGeometry( other ) | 40 | : GeoDataGeometry( other ) | ||
40 | | ||||
41 | { | 41 | { | ||
42 | p()->m_coordinates = other.p()->m_coordinates; | 42 | Q_D(GeoDataPoint); | ||
43 | p()->m_latLonAltBox = other.p()->m_latLonAltBox; | 43 | const GeoDataPointPrivate * const otherD = other.d_func(); | ||
44 | | ||||
45 | d->m_coordinates = otherD->m_coordinates; | ||||
46 | d->m_latLonAltBox = otherD->m_latLonAltBox; | ||||
44 | } | 47 | } | ||
45 | 48 | | |||
46 | GeoDataPoint::GeoDataPoint( const GeoDataCoordinates& other ) | 49 | GeoDataPoint::GeoDataPoint( const GeoDataCoordinates& other ) | ||
47 | : GeoDataGeometry ( new GeoDataPointPrivate ) | 50 | : GeoDataGeometry ( new GeoDataPointPrivate ) | ||
48 | { | 51 | { | ||
49 | p()->m_coordinates = other; | 52 | Q_D(GeoDataPoint); | ||
50 | p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates ); | 53 | d->m_coordinates = other; | ||
54 | d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates); | ||||
51 | } | 55 | } | ||
52 | 56 | | |||
53 | GeoDataPoint::GeoDataPoint() | 57 | GeoDataPoint::GeoDataPoint() | ||
54 | : GeoDataGeometry( new GeoDataPointPrivate ) | 58 | : GeoDataGeometry( new GeoDataPointPrivate ) | ||
55 | { | 59 | { | ||
56 | // nothing to do | 60 | // nothing to do | ||
57 | } | 61 | } | ||
58 | 62 | | |||
Show All 11 Lines | |||||
70 | bool GeoDataPoint::operator!=( const GeoDataPoint &other ) const | 74 | bool GeoDataPoint::operator!=( const GeoDataPoint &other ) const | ||
71 | { | 75 | { | ||
72 | return !this->operator==(other); | 76 | return !this->operator==(other); | ||
73 | } | 77 | } | ||
74 | 78 | | |||
75 | void GeoDataPoint::setCoordinates( const GeoDataCoordinates &coordinates ) | 79 | void GeoDataPoint::setCoordinates( const GeoDataCoordinates &coordinates ) | ||
76 | { | 80 | { | ||
77 | detach(); | 81 | detach(); | ||
78 | p()->m_coordinates = coordinates; | | |||
79 | p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates ); | | |||
80 | } | | |||
81 | 82 | | |||
82 | const GeoDataCoordinates &GeoDataPoint::coordinates() const | 83 | Q_D(GeoDataPoint); | ||
83 | { | 84 | d->m_coordinates = coordinates; | ||
84 | return p()->m_coordinates; | 85 | d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates); | ||
85 | } | 86 | } | ||
86 | 87 | | |||
87 | GeoDataPointPrivate* GeoDataPoint::p() | 88 | const GeoDataCoordinates &GeoDataPoint::coordinates() const | ||
88 | { | | |||
89 | return static_cast<GeoDataPointPrivate*>(GeoDataGeometry::d); | | |||
90 | } | | |||
91 | | ||||
92 | const GeoDataPointPrivate* GeoDataPoint::p() const | | |||
93 | { | 89 | { | ||
94 | return static_cast<GeoDataPointPrivate*>(GeoDataGeometry::d); | 90 | Q_D(const GeoDataPoint); | ||
91 | return d->m_coordinates; | ||||
95 | } | 92 | } | ||
96 | 93 | | |||
97 | const char* GeoDataPoint::nodeType() const | 94 | const char* GeoDataPoint::nodeType() const | ||
98 | { | 95 | { | ||
99 | return GeoDataTypes::GeoDataPointType; | 96 | return GeoDataTypes::GeoDataPointType; | ||
100 | } | 97 | } | ||
101 | 98 | | |||
102 | void GeoDataPoint::detach() | 99 | void GeoDataPoint::detach() | ||
103 | { | 100 | { | ||
104 | GeoDataGeometry::detach(); | 101 | GeoDataGeometry::detach(); | ||
105 | } | 102 | } | ||
106 | 103 | | |||
107 | void GeoDataPoint::pack( QDataStream& stream ) const | 104 | void GeoDataPoint::pack( QDataStream& stream ) const | ||
108 | { | 105 | { | ||
109 | p()->m_coordinates.pack( stream ); | 106 | Q_D(const GeoDataPoint); | ||
107 | d->m_coordinates.pack(stream); | ||||
108 | // TODO: what about m_latLonAltBox and base class? | ||||
110 | } | 109 | } | ||
111 | 110 | | |||
112 | void GeoDataPoint::unpack( QDataStream& stream ) | 111 | void GeoDataPoint::unpack( QDataStream& stream ) | ||
113 | { | 112 | { | ||
114 | p()->m_coordinates.unpack( stream ); | 113 | Q_D(GeoDataPoint); | ||
114 | d->m_coordinates.unpack(stream); | ||||
115 | // TODO: what about m_latLonAltBox and base class? | ||||
115 | } | 116 | } | ||
116 | 117 | | |||
117 | } | 118 | } |