File tree 2 files changed +25
-0
lines changed
2 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,28 @@ const QgsCoordinateTransform* QgsCoordinateTransformCache::transform( const QStr
57
57
}
58
58
}
59
59
60
+ void QgsCoordinateTransformCache::invalidateCrs ( const QString& crsAuthId )
61
+ {
62
+ // get keys to remove first
63
+ QHash< QPair< QString, QString >, QgsCoordinateTransform* >::iterator it = mTransforms .begin ();
64
+ QList< QPair< QString, QString > > updateList;
65
+
66
+ for ( ; it != mTransforms .end (); ++it )
67
+ {
68
+ if ( it.key ().first == crsAuthId || it.key ().second == crsAuthId )
69
+ {
70
+ updateList.append ( it.key () );
71
+ }
72
+ }
73
+
74
+ // and remove after
75
+ QList< QPair< QString, QString > >::const_iterator updateIt = updateList.constBegin ();
76
+ for ( ; updateIt != updateList.constEnd (); ++updateIt )
77
+ {
78
+ mTransforms .remove ( *updateIt );
79
+ }
80
+ }
81
+
60
82
QgsCRSCache* QgsCRSCache::mInstance = 0 ;
61
83
62
84
QgsCRSCache* QgsCRSCache::instance ()
@@ -84,6 +106,7 @@ void QgsCRSCache::updateCRSCache( const QString& authid )
84
106
{
85
107
mCRS .insert ( authid, s );
86
108
}
109
+ QgsCoordinateTransformCache::instance ()->invalidateCrs ( authid );
87
110
}
88
111
89
112
const QgsCoordinateReferenceSystem& QgsCRSCache::crsByAuthId ( const QString& authid )
Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ class CORE_EXPORT QgsCoordinateTransformCache
34
34
@param srcAuthId auth id string of source crs
35
35
@param destAuthId auth id string of dest crs*/
36
36
const QgsCoordinateTransform* transform ( const QString& srcAuthId, const QString& destAuthId );
37
+ /* *Removes transformations where a changed crs is involved from the cache*/
38
+ void invalidateCrs ( const QString& crsAuthId );
37
39
38
40
private:
39
41
static QgsCoordinateTransformCache* mInstance ;
You can’t perform that action at this time.
0 commit comments