mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
Update also crs transform cache if a crs has been updated
This commit is contained in:
parent
1962c3c46c
commit
b8a2f0c1aa
@ -57,6 +57,28 @@ const QgsCoordinateTransform* QgsCoordinateTransformCache::transform( const QStr
|
||||
}
|
||||
}
|
||||
|
||||
void QgsCoordinateTransformCache::invalidateCrs( const QString& crsAuthId )
|
||||
{
|
||||
//get keys to remove first
|
||||
QHash< QPair< QString, QString >, QgsCoordinateTransform* >::iterator it = mTransforms.begin();
|
||||
QList< QPair< QString, QString > > updateList;
|
||||
|
||||
for ( ; it != mTransforms.end(); ++it )
|
||||
{
|
||||
if ( it.key().first == crsAuthId || it.key().second == crsAuthId )
|
||||
{
|
||||
updateList.append( it.key() );
|
||||
}
|
||||
}
|
||||
|
||||
//and remove after
|
||||
QList< QPair< QString, QString > >::const_iterator updateIt = updateList.constBegin();
|
||||
for ( ; updateIt != updateList.constEnd(); ++updateIt )
|
||||
{
|
||||
mTransforms.remove( *updateIt );
|
||||
}
|
||||
}
|
||||
|
||||
QgsCRSCache* QgsCRSCache::mInstance = 0;
|
||||
|
||||
QgsCRSCache* QgsCRSCache::instance()
|
||||
@ -84,6 +106,7 @@ void QgsCRSCache::updateCRSCache( const QString& authid )
|
||||
{
|
||||
mCRS.insert( authid, s );
|
||||
}
|
||||
QgsCoordinateTransformCache::instance()->invalidateCrs( authid );
|
||||
}
|
||||
|
||||
const QgsCoordinateReferenceSystem& QgsCRSCache::crsByAuthId( const QString& authid )
|
||||
|
@ -34,6 +34,8 @@ class CORE_EXPORT QgsCoordinateTransformCache
|
||||
@param srcAuthId auth id string of source crs
|
||||
@param destAuthId auth id string of dest crs*/
|
||||
const QgsCoordinateTransform* transform( const QString& srcAuthId, const QString& destAuthId );
|
||||
/**Removes transformations where a changed crs is involved from the cache*/
|
||||
void invalidateCrs( const QString& crsAuthId );
|
||||
|
||||
private:
|
||||
static QgsCoordinateTransformCache* mInstance;
|
||||
|
Loading…
x
Reference in New Issue
Block a user