summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-10-05 23:10:26 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-10-06 20:13:18 (GMT)
commit3e280f9061d48eeeb97a29e213d6931a88dbd53e (patch)
treeeb0847d6910f40ddd8cdfe8ea26b333f979aeb32
parent92e6692ca703bba1e6f2f145b4a6b59fcdd75491 (diff)
Qt'fy access to pimpl objects: use macros Q_DECLARE_PRIVATE & Q_D
Summary: * enforces constness some more (see issue spotted with GeoDataTrack::extendedData()) * delivers inline-ness of the access methods * code should be more familiar to Qt developers Reviewers: #marble, nienhueser Reviewed By: #marble, nienhueser Subscribers: nienhueser Differential Revision: https://phabricator.kde.org/D2951
-rw-r--r--src/lib/marble/geodata/data/GeoDataGeometry.cpp62
-rw-r--r--src/lib/marble/geodata/data/GeoDataGeometry.h2
-rw-r--r--src/lib/marble/geodata/data/GeoDataLineString.cpp201
-rw-r--r--src/lib/marble/geodata/data/GeoDataLineString.h3
-rw-r--r--src/lib/marble/geodata/data/GeoDataModel.cpp102
-rw-r--r--src/lib/marble/geodata/data/GeoDataModel.h2
-rw-r--r--src/lib/marble/geodata/data/GeoDataMultiGeometry.cpp126
-rw-r--r--src/lib/marble/geodata/data/GeoDataMultiGeometry.h4
-rw-r--r--src/lib/marble/geodata/data/GeoDataMultiTrack.cpp131
-rw-r--r--src/lib/marble/geodata/data/GeoDataMultiTrack.h4
-rw-r--r--src/lib/marble/geodata/data/GeoDataPoint.cpp45
-rw-r--r--src/lib/marble/geodata/data/GeoDataPoint.h4
-rw-r--r--src/lib/marble/geodata/data/GeoDataPolygon.cpp92
-rw-r--r--src/lib/marble/geodata/data/GeoDataPolygon.h3
-rw-r--r--src/lib/marble/geodata/data/GeoDataTrack.cpp165
-rw-r--r--src/lib/marble/geodata/data/GeoDataTrack.h5
16 files changed, 562 insertions, 389 deletions
diff --git a/src/lib/marble/geodata/data/GeoDataGeometry.cpp b/src/lib/marble/geodata/data/GeoDataGeometry.cpp
index ff3de0f..a613368 100644
--- a/src/lib/marble/geodata/data/GeoDataGeometry.cpp
+++ b/src/lib/marble/geodata/data/GeoDataGeometry.cpp
@@ -28,102 +28,102 @@ namespace Marble
{
GeoDataGeometry::GeoDataGeometry()
- : d( new GeoDataGeometryPrivate() )
+ : d_ptr(new GeoDataGeometryPrivate())
{
- d->ref.ref();
+ d_ptr->ref.ref();
}
GeoDataGeometry::GeoDataGeometry( const GeoDataGeometry& other )
: GeoDataObject(),
- d( other.d )
+ d_ptr(other.d_ptr)
{
- d->ref.ref();
+ d_ptr->ref.ref();
}
GeoDataGeometry::GeoDataGeometry( GeoDataGeometryPrivate* priv )
: GeoDataObject(),
- d( priv )
+ d_ptr(priv)
{
- d->ref.ref();
+ d_ptr->ref.ref();
}
GeoDataGeometry::~GeoDataGeometry()
{
- if (!d->ref.deref())
- delete d;
+ if (!d_ptr->ref.deref())
+ delete d_ptr;
}
void GeoDataGeometry::detach()
{
- if(d->ref.load() == 1) {
+ if(d_ptr->ref.load() == 1) {
return;
}
- GeoDataGeometryPrivate* new_d = d->copy();
+ GeoDataGeometryPrivate* new_d = d_ptr->copy();
- if (!d->ref.deref())
- delete d;
+ if (!d_ptr->ref.deref())
+ delete d_ptr;
- d = new_d;
- d->ref.ref();
+ d_ptr = new_d;
+ d_ptr->ref.ref();
}
const char* GeoDataGeometry::nodeType() const
{
- return d->nodeType();
+ return d_ptr->nodeType();
}
EnumGeometryId GeoDataGeometry::geometryId() const
{
- return d->geometryId();
+ return d_ptr->geometryId();
}
GeoDataGeometry& GeoDataGeometry::operator=( const GeoDataGeometry& other )
{
GeoDataObject::operator=( other );
- if (!d->ref.deref())
- delete d;
+ if (!d_ptr->ref.deref())
+ delete d_ptr;
- d = other.d;
- d->ref.ref();
+ d_ptr = other.d_ptr;
+ d_ptr->ref.ref();
return *this;
}
bool GeoDataGeometry::extrude() const
{
- return d->m_extrude;
+ return d_ptr->m_extrude;
}
void GeoDataGeometry::setExtrude( bool extrude )
{
detach();
- d->m_extrude = extrude;
+ d_ptr->m_extrude = extrude;
}
AltitudeMode GeoDataGeometry::altitudeMode() const
{
- return d->m_altitudeMode;
+ return d_ptr->m_altitudeMode;
}
void GeoDataGeometry::setAltitudeMode( const AltitudeMode altitudeMode )
{
detach();
- d->m_altitudeMode = altitudeMode;
+ d_ptr->m_altitudeMode = altitudeMode;
}
const GeoDataLatLonAltBox& GeoDataGeometry::latLonAltBox() const
{
- return d->m_latLonAltBox;
+ return d_ptr->m_latLonAltBox;
}
void GeoDataGeometry::pack( QDataStream& stream ) const
{
GeoDataObject::pack( stream );
- stream << d->m_extrude;
- stream << d->m_altitudeMode;
+ stream << d_ptr->m_extrude;
+ stream << d_ptr->m_altitudeMode;
}
void GeoDataGeometry::unpack( QDataStream& stream )
@@ -132,16 +132,16 @@ void GeoDataGeometry::unpack( QDataStream& stream )
GeoDataObject::unpack( stream );
int am;
- stream >> d->m_extrude;
+ stream >> d_ptr->m_extrude;
stream >> am;
- d->m_altitudeMode = (AltitudeMode) am;
+ d_ptr->m_altitudeMode = (AltitudeMode) am;
}
bool GeoDataGeometry::equals(const GeoDataGeometry &other) const
{
return GeoDataObject::equals(other) &&
- d->m_extrude == other.d->m_extrude &&
- d->m_altitudeMode == other.d->m_altitudeMode;
+ d_ptr->m_extrude == other.d_ptr->m_extrude &&
+ d_ptr->m_altitudeMode == other.d_ptr->m_altitudeMode;
}
}
diff --git a/src/lib/marble/geodata/data/GeoDataGeometry.h b/src/lib/marble/geodata/data/GeoDataGeometry.h
index 5fa31e6..d9c277b 100644
--- a/src/lib/marble/geodata/data/GeoDataGeometry.h
+++ b/src/lib/marble/geodata/data/GeoDataGeometry.h
@@ -76,7 +76,7 @@ class GEODATA_EXPORT GeoDataGeometry : public GeoDataObject
using GeoDataObject::equals;
protected:
- GeoDataGeometryPrivate *d;
+ GeoDataGeometryPrivate *d_ptr;
};
}
diff --git a/src/lib/marble/geodata/data/GeoDataLineString.cpp b/src/lib/marble/geodata/data/GeoDataLineString.cpp
index 03c863c..1b65a93 100644
--- a/src/lib/marble/geodata/data/GeoDataLineString.cpp
+++ b/src/lib/marble/geodata/data/GeoDataLineString.cpp
@@ -48,16 +48,6 @@ GeoDataLineString::~GeoDataLineString()
#endif
}
-GeoDataLineStringPrivate* GeoDataLineString::p()
-{
- return static_cast<GeoDataLineStringPrivate*>(d);
-}
-
-const GeoDataLineStringPrivate* GeoDataLineString::p() const
-{
- return static_cast<GeoDataLineStringPrivate*>(d);
-}
-
void GeoDataLineStringPrivate::interpolateDateLine( const GeoDataCoordinates & previousCoords,
const GeoDataCoordinates & currentCoords,
GeoDataCoordinates & previousAtDateLine,
@@ -279,100 +269,123 @@ void GeoDataLineStringPrivate::optimize (GeoDataLineString& lineString) const
bool GeoDataLineString::isEmpty() const
{
- return p()->m_vector.isEmpty();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.isEmpty();
}
int GeoDataLineString::size() const
{
- return p()->m_vector.size();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.size();
}
GeoDataCoordinates& GeoDataLineString::at( int pos )
{
GeoDataGeometry::detach();
- p()->m_dirtyRange = true;
- p()->m_dirtyBox = true;
- return p()->m_vector[ pos ];
+
+ Q_D(GeoDataLineString);
+ d->m_dirtyRange = true;
+ d->m_dirtyBox = true;
+ return d->m_vector[pos];
}
const GeoDataCoordinates& GeoDataLineString::at( int pos ) const
{
- return p()->m_vector.at( pos );
+ Q_D(const GeoDataLineString);
+ return d->m_vector.at(pos);
}
GeoDataCoordinates& GeoDataLineString::operator[]( int pos )
{
GeoDataGeometry::detach();
- p()->m_dirtyRange = true;
- p()->m_dirtyBox = true;
- return p()->m_vector[ pos ];
+
+ Q_D(GeoDataLineString);
+ d->m_dirtyRange = true;
+ d->m_dirtyBox = true;
+ return d->m_vector[pos];
}
const GeoDataCoordinates& GeoDataLineString::operator[]( int pos ) const
{
- return static_cast<GeoDataLineStringPrivate*>(d)->m_vector[ pos ];
+ Q_D(const GeoDataLineString);
+ return d->m_vector[pos];
}
GeoDataCoordinates& GeoDataLineString::last()
{
GeoDataGeometry::detach();
- p()->m_dirtyRange = true;
- p()->m_dirtyBox = true;
- return p()->m_vector.last();
+
+ Q_D(GeoDataLineString);
+ d->m_dirtyRange = true;
+ d->m_dirtyBox = true;
+ return d->m_vector.last();
}
GeoDataCoordinates& GeoDataLineString::first()
{
GeoDataGeometry::detach();
- return p()->m_vector.first();
+
+ Q_D(GeoDataLineString);
+ return d->m_vector.first();
}
const GeoDataCoordinates& GeoDataLineString::last() const
{
- return p()->m_vector.last();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.last();
}
const GeoDataCoordinates& GeoDataLineString::first() const
{
- return p()->m_vector.first();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.first();
}
QVector<GeoDataCoordinates>::Iterator GeoDataLineString::begin()
{
GeoDataGeometry::detach();
- return p()->m_vector.begin();
+
+ Q_D(GeoDataLineString);
+ return d->m_vector.begin();
}
QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::begin() const
{
- return p()->m_vector.constBegin();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.constBegin();
}
QVector<GeoDataCoordinates>::Iterator GeoDataLineString::end()
{
GeoDataGeometry::detach();
- return p()->m_vector.end();
+
+ Q_D(GeoDataLineString);
+ return d->m_vector.end();
}
QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::end() const
{
- return p()->m_vector.constEnd();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.constEnd();
}
QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::constBegin() const
{
- return p()->m_vector.constBegin();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.constBegin();
}
QVector<GeoDataCoordinates>::ConstIterator GeoDataLineString::constEnd() const
{
- return p()->m_vector.constEnd();
+ Q_D(const GeoDataLineString);
+ return d->m_vector.constEnd();
}
void GeoDataLineString::insert( int index, const GeoDataCoordinates& value )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -383,7 +396,8 @@ void GeoDataLineString::insert( int index, const GeoDataCoordinates& value )
void GeoDataLineString::append ( const GeoDataCoordinates& value )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -394,7 +408,8 @@ void GeoDataLineString::append ( const GeoDataCoordinates& value )
void GeoDataLineString::append(const QVector<GeoDataCoordinates>& values)
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -413,7 +428,8 @@ void GeoDataLineString::append(const QVector<GeoDataCoordinates>& values)
GeoDataLineString& GeoDataLineString::operator << ( const GeoDataCoordinates& value )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -425,7 +441,8 @@ GeoDataLineString& GeoDataLineString::operator << ( const GeoDataCoordinates& va
GeoDataLineString& GeoDataLineString::operator << ( const GeoDataLineString& value )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -450,8 +467,8 @@ bool GeoDataLineString::operator==( const GeoDataLineString &other ) const
return false;
}
- const GeoDataLineStringPrivate* d = p();
- const GeoDataLineStringPrivate* other_d = other.p();
+ Q_D(const GeoDataLineString);
+ const GeoDataLineStringPrivate* other_d = other.d_func();
QVector<GeoDataCoordinates>::const_iterator itCoords = d->m_vector.constBegin();
QVector<GeoDataCoordinates>::const_iterator otherItCoords = other_d->m_vector.constBegin();
@@ -476,7 +493,8 @@ bool GeoDataLineString::operator!=( const GeoDataLineString &other ) const
void GeoDataLineString::clear()
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -492,40 +510,48 @@ bool GeoDataLineString::isClosed() const
bool GeoDataLineString::tessellate() const
{
- return p()->m_tessellationFlags.testFlag(Tessellate);
+ Q_D(const GeoDataLineString);
+ return d->m_tessellationFlags.testFlag(Tessellate);
}
void GeoDataLineString::setTessellate( bool tessellate )
{
GeoDataGeometry::detach();
+
+ Q_D(GeoDataLineString);
// According to the KML reference the tesselation of line strings in Google Earth
// is generally done along great circles. However for subsequent points that share
// the same latitude the latitude circles are followed. Our Tesselate and RespectLatitude
// Flags provide this behaviour. For true polygons the latitude circles don't get considered.
if ( tessellate ) {
- p()->m_tessellationFlags |= Tessellate;
- p()->m_tessellationFlags |= RespectLatitudeCircle;
+ d->m_tessellationFlags |= Tessellate;
+ d->m_tessellationFlags |= RespectLatitudeCircle;
} else {
- p()->m_tessellationFlags ^= Tessellate;
- p()->m_tessellationFlags ^= RespectLatitudeCircle;
+ d->m_tessellationFlags ^= Tessellate;
+ d->m_tessellationFlags ^= RespectLatitudeCircle;
}
}
TessellationFlags GeoDataLineString::tessellationFlags() const
{
- return p()->m_tessellationFlags;
+ Q_D(const GeoDataLineString);
+ return d->m_tessellationFlags;
}
void GeoDataLineString::setTessellationFlags( TessellationFlags f )
{
- p()->m_tessellationFlags = f;
+ GeoDataGeometry::detach();
+
+ Q_D(GeoDataLineString);
+ d->m_tessellationFlags = f;
}
void GeoDataLineString::reverse()
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -535,6 +561,8 @@ void GeoDataLineString::reverse()
GeoDataLineString GeoDataLineString::toNormalized() const
{
+ Q_D(const GeoDataLineString);
+
GeoDataLineString normalizedLineString;
normalizedLineString.setTessellationFlags( tessellationFlags() );
@@ -544,9 +572,9 @@ GeoDataLineString GeoDataLineString::toNormalized() const
// FIXME: Think about how we can avoid unnecessary copies
// if the linestring stays the same.
- QVector<GeoDataCoordinates>::const_iterator end = p()->m_vector.constEnd();
+ QVector<GeoDataCoordinates>::const_iterator end = d->m_vector.constEnd();
for( QVector<GeoDataCoordinates>::const_iterator itCoords
- = p()->m_vector.constBegin();
+ = d->m_vector.constBegin();
itCoords != end;
++itCoords ) {
@@ -564,39 +592,45 @@ GeoDataLineString GeoDataLineString::toNormalized() const
GeoDataLineString GeoDataLineString::toRangeCorrected() const
{
- if ( p()->m_dirtyRange ) {
+ Q_D(const GeoDataLineString);
+
+ if (d->m_dirtyRange) {
- delete p()->m_rangeCorrected;
+ delete d->m_rangeCorrected;
if( isClosed() ) {
- p()->m_rangeCorrected = new GeoDataLinearRing( toPoleCorrected() );
+ d->m_rangeCorrected = new GeoDataLinearRing(toPoleCorrected());
} else {
- p()->m_rangeCorrected = new GeoDataLineString( toPoleCorrected() );
+ d->m_rangeCorrected = new GeoDataLineString(toPoleCorrected());
}
- p()->m_dirtyRange = false;
+ d->m_dirtyRange = false;
}
- return *p()->m_rangeCorrected;
+ return *d->m_rangeCorrected;
}
QVector<GeoDataLineString*> GeoDataLineString::toDateLineCorrected() const
{
+ Q_D(const GeoDataLineString);
+
QVector<GeoDataLineString*> lineStrings;
- p()->toDateLineCorrected( *this, lineStrings );
+ d->toDateLineCorrected(*this, lineStrings);
return lineStrings;
}
GeoDataLineString GeoDataLineString::toPoleCorrected() const
{
+ Q_D(const GeoDataLineString);
+
if( isClosed() ) {
GeoDataLinearRing poleCorrected;
- p()->toPoleCorrected( *this, poleCorrected );
+ d->toPoleCorrected(*this, poleCorrected);
return poleCorrected;
} else {
GeoDataLineString poleCorrected;
- p()->toPoleCorrected( *this, poleCorrected );
+ d->toPoleCorrected(*this, poleCorrected);
return poleCorrected;
}
}
@@ -768,16 +802,18 @@ void GeoDataLineStringPrivate::toDateLineCorrected(
const GeoDataLatLonAltBox& GeoDataLineString::latLonAltBox() const
{
+ Q_D(const GeoDataLineString);
+
// GeoDataLatLonAltBox::fromLineString is very expensive
// that's why we recreate it only if the m_dirtyBox
// is TRUE.
// DO NOT REMOVE THIS CONSTRUCT OR MARBLE WILL BE SLOW.
- if ( p()->m_dirtyBox ) {
- p()->m_latLonAltBox = GeoDataLatLonAltBox::fromLineString( *this );
+ if (d->m_dirtyBox) {
+ d->m_latLonAltBox = GeoDataLatLonAltBox::fromLineString(*this);
+ d->m_dirtyBox = false;
}
- p()->m_dirtyBox = false;
- return p()->m_latLonAltBox;
+ return d->m_latLonAltBox;
}
qreal GeoDataLineString::length( qreal planetRadius, int offset ) const
@@ -786,10 +822,11 @@ qreal GeoDataLineString::length( qreal planetRadius, int offset ) const
return 0;
}
+ Q_D(const GeoDataLineString);
qreal length = 0.0;
- QVector<GeoDataCoordinates> const & vector = p()->m_vector;
+ QVector<GeoDataCoordinates> const & vector = d->m_vector;
int const start = qMax(offset+1, 1);
- int const end = p()->m_vector.size();
+ int const end = d->m_vector.size();
for( int i=start; i<end; ++i )
{
length += distanceSphere( vector[i-1], vector[i] );
@@ -801,7 +838,8 @@ qreal GeoDataLineString::length( qreal planetRadius, int offset ) const
QVector<GeoDataCoordinates>::Iterator GeoDataLineString::erase ( QVector<GeoDataCoordinates>::Iterator pos )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -813,7 +851,8 @@ QVector<GeoDataCoordinates>::Iterator GeoDataLineString::erase ( QVector<GeoData
QVector<GeoDataCoordinates>::Iterator end )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
delete d->m_rangeCorrected;
d->m_rangeCorrected = 0;
d->m_dirtyRange = true;
@@ -824,7 +863,8 @@ QVector<GeoDataCoordinates>::Iterator GeoDataLineString::erase ( QVector<GeoData
void GeoDataLineString::remove ( int i )
{
GeoDataGeometry::detach();
- GeoDataLineStringPrivate* d = p();
+
+ Q_D(GeoDataLineString);
d->m_dirtyRange = true;
d->m_dirtyBox = true;
d->m_vector.remove( i );
@@ -832,29 +872,33 @@ void GeoDataLineString::remove ( int i )
GeoDataLineString GeoDataLineString::optimized () const
{
+ Q_D(const GeoDataLineString);
+
if( isClosed() ) {
GeoDataLinearRing linearRing(*this);
- p()->optimize(linearRing);
+ d->optimize(linearRing);
return linearRing;
} else {
GeoDataLineString lineString(*this);
- p()->optimize(lineString);
+ d->optimize(lineString);
return lineString;
}
}
void GeoDataLineString::pack( QDataStream& stream ) const
{
+ Q_D(const GeoDataLineString);
+
GeoDataGeometry::pack( stream );
stream << size();
- stream << (qint32)(p()->m_tessellationFlags);
+ stream << (qint32)(d->m_tessellationFlags);
for( QVector<GeoDataCoordinates>::const_iterator iterator
- = p()->m_vector.constBegin();
- iterator != p()->m_vector.constEnd();
+ = d->m_vector.constBegin();
+ iterator != d->m_vector.constEnd();
++iterator ) {
- mDebug() << "innerRing: size" << p()->m_vector.size();
+ mDebug() << "innerRing: size" << d->m_vector.size();
GeoDataCoordinates coord = ( *iterator );
coord.pack( stream );
}
@@ -864,6 +908,9 @@ void GeoDataLineString::pack( QDataStream& stream ) const
void GeoDataLineString::unpack( QDataStream& stream )
{
GeoDataGeometry::detach();
+
+ Q_D(GeoDataLineString);
+
GeoDataGeometry::unpack( stream );
qint32 size;
qint32 tessellationFlags;
@@ -871,14 +918,14 @@ void GeoDataLineString::unpack( QDataStream& stream )
stream >> size;
stream >> tessellationFlags;
- p()->m_tessellationFlags = (TessellationFlags)(tessellationFlags);
+ d->m_tessellationFlags = (TessellationFlags)(tessellationFlags);
- p()->m_vector.reserve(p()->m_vector.size() + size);
+ d->m_vector.reserve(d->m_vector.size() + size);
for(qint32 i = 0; i < size; i++ ) {
GeoDataCoordinates coord;
coord.unpack( stream );
- p()->m_vector.append( coord );
+ d->m_vector.append( coord );
}
}
diff --git a/src/lib/marble/geodata/data/GeoDataLineString.h b/src/lib/marble/geodata/data/GeoDataLineString.h
index fb94cbe..133b1ff 100644
--- a/src/lib/marble/geodata/data/GeoDataLineString.h
+++ b/src/lib/marble/geodata/data/GeoDataLineString.h
@@ -385,8 +385,7 @@ class GEODATA_EXPORT GeoDataLineString : public GeoDataGeometry
explicit GeoDataLineString(GeoDataLineStringPrivate* priv);
private:
- inline GeoDataLineStringPrivate *p();
- inline const GeoDataLineStringPrivate *p() const;
+ Q_DECLARE_PRIVATE(GeoDataLineString)
};
}
diff --git a/src/lib/marble/geodata/data/GeoDataModel.cpp b/src/lib/marble/geodata/data/GeoDataModel.cpp
index 7c3d89b..0a2c1fe 100644
--- a/src/lib/marble/geodata/data/GeoDataModel.cpp
+++ b/src/lib/marble/geodata/data/GeoDataModel.cpp
@@ -78,15 +78,18 @@ GeoDataModel &GeoDataModel::operator=( const GeoDataModel &other )
bool GeoDataModel::operator==( const GeoDataModel &other ) const
{
+ Q_D(const GeoDataModel);
+ const GeoDataModelPrivate *other_d = other.d_func();
+
return equals(other) &&
- p()->m_coordinates == other.p()->m_coordinates &&
- p()->m_scale == other.p()->m_scale &&
- p()->m_orientation == other.p()->m_orientation &&
- p()->m_location == other.p()->m_location &&
- p()->m_link == other.p()->m_link &&
- p()->m_map == other.p()->m_map &&
- p()->m_targetHref == other.p()->m_targetHref &&
- p()->m_sourceHref == other.p()->m_sourceHref;
+ d->m_coordinates == other_d->m_coordinates &&
+ d->m_scale == other_d->m_scale &&
+ d->m_orientation == other_d->m_orientation &&
+ d->m_location == other_d->m_location &&
+ d->m_link == other_d->m_link &&
+ d->m_map == other_d->m_map &&
+ d->m_targetHref == other_d->m_targetHref &&
+ d->m_sourceHref == other_d->m_sourceHref;
}
bool GeoDataModel::operator!=( const GeoDataModel &other ) const
@@ -100,133 +103,162 @@ GeoDataModel::~GeoDataModel()
const GeoDataCoordinates &GeoDataModel::coordinates() const
{
- return p()->m_coordinates;
+ Q_D(const GeoDataModel);
+ return d->m_coordinates;
}
GeoDataCoordinates &GeoDataModel::coordinates()
{
- return p()->m_coordinates;
+ detach();
+
+ Q_D(GeoDataModel);
+ return d->m_coordinates;
}
const GeoDataLocation &GeoDataModel::location() const
{
- return p()->m_location;
+ Q_D(const GeoDataModel);
+ return d->m_location;
}
GeoDataLocation &GeoDataModel::location()
{
- return p()->m_location;
+ detach();
+
+ Q_D(GeoDataModel);
+ return d->m_location;
}
void GeoDataModel::setCoordinates(const GeoDataCoordinates &coordinates)
{
detach();
- p()->m_coordinates = coordinates;
+ Q_D(GeoDataModel);
+ d->m_coordinates = coordinates;
}
void GeoDataModel::setLocation(const GeoDataLocation &location)
{
detach();
- p()->m_location = location;
+ Q_D(GeoDataModel);
+ d->m_location = location;
}
const GeoDataLink &GeoDataModel::link() const
{
- return p()->m_link;
+ Q_D(const GeoDataModel);
+ return d->m_link;
}
GeoDataLink &GeoDataModel::link()
{
- return p()->m_link;
+ detach();
+
+ Q_D(GeoDataModel);
+ return d->m_link;
}
void GeoDataModel::setLink( const GeoDataLink &link )
{
detach();
- p()->m_link = link;
+ Q_D(GeoDataModel);
+ d->m_link = link;
}
const GeoDataScale &GeoDataModel::scale() const
{
- return p()->m_scale;
+ Q_D(const GeoDataModel);
+ return d->m_scale;
}
GeoDataScale &GeoDataModel::scale()
{
- return p()->m_scale;
+ detach();
+
+ Q_D(GeoDataModel);
+ return d->m_scale;
}
void GeoDataModel::setScale(const GeoDataScale &scale)
{
detach();
- p()->m_scale=scale;
+ Q_D(GeoDataModel);
+ d->m_scale = scale;
}
const GeoDataOrientation &GeoDataModel::orientation() const
{
- return p()->m_orientation;
+ Q_D(const GeoDataModel);
+ return d->m_orientation;
}
GeoDataOrientation &GeoDataModel::orientation()
{
- return p()->m_orientation;
+ detach();
+
+ Q_D(GeoDataModel);
+ return d->m_orientation;
}
void GeoDataModel::setOrientation(const GeoDataOrientation &orientation)
{
detach();
- p()->m_orientation=orientation;
+ Q_D(GeoDataModel);
+ d->m_orientation = orientation;
}
const GeoDataResourceMap &GeoDataModel::resourceMap() const
{
- return p()->m_map;
+ Q_D(const GeoDataModel);
+ return d->m_map;
}
GeoDataResourceMap &GeoDataModel::resourceMap()
{
- return p()->m_map;
+ detach();
+
+ Q_D(GeoDataModel);
+ return d->m_map;
}
void GeoDataModel::setResourceMap(const GeoDataResourceMap &map)
{
detach();
- p()->m_map=map;
+ Q_D(GeoDataModel);
+ d->m_map = map;
}
QString GeoDataModel::targetHref() const
{
- return p()->m_map.targetHref();
+ Q_D(const GeoDataModel);
+ return d->m_map.targetHref();
}
void GeoDataModel::setTargetHref(const QString &targetHref)
{
detach();
- p()->m_map.setTargetHref( targetHref );
+ Q_D(GeoDataModel);
+ d->m_map.setTargetHref( targetHref );
}
QString GeoDataModel::sourceHref() const
{
- return p()->m_map.sourceHref();
+ Q_D(const GeoDataModel);
+ return d->m_map.sourceHref();
}
void GeoDataModel::setSourceHref(const QString &sourceHref)
{
detach();
- p()->m_map.setSourceHref( sourceHref );
-}
-
-GeoDataModelPrivate *GeoDataModel::p() const
-{
- return static_cast<GeoDataModelPrivate *>( d );
+ Q_D(GeoDataModel);
+ d->m_map.setSourceHref( sourceHref );
}
}
diff --git a/src/lib/marble/geodata/data/GeoDataModel.h b/src/lib/marble/geodata/data/GeoDataModel.h
index a8369e7..d6d1826 100644
--- a/src/lib/marble/geodata/data/GeoDataModel.h
+++ b/src/lib/marble/geodata/data/GeoDataModel.h
@@ -70,7 +70,7 @@ public:
void setTargetHref(const QString &targetHref);
private:
- GeoDataModelPrivate *p() const;
+ Q_DECLARE_PRIVATE(GeoDataModel)
};
}
diff --git a/src/lib/marble/geodata/data/GeoDataMultiGeometry.cpp b/src/lib/marble/geodata/data/GeoDataMultiGeometry.cpp
index 8dcdfcf..d4b15c1 100644
--- a/src/lib/marble/geodata/data/GeoDataMultiGeometry.cpp
+++ b/src/lib/marble/geodata/data/GeoDataMultiGeometry.cpp
@@ -39,46 +39,40 @@ GeoDataMultiGeometry::~GeoDataMultiGeometry()
{
}
-GeoDataMultiGeometryPrivate* GeoDataMultiGeometry::p()
-{
- return static_cast<GeoDataMultiGeometryPrivate*>(d);
-}
-
-const GeoDataMultiGeometryPrivate* GeoDataMultiGeometry::p() const
-{
- return static_cast<GeoDataMultiGeometryPrivate*>(d);
-}
-
const GeoDataLatLonAltBox& GeoDataMultiGeometry::latLonAltBox() const
{
- QVector<GeoDataGeometry*>::const_iterator it = p()->m_vector.constBegin();
- QVector<GeoDataGeometry*>::const_iterator end = p()->m_vector.constEnd();
+ Q_D(const GeoDataMultiGeometry);
- p()->m_latLonAltBox.clear();
+ QVector<GeoDataGeometry*>::const_iterator it = d->m_vector.constBegin();
+ QVector<GeoDataGeometry*>::const_iterator end = d->m_vector.constEnd();
+
+ d->m_latLonAltBox.clear();
for (; it != end; ++it) {
if ( !(*it)->latLonAltBox().isEmpty() ) {
- if ( p()->m_latLonAltBox.isEmpty() ) {
- p()->m_latLonAltBox = (*it)->latLonAltBox();
+ if ( d->m_latLonAltBox.isEmpty() ) {
+ d->m_latLonAltBox = (*it)->latLonAltBox();
}
else {
- p()->m_latLonAltBox |= (*it)->latLonAltBox();
+ d->m_latLonAltBox |= (*it)->latLonAltBox();
}
}
}
- return p()->m_latLonAltBox;
+ return d->m_latLonAltBox;
}
int GeoDataMultiGeometry::size() const
{
- return p()->m_vector.size();
+ Q_D(const GeoDataMultiGeometry);
+ return d->m_vector.size();
}
QVector<GeoDataGeometry> GeoDataMultiGeometry::vector() const
{
+ Q_D(const GeoDataMultiGeometry);
QVector<GeoDataGeometry> results;
- QVector<GeoDataGeometry*>::const_iterator it = p()->m_vector.constBegin();
- QVector<GeoDataGeometry*>::const_iterator end = p()->m_vector.constEnd();
+ QVector<GeoDataGeometry*>::const_iterator it = d->m_vector.constBegin();
+ QVector<GeoDataGeometry*>::const_iterator end = d->m_vector.constEnd();
for (; it != end; ++it) {
GeoDataGeometry f = **it;
@@ -92,67 +86,85 @@ GeoDataGeometry& GeoDataMultiGeometry::at( int pos )
{
mDebug() << "detaching!";
detach();
- return *(p()->m_vector[ pos ]);
+
+ Q_D(GeoDataMultiGeometry);
+ return *(d->m_vector[pos]);
}
const GeoDataGeometry& GeoDataMultiGeometry::at( int pos ) const
{
- return *(p()->m_vector.at( pos ));
+ Q_D(const GeoDataMultiGeometry);
+ return *(d->m_vector.at(pos));
}
GeoDataGeometry& GeoDataMultiGeometry::operator[]( int pos )
{
detach();
- return *(p()->m_vector[ pos ]);
+
+ Q_D(GeoDataMultiGeometry);
+ return *(d->m_vector[pos]);
}
const GeoDataGeometry& GeoDataMultiGeometry::operator[]( int pos ) const
{
- return *(p()->m_vector[ pos ]);
+ Q_D(const GeoDataMultiGeometry);
+ return *(d->m_vector[pos]);
}
GeoDataGeometry& GeoDataMultiGeometry::last()
{
detach();
- return *(p()->m_vector.last());
+
+ Q_D(GeoDataMultiGeometry);
+ return *(d->m_vector.last());
}
GeoDataGeometry& GeoDataMultiGeometry::first()
{
detach();
- return *(p()->m_vector.first());
+
+ Q_D(GeoDataMultiGeometry);
+ return *(d->m_vector.first());
}
const GeoDataGeometry& GeoDataMultiGeometry::last() const
{
- return *(p()->m_vector.last());
+ Q_D(const GeoDataMultiGeometry);
+ return *(d->m_vector.last());
}
const GeoDataGeometry& GeoDataMultiGeometry::first() const
{
- return *(p()->m_vector.first());
+ Q_D(const GeoDataMultiGeometry);
+ return *(d->m_vector.first());
}
QVector<GeoDataGeometry*>::Iterator GeoDataMultiGeometry::begin()
{
detach();
- return p()->m_vector.begin();
+
+ Q_D(GeoDataMultiGeometry);
+ return d->m_vector.begin();
}
QVector<GeoDataGeometry*>::Iterator GeoDataMultiGeometry::end()
{
detach();
- return p()->m_vector.end();
+
+ Q_D(GeoDataMultiGeometry);
+ return d->m_vector.end();
}
QVector<GeoDataGeometry*>::ConstIterator GeoDataMultiGeometry::constBegin() const
{
- return p()->m_vector.constBegin();
+ Q_D(const GeoDataMultiGeometry);
+ return d->m_vector.constBegin();
}
QVector<GeoDataGeometry*>::ConstIterator GeoDataMultiGeometry::constEnd() const
{
- return p()->m_vector.constEnd();
+ Q_D(const GeoDataMultiGeometry);
+ return d->m_vector.constEnd();
}
/**
@@ -161,12 +173,15 @@ QVector<GeoDataGeometry*>::ConstIterator GeoDataMultiGeometry::constEnd() const
GeoDataGeometry* GeoDataMultiGeometry::child( int i )
{
detach();
- return p()->m_vector.at( i );
+
+ Q_D(GeoDataMultiGeometry);
+ return d->m_vector.at(i);
}
const GeoDataGeometry* GeoDataMultiGeometry::child( int i ) const
{
- return p()->m_vector.at( i );
+ Q_D(const GeoDataMultiGeometry);
+ return d->m_vector.at(i);
}
/**
@@ -174,10 +189,9 @@ const GeoDataGeometry* GeoDataMultiGeometry::child( int i ) const
*/
int GeoDataMultiGeometry::childPosition( const GeoDataGeometry *object ) const
{
- for ( int i=0; i< p()->m_vector.size(); i++ )
- {
- if ( p()->m_vector.at( i ) == object )
- {
+ Q_D(const GeoDataMultiGeometry);
+ for (int i = 0; i < d->m_vector.size(); ++i) {
+ if (d->m_vector.at(i) == object) {
return i;
}
}
@@ -190,36 +204,44 @@ int GeoDataMultiGeometry::childPosition( const GeoDataGeometry *object ) const
void GeoDataMultiGeometry::append( GeoDataGeometry *other )
{
detach();
+
+ Q_D(GeoDataMultiGeometry);
other->setParent( this );
- p()->m_vector.append( other );
+ d->m_vector.append(other);
}
GeoDataMultiGeometry& GeoDataMultiGeometry::operator << ( const GeoDataGeometry& value )
{
detach();
+
+ Q_D(GeoDataMultiGeometry);
GeoDataGeometry *g = new GeoDataGeometry( value );
g->setParent( this );
- p()->m_vector.append( g );
+ d->m_vector.append(g);
return *this;
}
void GeoDataMultiGeometry::clear()
{
detach();
- qDeleteAll(p()->m_vector);
- p()->m_vector.clear();
+
+ Q_D(GeoDataMultiGeometry);
+ qDeleteAll(d->m_vector);
+ d->m_vector.clear();
}
void GeoDataMultiGeometry::pack( QDataStream& stream ) const
{
+ Q_D(const GeoDataMultiGeometry);
+
GeoDataGeometry::pack( stream );
- stream << p()->m_vector.size();
-
+ stream << d->m_vector.size();
+
for( QVector<GeoDataGeometry*>::const_iterator iterator
- = p()->m_vector.constBegin();
- iterator != p()->m_vector.constEnd();
+ = d->m_vector.constBegin();
+ iterator != d->m_vector.constEnd();
++iterator ) {
const GeoDataGeometry *geometry = *iterator;
stream << geometry->geometryId();
@@ -230,6 +252,8 @@ void GeoDataMultiGeometry::pack( QDataStream& stream ) const
void GeoDataMultiGeometry::unpack( QDataStream& stream )
{
detach();
+
+ Q_D(GeoDataMultiGeometry);
GeoDataGeometry::unpack( stream );
int size = 0;
@@ -246,35 +270,35 @@ void GeoDataMultiGeometry::unpack( QDataStream& stream )
{
GeoDataPoint *point = new GeoDataPoint;
point->unpack( stream );
- p()->m_vector.append( point );
+ d->m_vector.append(point);
}
break;
case GeoDataLineStringId:
{
GeoDataLineString *lineString = new GeoDataLineString;
lineString->unpack( stream );
- p()->m_vector.append( lineString );
+ d->m_vector.append(lineString);
}
break;
case GeoDataLinearRingId:
{
GeoDataLinearRing *linearRing = new GeoDataLinearRing;
linearRing->unpack( stream );
- p()->m_vector.append( linearRing );
+ d->m_vector.append(linearRing);
}
break;
case GeoDataPolygonId:
{
GeoDataPolygon *polygon = new GeoDataPolygon;
polygon->unpack( stream );
- p()->m_vector.append( polygon );
+ d->m_vector.append(polygon);
}
break;
case GeoDataMultiGeometryId:
{
GeoDataMultiGeometry *multiGeometry = new GeoDataMultiGeometry;
multiGeometry->unpack( stream );
- p()->m_vector.append( multiGeometry );
+ d->m_vector.append(multiGeometry);
}
break;
case GeoDataModelId:
diff --git a/src/lib/marble/geodata/data/GeoDataMultiGeometry.h b/src/lib/marble/geodata/data/GeoDataMultiGeometry.h
index f9ccdcf..78268a1 100644
--- a/src/lib/marble/geodata/data/GeoDataMultiGeometry.h
+++ b/src/lib/marble/geodata/data/GeoDataMultiGeometry.h
@@ -88,9 +88,9 @@ class GEODATA_EXPORT GeoDataMultiGeometry : public GeoDataGeometry
virtual void pack( QDataStream& stream ) const;
// Unserialize the Placemark from @p stream
virtual void unpack( QDataStream& stream );
+
private:
- GeoDataMultiGeometryPrivate *p();
- const GeoDataMultiGeometryPrivate *p() const;
+ Q_DECLARE_PRIVATE(GeoDataMultiGeometry)
};
}
diff --git a/src/lib/marble/geodata/data/GeoDataMultiTrack.cpp b/src/lib/marble/geodata/data/GeoDataMultiTrack.cpp
index a0d04d4..4a04907 100644
--- a/src/lib/marble/geodata/data/GeoDataMultiTrack.cpp
+++ b/src/lib/marble/geodata/data/GeoDataMultiTrack.cpp
@@ -38,25 +38,17 @@ GeoDataMultiTrack::~GeoDataMultiTrack()
{
}
-GeoDataMultiTrackPrivate* GeoDataMultiTrack::p()
-{
- return static_cast<GeoDataMultiTrackPrivate*>(d);
-}
-
-const GeoDataMultiTrackPrivate* GeoDataMultiTrack::p() const
-{
- return static_cast<GeoDataMultiTrackPrivate*>(d);
-}
-
-
bool GeoDataMultiTrack::operator==( const GeoDataMultiTrack& other ) const
{
if ( !equals(other) ) return false;
- QVector<GeoDataTrack*>::const_iterator d_it = p()->m_vector.constBegin();
- QVector<GeoDataTrack*>::const_iterator d_end = p()->m_vector.constEnd();
- QVector<GeoDataTrack*>::const_iterator other_it = other.p()->m_vector.constBegin();
- QVector<GeoDataTrack*>::const_iterator other_end = other.p()->m_vector.constEnd();
+ Q_D(const GeoDataMultiTrack);
+ const GeoDataMultiTrackPrivate *other_d = other.d_func();
+
+ QVector<GeoDataTrack*>::const_iterator d_it = d->m_vector.constBegin();
+ QVector<GeoDataTrack*>::const_iterator d_end = d->m_vector.constEnd();
+ QVector<GeoDataTrack*>::const_iterator other_it = other_d->m_vector.constBegin();
+ QVector<GeoDataTrack*>::const_iterator other_end = other_d->m_vector.constEnd();
for (; d_it != d_end && other_it != other_end; ++d_it, ++other_it) {
@@ -73,35 +65,40 @@ bool GeoDataMultiTrack::operator!=( const GeoDataMultiTrack& other ) const
const GeoDataLatLonAltBox& GeoDataMultiTrack::latLonAltBox() const
{
- QVector<GeoDataTrack*>::const_iterator it = p()->m_vector.constBegin();
- QVector<GeoDataTrack*>::const_iterator end = p()->m_vector.constEnd();
+ Q_D(const GeoDataMultiTrack);
+
+ QVector<GeoDataTrack*>::const_iterator it = d->m_vector.constBegin();
+ QVector<GeoDataTrack*>::const_iterator end = d->m_vector.constEnd();
- p()->m_latLonAltBox.clear();
+ d->m_latLonAltBox.clear();
for (; it != end; ++it) {
if ( !(*it)->latLonAltBox().isEmpty() ) {
- if ( p()->m_latLonAltBox.isEmpty() ) {
- p()->m_latLonAltBox = (*it)->latLonAltBox();
+ if (d->m_latLonAltBox.isEmpty() ) {
+ d->m_latLonAltBox = (*it)->latLonAltBox();
}
else {
- p()->m_latLonAltBox |= (*it)->latLonAltBox();
+ d->m_latLonAltBox |= (*it)->latLonAltBox();
}
}
}
- return p()->m_latLonAltBox;
+ return d->m_latLonAltBox;
}
int GeoDataMultiTrack::size() const
{
- return p()->m_vector.size();
+ Q_D(const GeoDataMultiTrack);
+ return d->m_vector.size();
}
QVector<GeoDataTrack> GeoDataMultiTrack::vector() const
{
+ Q_D(const GeoDataMultiTrack);
+
QVector<GeoDataTrack> results;
- results.reserve(p()->m_vector.size());
+ results.reserve(d->m_vector.size());
- QVector<GeoDataTrack*>::const_iterator it = p()->m_vector.constBegin();
- QVector<GeoDataTrack*>::const_iterator end = p()->m_vector.constEnd();
+ QVector<GeoDataTrack*>::const_iterator it = d->m_vector.constBegin();
+ QVector<GeoDataTrack*>::const_iterator end = d->m_vector.constEnd();
for (; it != end; ++it) {
const GeoDataTrack f(**it);
@@ -115,67 +112,85 @@ GeoDataTrack& GeoDataMultiTrack::at( int pos )
{
mDebug() << "detaching!";
detach();
- return *(p()->m_vector[ pos ]);
+
+ Q_D(GeoDataMultiTrack);
+ return *(d->m_vector[pos]);
}
const GeoDataTrack& GeoDataMultiTrack::at( int pos ) const
{
- return *(p()->m_vector.at( pos ));
+ Q_D(const GeoDataMultiTrack);
+ return *(d->m_vector.at(pos));
}
GeoDataTrack& GeoDataMultiTrack::operator[]( int pos )
{
detach();
- return *(p()->m_vector[ pos ]);
+
+ Q_D(GeoDataMultiTrack);
+ return *(d->m_vector[pos]);
}
const GeoDataTrack& GeoDataMultiTrack::operator[]( int pos ) const
{
- return *(p()->m_vector[ pos ]);
+ Q_D(const GeoDataMultiTrack);
+ return *(d->m_vector[pos]);
}
GeoDataTrack& GeoDataMultiTrack::last()
{
detach();
- return *(p()->m_vector.last());
+
+ Q_D(GeoDataMultiTrack);
+ return *(d->m_vector.last());
}
GeoDataTrack& GeoDataMultiTrack::first()
{
detach();
- return *(p()->m_vector.first());
+
+ Q_D(GeoDataMultiTrack);
+ return *(d->m_vector.first());
}
const GeoDataTrack& GeoDataMultiTrack::last() const
{
- return *(p()->m_vector.last());
+ Q_D(const GeoDataMultiTrack);
+ return *(d->m_vector.last());
}
const GeoDataTrack& GeoDataMultiTrack::first() const
{
- return *(p()->m_vector.first());
+ Q_D(const GeoDataMultiTrack);
+ return *(d->m_vector.first());
}
QVector<GeoDataTrack*>::Iterator GeoDataMultiTrack::begin()
{
detach();
- return p()->m_vector.begin();
+
+ Q_D(GeoDataMultiTrack);
+ return d->m_vector.begin();
}
QVector<GeoDataTrack*>::Iterator GeoDataMultiTrack::end()
{
detach();
- return p()->m_vector.end();
+
+ Q_D(GeoDataMultiTrack);
+ return d->m_vector.end();
}
QVector<GeoDataTrack*>::ConstIterator GeoDataMultiTrack::constBegin() const
{
- return p()->m_vector.constBegin();
+ Q_D(const GeoDataMultiTrack);
+ return d->m_vector.constBegin();
}
QVector<GeoDataTrack*>::ConstIterator GeoDataMultiTrack::constEnd() const
{
- return p()->m_vector.constEnd();
+ Q_D(const GeoDataMultiTrack);
+ return d->m_vector.constEnd();
}
/**
@@ -184,12 +199,15 @@ QVector<GeoDataTrack*>::ConstIterator GeoDataMultiTrack::constEnd() const
GeoDataTrack* GeoDataMultiTrack::child( int i )
{
detach();
- return p()->m_vector.at( i );
+
+ Q_D(const GeoDataMultiTrack);
+ return d->m_vector.at(i);
}
const GeoDataTrack* GeoDataMultiTrack::child( int i ) const
{
- return p()->m_vector.at( i );
+ Q_D(const GeoDataMultiTrack);
+ return d->m_vector.at(i);
}
/**
@@ -197,10 +215,9 @@ const GeoDataTrack* GeoDataMultiTrack::child( int i ) const
*/
int GeoDataMultiTrack::childPosition( const GeoDataTrack *object ) const
{
- for ( int i=0; i< p()->m_vector.size(); i++ )
- {
- if ( p()->m_vector.at( i ) == object )
- {
+ Q_D(const GeoDataMultiTrack);
+ for (int i = 0; i < d->m_vector.size(); ++i) {
+ if (d->m_vector.at(i) == object) {
return i;
}
}
@@ -213,36 +230,44 @@ int GeoDataMultiTrack::childPosition( const GeoDataTrack *object ) const
void GeoDataMultiTrack::append( GeoDataTrack *other )
{
detach();
+
+ Q_D(GeoDataMultiTrack);
other->setParent( this );
- p()->m_vector.append( other );
+ d->m_vector.append(other);
}
GeoDataMultiTrack& GeoDataMultiTrack::operator << ( const GeoDataTrack& value )
{
detach();
+
+ Q_D(GeoDataMultiTrack);
GeoDataTrack *g = new GeoDataTrack( value );
g->setParent( this );
- p()->m_vector.append( g );
+ d->m_vector.append(g);
return *this;
}
void GeoDataMultiTrack::clear()
{
detach();
- qDeleteAll(p()->m_vector);
- p()->m_vector.clear();
+
+ Q_D(GeoDataMultiTrack);
+ qDeleteAll(d->m_vector);
+ d->m_vector.clear();
}
void GeoDataMultiTrack::pack( QDataStream& stream ) const
{
+ Q_D(const GeoDataMultiTrack);
+
GeoDataGeometry::pack( stream );
- stream << p()->m_vector.size();
+ stream << d->m_vector.size();
for( QVector<GeoDataTrack*>::const_iterator iterator
- = p()->m_vector.constBegin();
- iterator != p()->m_vector.constEnd();
+ = d->m_vector.constBegin();
+ iterator != d->m_vector.constEnd();
++iterator ) {
const GeoDataTrack *geometry = *iterator;
stream << geometry->geometryId();
@@ -253,6 +278,8 @@ void GeoDataMultiTrack::pack( QDataStream& stream ) const
void GeoDataMultiTrack::unpack( QDataStream& stream )
{
detach();
+
+ Q_D(GeoDataMultiTrack);
GeoDataGeometry::unpack( stream );
int size = 0;
@@ -269,7 +296,7 @@ void GeoDataMultiTrack::unpack( QDataStream& stream )
{
GeoDataTrack *track = new GeoDataTrack;
track->unpack( stream );
- p()->m_vector.append( track );
+ d->m_vector.append( track );
}
break;
case GeoDataModelId:
diff --git a/src/lib/marble/geodata/data/GeoDataMultiTrack.h b/src/lib/marble/geodata/data/GeoDataMultiTrack.h
index 91744fb..8ba8978 100644
--- a/src/lib/marble/geodata/data/GeoDataMultiTrack.h
+++ b/src/lib/marble/geodata/data/GeoDataMultiTrack.h
@@ -83,9 +83,9 @@ public:
virtual void pack( QDataStream& stream ) const;
// Unserialize the Placemark from @p stream
virtual void unpack( QDataStream& stream );
+
private:
- GeoDataMultiTrackPrivate *p();
- const GeoDataMultiTrackPrivate *p() const;
+ Q_DECLARE_PRIVATE(GeoDataMultiTrack)
};
}
diff --git a/src/lib/marble/geodata/data/GeoDataPoint.cpp b/src/lib/marble/geodata/data/GeoDataPoint.cpp
index 546e3f3..306adef 100644
--- a/src/lib/marble/geodata/data/GeoDataPoint.cpp
+++ b/src/lib/marble/geodata/data/GeoDataPoint.cpp
@@ -31,23 +31,27 @@ GeoDataPoint::GeoDataPoint( qreal lon, qreal lat, qreal alt,
GeoDataCoordinates::Unit unit )
: GeoDataGeometry( new GeoDataPointPrivate )
{
- p()->m_coordinates = GeoDataCoordinates( lon, lat, alt, unit );
- p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates );
+ Q_D(GeoDataPoint);
+ d->m_coordinates = GeoDataCoordinates(lon, lat, alt, unit);
+ d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
}
GeoDataPoint::GeoDataPoint( const GeoDataPoint& other )
: GeoDataGeometry( other )
-
{
- p()->m_coordinates = other.p()->m_coordinates;
- p()->m_latLonAltBox = other.p()->m_latLonAltBox;
+ Q_D(GeoDataPoint);
+ const GeoDataPointPrivate * const otherD = other.d_func();
+
+ d->m_coordinates = otherD->m_coordinates;
+ d->m_latLonAltBox = otherD->m_latLonAltBox;
}
GeoDataPoint::GeoDataPoint( const GeoDataCoordinates& other )
: GeoDataGeometry ( new GeoDataPointPrivate )
{
- p()->m_coordinates = other;
- p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates );
+ Q_D(GeoDataPoint);
+ d->m_coordinates = other;
+ d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
}
GeoDataPoint::GeoDataPoint()
@@ -75,23 +79,16 @@ bool GeoDataPoint::operator!=( const GeoDataPoint &other ) const
void GeoDataPoint::setCoordinates( const GeoDataCoordinates &coordinates )
{
detach();
- p()->m_coordinates = coordinates;
- p()->m_latLonAltBox = GeoDataLatLonAltBox( p()->m_coordinates );
-}
-
-const GeoDataCoordinates &GeoDataPoint::coordinates() const
-{
- return p()->m_coordinates;
-}
-GeoDataPointPrivate* GeoDataPoint::p()
-{
- return static_cast<GeoDataPointPrivate*>(GeoDataGeometry::d);
+ Q_D(GeoDataPoint);
+ d->m_coordinates = coordinates;
+ d->m_latLonAltBox = GeoDataLatLonAltBox(d->m_coordinates);
}
-const GeoDataPointPrivate* GeoDataPoint::p() const
+const GeoDataCoordinates &GeoDataPoint::coordinates() const
{
- return static_cast<GeoDataPointPrivate*>(GeoDataGeometry::d);
+ Q_D(const GeoDataPoint);
+ return d->m_coordinates;
}
const char* GeoDataPoint::nodeType() const
@@ -106,12 +103,16 @@ void GeoDataPoint::detach()
void GeoDataPoint::pack( QDataStream& stream ) const
{
- p()->m_coordinates.pack( stream );
+ Q_D(const GeoDataPoint);
+ d->m_coordinates.pack(stream);
+ // TODO: what about m_latLonAltBox and base class?
}
void GeoDataPoint::unpack( QDataStream& stream )
{
- p()->m_coordinates.unpack( stream );
+ Q_D(GeoDataPoint);
+ d->m_coordinates.unpack(stream);
+ // TODO: what about m_latLonAltBox and base class?
}
}
diff --git a/src/lib/marble/geodata/data/GeoDataPoint.h b/src/lib/marble/geodata/data/GeoDataPoint.h
index 884484e..8549b8a 100644
--- a/src/lib/marble/geodata/data/GeoDataPoint.h
+++ b/src/lib/marble/geodata/data/GeoDataPoint.h
@@ -89,9 +89,7 @@ class GEODATA_EXPORT GeoDataPoint : public GeoDataGeometry
virtual void detach();
private:
- GeoDataPointPrivate* p();
- const GeoDataPointPrivate* p() const;
-
+ Q_DECLARE_PRIVATE(GeoDataPoint)
};
}
diff --git a/src/lib/marble/geodata/data/GeoDataPolygon.cpp b/src/lib/marble/geodata/data/GeoDataPolygon.cpp
index 2f4f70e..c5a1fe2 100644
--- a/src/lib/marble/geodata/data/GeoDataPolygon.cpp
+++ b/src/lib/marble/geodata/data/GeoDataPolygon.cpp
@@ -40,20 +40,10 @@ GeoDataPolygon::~GeoDataPolygon()
#endif
}
-GeoDataPolygonPrivate* GeoDataPolygon::p()
-{
- return static_cast<GeoDataPolygonPrivate*>(d);
-}
-
-const GeoDataPolygonPrivate* GeoDataPolygon::p() const
-{
- return static_cast<GeoDataPolygonPrivate*>(d);
-}
-
bool GeoDataPolygon::operator==( const GeoDataPolygon &other ) const
{
- const GeoDataPolygonPrivate *d = p();
- const GeoDataPolygonPrivate *other_d = other.p();
+ Q_D(const GeoDataPolygon);
+ const GeoDataPolygonPrivate *other_d = other.d_func();
if ( !GeoDataGeometry::equals(other) ||
tessellate() != other.tessellate() ||
@@ -90,7 +80,8 @@ bool GeoDataPolygon::isClosed() const
bool GeoDataPolygon::tessellate() const
{
- return p()->m_tessellationFlags.testFlag(Tessellate);
+ Q_D(const GeoDataPolygon);
+ return d->m_tessellationFlags.testFlag(Tessellate);
}
void GeoDataPolygon::setTessellate( bool tessellate )
@@ -101,86 +92,108 @@ void GeoDataPolygon::setTessellate( bool tessellate )
// latitude circles are followed for subsequent points that share the same latitude.
detach();
+ Q_D(GeoDataPolygon);
if ( tessellate ) {
- p()->m_tessellationFlags |= Tessellate;
+ d->m_tessellationFlags |= Tessellate;
} else {
- p()->m_tessellationFlags ^= Tessellate;
+ d->m_tessellationFlags ^= Tessellate;
}
}
TessellationFlags GeoDataPolygon::tessellationFlags() const
{
- return p()->m_tessellationFlags;
+ Q_D(const GeoDataPolygon);
+ return d->m_tessellationFlags;
}
void GeoDataPolygon::setTessellationFlags( TessellationFlags f )
{
detach();
- p()->m_tessellationFlags = f;
+
+ Q_D(GeoDataPolygon);
+ d->m_tessellationFlags = f;
}
const GeoDataLatLonAltBox& GeoDataPolygon::latLonAltBox() const
{
- return p()->outer.latLonAltBox();
+ Q_D(const GeoDataPolygon);
+ return d->outer.latLonAltBox();
}
GeoDataLinearRing &GeoDataPolygon::outerBoundary()
{
detach();
- return (p()->outer);
+
+ Q_D(GeoDataPolygon);
+ return (d->outer);
}
const GeoDataLinearRing &GeoDataPolygon::outerBoundary() const
{
- return (p()->outer);
+ Q_D(const GeoDataPolygon);
+ return d->outer;
}
void GeoDataPolygon::setOuterBoundary( const GeoDataLinearRing& boundary )
{
detach();
- p()->outer = boundary;
+
+ Q_D(GeoDataPolygon);
+ d->outer = boundary;
}
QVector<GeoDataLinearRing>& GeoDataPolygon::innerBoundaries()
{
detach();
- return p()->inner;
+
+ Q_D(GeoDataPolygon);
+ return d->inner;
}
const QVector<GeoDataLinearRing>& GeoDataPolygon::innerBoundaries() const
{
- return p()->inner;
+ Q_D(const GeoDataPolygon);
+ return d->inner;
}
void GeoDataPolygon::appendInnerBoundary( const GeoDataLinearRing& boundary )
{
detach();
- p()->inner.append( boundary );
+
+ Q_D(GeoDataPolygon);
+ d->inner.append(boundary);
}
-void GeoDataPolygon::setRenderOrder(int renderOrder){
+void GeoDataPolygon::setRenderOrder(int renderOrder)
+{
detach();
- p()->m_renderOrder = renderOrder;
+
+ Q_D(GeoDataPolygon);
+ d->m_renderOrder = renderOrder;
}
-int GeoDataPolygon::renderOrder() const{
- return p()->m_renderOrder;
+int GeoDataPolygon::renderOrder() const
+{
+ Q_D(const GeoDataPolygon);
+ return d->m_renderOrder;
}
void GeoDataPolygon::pack( QDataStream& stream ) const
{
+ Q_D(const GeoDataPolygon);
+
GeoDataObject::pack( stream );
- p()->outer.pack( stream );
-
- stream << p()->inner.size();
- stream << (qint32)(p()->m_tessellationFlags);
+ d->outer.pack( stream );
+
+ stream << d->inner.size();
+ stream << (qint32)(d->m_tessellationFlags);
for( QVector<GeoDataLinearRing>::const_iterator iterator
- = p()->inner.constBegin();
- iterator != p()->inner.constEnd();
+ = d->inner.constBegin();
+ iterator != d->inner.constEnd();
++iterator ) {
- mDebug() << "innerRing: size" << p()->inner.size();
+ mDebug() << "innerRing: size" << d->inner.size();
GeoDataLinearRing linearRing = ( *iterator );
linearRing.pack( stream );
}
@@ -189,9 +202,12 @@ void GeoDataPolygon::pack( QDataStream& stream ) const
void GeoDataPolygon::unpack( QDataStream& stream )
{
detach();
+
+ Q_D(GeoDataPolygon);
+
GeoDataObject::unpack( stream );
- p()->outer.unpack( stream );
+ d->outer.unpack( stream );
qint32 size;
qint32 tessellationFlags;
@@ -199,9 +215,9 @@ void GeoDataPolygon::unpack( QDataStream& stream )
stream >> size;
stream >> tessellationFlags;
- p()->m_tessellationFlags = (TessellationFlags)(tessellationFlags);
+ d->m_tessellationFlags = (TessellationFlags)(tessellationFlags);
- QVector<GeoDataLinearRing> &inner = p()->inner;
+ QVector<GeoDataLinearRing> &inner = d->inner;
inner.reserve(inner.size() + size);
for(qint32 i = 0; i < size; i++ ) {
GeoDataLinearRing linearRing;
diff --git a/src/lib/marble/geodata/data/GeoDataPolygon.h b/src/lib/marble/geodata/data/GeoDataPolygon.h
index b84d2ab..f09e4f6 100644
--- a/src/lib/marble/geodata/data/GeoDataPolygon.h
+++ b/src/lib/marble/geodata/data/GeoDataPolygon.h
@@ -221,8 +221,7 @@ class GEODATA_EXPORT GeoDataPolygon : public GeoDataGeometry
void setRenderOrder(int);
private:
- GeoDataPolygonPrivate *p();
- const GeoDataPolygonPrivate *p() const;
+ Q_DECLARE_PRIVATE(GeoDataPolygon)
};
class GEODATA_EXPORT GeoDataOuterBoundary : public GeoDataPolygon
diff --git a/src/lib/marble/geodata/data/GeoDataTrack.cpp b/src/lib/marble/geodata/data/GeoDataTrack.cpp
index 77934b7..d762804 100644
--- a/src/lib/marble/geodata/data/GeoDataTrack.cpp
+++ b/src/lib/marble/geodata/data/GeoDataTrack.cpp
@@ -48,8 +48,8 @@ public:
}
}
- GeoDataLineString m_lineString;
- bool m_lineStringNeedsUpdate;
+ mutable GeoDataLineString m_lineString;
+ mutable bool m_lineStringNeedsUpdate;
bool m_interpolate;
@@ -81,11 +81,14 @@ GeoDataTrack &GeoDataTrack::operator=( const GeoDataTrack &other )
bool GeoDataTrack::operator==( const GeoDataTrack& other ) const
{
+ Q_D(const GeoDataTrack);
+ const GeoDataTrackPrivate * const otherD = other.d_func();
+
return equals(other) &&
- p()->m_when == other.p()->m_when &&
- p()->m_coordinates == other.p()->m_coordinates &&
- p()->m_extendedData == other.p()->m_extendedData &&
- p()->m_interpolate == other.p()->m_interpolate;
+ d->m_when == otherD->m_when &&
+ d->m_coordinates == otherD->m_coordinates &&
+ d->m_extendedData == otherD->m_extendedData &&
+ d->m_interpolate == otherD->m_interpolate;
}
bool GeoDataTrack::operator!=( const GeoDataTrack& other ) const
@@ -95,60 +98,71 @@ bool GeoDataTrack::operator!=( const GeoDataTrack& other ) const
int GeoDataTrack::size() const
{
- return p()->m_coordinates.size();
+ Q_D(const GeoDataTrack);
+ return d->m_coordinates.size();
}
bool GeoDataTrack::interpolate() const
{
- return p()->m_interpolate;
+ Q_D(const GeoDataTrack);
+ return d->m_interpolate;
}
void GeoDataTrack::setInterpolate(bool on)
{
detach();
- p()->m_interpolate = on;
+ Q_D(GeoDataTrack);
+ d->m_interpolate = on;
}
QDateTime GeoDataTrack::firstWhen() const
{
- if ( p()->m_when.isEmpty() ) {
+ Q_D(const GeoDataTrack);
+
+ if (d->m_when.isEmpty()) {
return QDateTime();
}
- return p()->m_when.first();
+ return d->m_when.first();
}
QDateTime GeoDataTrack::lastWhen() const
{
- if ( p()->m_when.isEmpty() ) {
+ Q_D(const GeoDataTrack);
+
+ if (d->m_when.isEmpty()) {
return QDateTime();
}
- return p()->m_when.last();
+ return d->m_when.last();
}
QVector<GeoDataCoordinates> GeoDataTrack::coordinatesList() const
{
- return p()->m_coordinates;
+ Q_D(const GeoDataTrack);
+ return d->m_coordinates;
}
QVector<QDateTime> GeoDataTrack::whenList() const
{
- return p()->m_when;
+ Q_D(const GeoDataTrack);
+ return d->m_when;
}
GeoDataCoordinates GeoDataTrack::coordinatesAt( const QDateTime &when ) const
{
- if ( p()->m_when.isEmpty() ) {
+ Q_D(const GeoDataTrack);
+
+ if (d->m_when.isEmpty()) {
return GeoDataCoordinates();
}
- if ( p()->m_when.contains( when ) ) {
+ if (d->m_when.contains(when)) {
//exact match found
- int index = p()->m_when.indexOf( when );
- if ( index < p()->m_coordinates.size() ) {
- return p()->m_coordinates.at( index );
+ const int index = d->m_when.indexOf(when);
+ if (index < d->m_coordinates.size()) {
+ return d->m_coordinates.at(index);
}
}
@@ -158,9 +172,9 @@ GeoDataCoordinates GeoDataTrack::coordinatesAt( const QDateTime &when ) const
typedef QMap<QDateTime, GeoDataCoordinates> PointMap;
PointMap pointMap;
- for ( int i = 0; i < qMin( p()->m_when.size(), p()->m_coordinates.size() ); ++i) {
- if ( p()->m_when.at( i ).isValid() ) {
- pointMap[ p()->m_when.at( i ) ] = p()->m_coordinates.at( i );
+ for (int i = 0; i < qMin(d->m_when.size(), d->m_coordinates.size()); ++i) {
+ if (d->m_when.at(i).isValid()) {
+ pointMap[d->m_when.at(i)] = d->m_coordinates.at(i);
}
}
@@ -199,76 +213,85 @@ GeoDataCoordinates GeoDataTrack::coordinatesAt( const QDateTime &when ) const
GeoDataCoordinates GeoDataTrack::coordinatesAt( int index ) const
{
- return p()->m_coordinates.at( index );
+ Q_D(const GeoDataTrack);
+ return d->m_coordinates.at(index);
}
void GeoDataTrack::addPoint( const QDateTime &when, const GeoDataCoordinates &coord )
{
detach();
- p()->equalizeWhenSize();
- p()->m_lineStringNeedsUpdate = true;
+ Q_D(GeoDataTrack);
+ d->equalizeWhenSize();
+ d->m_lineStringNeedsUpdate = true;
int i=0;
- while ( i < p()->m_when.size() ) {
- if ( p()->m_when.at( i ) > when ) {
+ while (i < d->m_when.size()) {
+ if (d->m_when.at(i) > when) {
break;
}
++i;
}
- p()->m_when.insert(i, when );
- p()->m_coordinates.insert(i, coord );
+ d->m_when.insert(i, when );
+ d->m_coordinates.insert(i, coord );
}
void GeoDataTrack::appendCoordinates( const GeoDataCoordinates &coord )
{
detach();
- p()->equalizeWhenSize();
- p()->m_lineStringNeedsUpdate = true;
- p()->m_coordinates.append( coord );
+ Q_D(GeoDataTrack);
+ d->equalizeWhenSize();
+ d->m_lineStringNeedsUpdate = true;
+ d->m_coordinates.append(coord);
}
void GeoDataTrack::appendAltitude( qreal altitude )
{
detach();
- p()->m_lineStringNeedsUpdate = true;
- Q_ASSERT( !p()->m_coordinates.isEmpty() );
- if ( p()->m_coordinates.isEmpty() ) return;
- GeoDataCoordinates coordinates = p()->m_coordinates.takeLast();
+ Q_D(GeoDataTrack);
+ d->m_lineStringNeedsUpdate = true;
+ Q_ASSERT(!d->m_coordinates.isEmpty());
+ if (d->m_coordinates.isEmpty()) {
+ return;
+ }
+ GeoDataCoordinates coordinates = d->m_coordinates.takeLast();
coordinates.setAltitude( altitude );
- p()->m_coordinates.append( coordinates );
+ d->m_coordinates.append(coordinates);
}
void GeoDataTrack::appendWhen( const QDateTime &when )
{
detach();
- p()->m_when.append( when );
+ Q_D(GeoDataTrack);
+ d->m_when.append(when);
}
void GeoDataTrack::clear()
{
detach();
- p()->m_when.clear();
- p()->m_coordinates.clear();
- p()->m_lineStringNeedsUpdate = true;
+ Q_D(GeoDataTrack);
+ d->m_when.clear();
+ d->m_coordinates.clear();
+ d->m_lineStringNeedsUpdate = true;
}
void GeoDataTrack::removeBefore( const QDateTime &when )
{
detach();
- Q_ASSERT( p()->m_coordinates.size() == p()->m_when.size() );
- if ( p()->m_when.isEmpty() ) {
+ Q_D(GeoDataTrack);
+ Q_ASSERT( d->m_coordinates.size() == d->m_when.size());
+ if (d->m_when.isEmpty()) {
return;
}
- p()->equalizeWhenSize();
+ d->equalizeWhenSize();
- while ( !p()->m_when.isEmpty() && p()->m_when.first() < when ) {
- p()->m_when.takeFirst();
- p()->m_coordinates.takeFirst();
+ while (!d->m_when.isEmpty() && d->m_when.first() < when) {
+ d->m_when.takeFirst();
+ d->m_coordinates.takeFirst();
}
}
@@ -276,38 +299,49 @@ void GeoDataTrack::removeAfter( const QDateTime &when )
{
detach();
- Q_ASSERT( p()->m_coordinates.size() == p()->m_when.size() );
- if ( p()->m_when.isEmpty() ) {
+ Q_D(GeoDataTrack);
+ Q_ASSERT(d->m_coordinates.size() == d->m_when.size());
+ if (d->m_when.isEmpty()) {
return;
}
- p()->equalizeWhenSize();
- while ( !p()->m_when.isEmpty() && p()->m_when.last() > when ) {
- p()->m_when.takeLast();
- p()->m_coordinates.takeLast();
-
+ d->equalizeWhenSize();
+ while (!d->m_when.isEmpty() && d->m_when.last() > when) {
+ d->m_when.takeLast();
+ d->m_coordinates.takeLast();
}
}
const GeoDataLineString *GeoDataTrack::lineString() const
{
- if ( p()->m_lineStringNeedsUpdate ) {
- p()->m_lineString = GeoDataLineString();
- p()->m_lineString.append( coordinatesList() );
- p()->m_lineStringNeedsUpdate = false;
+ Q_D(const GeoDataTrack);
+ if (d->m_lineStringNeedsUpdate) {
+ d->m_lineString = GeoDataLineString();
+ d->m_lineString.append( coordinatesList() );
+ d->m_lineStringNeedsUpdate = false;
}
- return &p()->m_lineString;
+ return &d->m_lineString;
}
-GeoDataExtendedData& GeoDataTrack::extendedData() const
+GeoDataExtendedData& GeoDataTrack::extendedData()
{
- return p()->m_extendedData;
+ detach();
+
+ Q_D(GeoDataTrack);
+ return d->m_extendedData;
+}
+
+const GeoDataExtendedData& GeoDataTrack::extendedData() const
+{
+ Q_D(const GeoDataTrack);
+ return d->m_extendedData;
}
void GeoDataTrack::setExtendedData( const GeoDataExtendedData& extendedData )
{
detach();
- p()->m_extendedData = extendedData;
+ Q_D(GeoDataTrack);
+ d->m_extendedData = extendedData;
}
const GeoDataLatLonAltBox& GeoDataTrack::latLonAltBox() const
@@ -326,9 +360,4 @@ void GeoDataTrack::unpack( QDataStream& stream )
GeoDataGeometry::unpack( stream );
}
-GeoDataTrackPrivate *GeoDataTrack::p() const
-{
- return static_cast<GeoDataTrackPrivate *>( d );
-}
-
}
diff --git a/src/lib/marble/geodata/data/GeoDataTrack.h b/src/lib/marble/geodata/data/GeoDataTrack.h
index a06bcf1..be0c43b 100644
--- a/src/lib/marble/geodata/data/GeoDataTrack.h
+++ b/src/lib/marble/geodata/data/GeoDataTrack.h
@@ -175,7 +175,8 @@ public:
/**
* Return the ExtendedData assigned to the feature.
*/
- GeoDataExtendedData& extendedData() const;
+ const GeoDataExtendedData& extendedData() const;
+ GeoDataExtendedData& extendedData();
/**
* Sets the ExtendedData of the feature.
@@ -188,7 +189,7 @@ public:
virtual void unpack( QDataStream& stream );
private:
- GeoDataTrackPrivate *p() const;
+ Q_DECLARE_PRIVATE(GeoDataTrack)
};
}