Skip to content
Permalink
Browse files

Add a bunch of missing geometry cache clears

  • Loading branch information
nyalldawson committed Feb 21, 2016
1 parent 50f01a2 commit 6116fdcdb4f9cb8a95ab6429944a977d52b3c9fc
@@ -32,8 +32,8 @@ class QgsCurvePolygonV2: public QgsSurfaceV2

//curve polygon interface
int numInteriorRings() const;
QgsCurveV2* exteriorRing() const;
QgsCurveV2* interiorRing( int i ) const;
const QgsCurveV2* exteriorRing() const;
const QgsCurveV2* interiorRing( int i ) const;
virtual QgsPolygonV2* toPolygon() const;

/** Sets the exterior ring of the polygon. The CurvePolygon type will be updated to match the dimensionality
@@ -62,6 +62,7 @@ void QgsCircularStringV2::clear()
mZ.clear();
mM.clear();
mWkbType = QgsWKBTypes::Unknown;
clearCache();
}

QgsRectangle QgsCircularStringV2::calculateBoundingBox() const
@@ -216,6 +217,7 @@ bool QgsCircularStringV2::fromWkb( QgsConstWkbPtr wkbPtr )
{
return false;
}
clearCache();
mWkbType = type;

//type
@@ -418,6 +420,8 @@ void QgsCircularStringV2::points( QList<QgsPointV2>& pts ) const

void QgsCircularStringV2::setPoints( const QList<QgsPointV2>& points )
{
clearCache();

if ( points.size() < 1 )
{
mWkbType = QgsWKBTypes::Unknown;
@@ -609,6 +613,8 @@ void QgsCircularStringV2::draw( QPainter& p ) const

void QgsCircularStringV2::transform( const QgsCoordinateTransform& ct, QgsCoordinateTransform::TransformDirection d )
{
clearCache();

double* zArray = mZ.data();

bool hasZ = is3D();
@@ -630,6 +636,8 @@ void QgsCircularStringV2::transform( const QgsCoordinateTransform& ct, QgsCoordi

void QgsCircularStringV2::transform( const QTransform& t )
{
clearCache();

int nPoints = numPoints();
for ( int i = 0; i < nPoints; ++i )
{
@@ -788,6 +796,7 @@ void QgsCircularStringV2::deleteVertex( int i )
{
mM.remove( i );
}
clearCache();
}

double QgsCircularStringV2::closestSegment( const QgsPointV2& pt, QgsPointV2& segmentPt, QgsVertexId& vertexAfter, bool* leftOf, double epsilon ) const
@@ -975,6 +984,7 @@ void QgsCircularStringV2::insertVertexBetween( int after, int before, int pointO
{
mM.insert( before, ( mM[after] + mM[before] ) / 2.0 );
}
clearCache();
}

double QgsCircularStringV2::vertexAngle( QgsVertexId vId ) const
@@ -1053,6 +1063,7 @@ bool QgsCircularStringV2::addZValue( double zValue )
if ( QgsWKBTypes::hasZ( mWkbType ) )
return false;

clearCache();
mWkbType = QgsWKBTypes::addZ( mWkbType );

int nPoints = numPoints();
@@ -1070,6 +1081,7 @@ bool QgsCircularStringV2::addMValue( double mValue )
if ( QgsWKBTypes::hasM( mWkbType ) )
return false;

clearCache();
mWkbType = QgsWKBTypes::addM( mWkbType );

int nPoints = numPoints();
@@ -1087,6 +1099,8 @@ bool QgsCircularStringV2::dropZValue()
if ( !QgsWKBTypes::hasZ( mWkbType ) )
return false;

clearCache();

mWkbType = QgsWKBTypes::dropZ( mWkbType );
mZ.clear();
return true;
@@ -1097,6 +1111,8 @@ bool QgsCircularStringV2::dropMValue()
if ( !QgsWKBTypes::hasM( mWkbType ) )
return false;

clearCache();

mWkbType = QgsWKBTypes::dropM( mWkbType );
mM.clear();
return true;
@@ -61,6 +61,7 @@ QgsCompoundCurveV2& QgsCompoundCurveV2::operator=( const QgsCompoundCurveV2 & cu
{
if ( &curve != this )
{
clearCache();
QgsCurveV2::operator=( curve );
Q_FOREACH ( const QgsCurveV2* c, curve.mCurves )
{
@@ -80,6 +81,7 @@ void QgsCompoundCurveV2::clear()
qDeleteAll( mCurves );
mCurves.clear();
mWkbType = QgsWKBTypes::Unknown;
clearCache();
}

QgsRectangle QgsCompoundCurveV2::calculateBoundingBox() const
@@ -388,6 +390,7 @@ void QgsCompoundCurveV2::addCurve( QgsCurveV2* c )
{
setZMTypeFromSubGeometry( c, QgsWKBTypes::CompoundCurve );
}
clearCache();
}
}

@@ -400,6 +403,7 @@ void QgsCompoundCurveV2::removeCurve( int i )

delete( mCurves.at( i ) );
mCurves.removeAt( i );
clearCache();
}

void QgsCompoundCurveV2::addVertex( const QgsPointV2& pt )
@@ -432,6 +436,7 @@ void QgsCompoundCurveV2::addVertex( const QgsPointV2& pt )
line = static_cast<QgsLineStringV2*>( lastCurve );
}
line->addVertex( pt );
clearCache();
}

void QgsCompoundCurveV2::draw( QPainter& p ) const
@@ -449,6 +454,7 @@ void QgsCompoundCurveV2::transform( const QgsCoordinateTransform& ct, QgsCoordin
{
curve->transform( ct, d );
}
clearCache();
}

void QgsCompoundCurveV2::transform( const QTransform& t )
@@ -457,6 +463,7 @@ void QgsCompoundCurveV2::transform( const QTransform& t )
{
curve->transform( t );
}
clearCache();
}

void QgsCompoundCurveV2::addToPainterPath( QPainterPath& path ) const
@@ -659,6 +666,7 @@ bool QgsCompoundCurveV2::addZValue( double zValue )
{
curve->addZValue( zValue );
}
clearCache();
return true;
}

@@ -673,6 +681,7 @@ bool QgsCompoundCurveV2::addMValue( double mValue )
{
curve->addMValue( mValue );
}
clearCache();
return true;
}

@@ -686,6 +695,7 @@ bool QgsCompoundCurveV2::dropZValue()
{
curve->dropZValue();
}
clearCache();
return true;
}

@@ -699,6 +709,7 @@ bool QgsCompoundCurveV2::dropMValue()
{
curve->dropMValue();
}
clearCache();
return true;
}

@@ -53,6 +53,7 @@ QgsCurvePolygonV2& QgsCurvePolygonV2::operator=( const QgsCurvePolygonV2 & p )
{
if ( &p != this )
{
clearCache();
QgsSurfaceV2::operator=( p );
if ( p.mExteriorRing )
{
@@ -79,6 +80,7 @@ void QgsCurvePolygonV2::clear()
qDeleteAll( mInteriorRings );
mInteriorRings.clear();
mWkbType = QgsWKBTypes::Unknown;
clearCache();
}


@@ -438,12 +440,12 @@ int QgsCurvePolygonV2::numInteriorRings() const
return mInteriorRings.size();
}

QgsCurveV2* QgsCurvePolygonV2::exteriorRing() const
const QgsCurveV2* QgsCurvePolygonV2::exteriorRing() const
{
return mExteriorRing;
}

QgsCurveV2* QgsCurvePolygonV2::interiorRing( int i ) const
const QgsCurveV2* QgsCurvePolygonV2::interiorRing( int i ) const
{
if ( i < 0 || i >= mInteriorRings.size() )
{
@@ -484,6 +486,7 @@ void QgsCurvePolygonV2::setExteriorRing( QgsCurveV2* ring )
else
ring->dropMValue();
}
clearCache();
}

void QgsCurvePolygonV2::setInteriorRings( const QList<QgsCurveV2*>& rings )
@@ -496,6 +499,7 @@ void QgsCurvePolygonV2::setInteriorRings( const QList<QgsCurveV2*>& rings )
{
addInteriorRing( ring );
}
clearCache();
}

void QgsCurvePolygonV2::addInteriorRing( QgsCurveV2* ring )
@@ -515,6 +519,7 @@ void QgsCurvePolygonV2::addInteriorRing( QgsCurveV2* ring )
ring->addMValue();

mInteriorRings.append( ring );
clearCache();
}

bool QgsCurvePolygonV2::removeInteriorRing( int nr )
@@ -524,6 +529,7 @@ bool QgsCurvePolygonV2::removeInteriorRing( int nr )
return false;
}
delete mInteriorRings.takeAt( nr );
clearCache();
return true;
}

@@ -561,6 +567,7 @@ void QgsCurvePolygonV2::transform( const QgsCoordinateTransform& ct, QgsCoordina
{
curve->transform( ct, d );
}
clearCache();
}

void QgsCurvePolygonV2::transform( const QTransform& t )
@@ -574,6 +581,7 @@ void QgsCurvePolygonV2::transform( const QTransform& t )
{
curve->transform( t );
}
clearCache();
}

void QgsCurvePolygonV2::coordinateSequence( QList< QList< QList< QgsPointV2 > > >& coord ) const
@@ -792,6 +800,7 @@ bool QgsCurvePolygonV2::addZValue( double zValue )
{
curve->addZValue( zValue );
}
clearCache();
return true;
}

@@ -808,6 +817,7 @@ bool QgsCurvePolygonV2::addMValue( double mValue )
{
curve->addMValue( mValue );
}
clearCache();
return true;
}

@@ -823,6 +833,7 @@ bool QgsCurvePolygonV2::dropZValue()
{
curve->dropZValue();
}
clearCache();
return true;
}

@@ -838,5 +849,6 @@ bool QgsCurvePolygonV2::dropMValue()
{
curve->dropMValue();
}
clearCache();
return true;
}
@@ -58,8 +58,8 @@ class CORE_EXPORT QgsCurvePolygonV2: public QgsSurfaceV2

//curve polygon interface
int numInteriorRings() const;
QgsCurveV2* exteriorRing() const;
QgsCurveV2* interiorRing( int i ) const;
const QgsCurveV2* exteriorRing() const;
const QgsCurveV2* interiorRing( int i ) const;
virtual QgsPolygonV2* toPolygon() const;

/** Sets the exterior ring of the polygon. The CurvePolygon type will be updated to match the dimensionality
@@ -113,7 +113,7 @@ class CORE_EXPORT QgsCurveV2: public QgsAbstractGeometryV2

protected:

virtual void clearCache() const override { mBoundingBox = QgsRectangle(); }
virtual void clearCache() const override { mBoundingBox = QgsRectangle(); QgsAbstractGeometryV2::clearCache(); }

private:

@@ -46,6 +46,7 @@ QgsGeometryCollectionV2& QgsGeometryCollectionV2::operator=( const QgsGeometryCo
{
if ( &c != this )
{
clearCache();
QgsAbstractGeometryV2::operator=( c );
int nGeoms = c.mGeometries.size();
mGeometries.resize( nGeoms );
@@ -87,6 +88,7 @@ const QgsAbstractGeometryV2* QgsGeometryCollectionV2::geometryN( int n ) const

QgsAbstractGeometryV2* QgsGeometryCollectionV2::geometryN( int n )
{
clearCache();
return mGeometries.value( n );
}

@@ -590,6 +592,7 @@ bool QgsGeometryCollectionV2::addZValue( double zValue )
{
geom->addZValue( zValue );
}
clearCache();
return true;
}

@@ -604,6 +607,7 @@ bool QgsGeometryCollectionV2::addMValue( double mValue )
{
geom->addMValue( mValue );
}
clearCache();
return true;
}

@@ -618,6 +622,7 @@ bool QgsGeometryCollectionV2::dropZValue()
{
geom->dropZValue();
}
clearCache();
return true;
}

@@ -631,5 +636,6 @@ bool QgsGeometryCollectionV2::dropMValue()
{
geom->dropMValue();
}
clearCache();
return true;
}
@@ -139,7 +139,7 @@ class CORE_EXPORT QgsGeometryCollectionV2: public QgsAbstractGeometryV2
bool fromCollectionWkt( const QString &wkt, const QList<QgsAbstractGeometryV2*>& subtypes, const QString& defaultChildWkbType = QString() );

virtual QgsRectangle calculateBoundingBox() const override;
virtual void clearCache() const override { mBoundingBox = QgsRectangle(); }
virtual void clearCache() const override { mBoundingBox = QgsRectangle(); QgsAbstractGeometryV2::clearCache(); }

private:

0 comments on commit 6116fdc

Please sign in to comment.
You can’t perform that action at this time.