Skip to content

Commit 1962c3c

Browse files
leyanmhugent
authored andcommittedJun 14, 2013
add an update CRS cache function, still not effective though
1 parent 2a81aba commit 1962c3c

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed
 

‎src/app/qgscustomprojectiondialog.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
#include "qgsapplication.h"
2525
#include "qgslogger.h"
2626
#include "qgsgenericprojectionselector.h"
27+
#include "qgscrscache.h"
2728

2829
//qt includes
2930
#include <QFileInfo>
@@ -291,6 +292,8 @@ bool QgsCustomProjectionDialog::saveCRS( QgsCoordinateReferenceSystem myCRS, QSt
291292
existingCRSparameters[myId] = myCRS.toProj4();
292293
existingCRSnames[myId] = myName;
293294

295+
QgsCRSCache::instance()->updateCRSCache( QString( "USER:%1" ).arg( myId ) );
296+
294297
// If we have a projection acronym not in the user db previously, add it.
295298
// This is a must, or else we can't select it from the vw_srs table.
296299
// Actually, add it always and let the SQL PRIMARY KEY remove duplicates.

‎src/core/qgscrscache.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ QgsCRSCache::~QgsCRSCache()
7777
delete mInstance;
7878
}
7979

80+
void QgsCRSCache::updateCRSCache( const QString& authid )
81+
{
82+
QgsCoordinateReferenceSystem s;
83+
if ( s.createFromOgcWmsCrs( authid ) )
84+
{
85+
mCRS.insert( authid, s );
86+
}
87+
}
88+
8089
const QgsCoordinateReferenceSystem& QgsCRSCache::crsByAuthId( const QString& authid )
8190
{
8291
QHash< QString, QgsCoordinateReferenceSystem >::const_iterator crsIt = mCRS.find( authid );

‎src/core/qgscrscache.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class CORE_EXPORT QgsCRSCache
4949
const QgsCoordinateReferenceSystem& crsByAuthId( const QString& authid );
5050
const QgsCoordinateReferenceSystem& crsByEpsgId( long epsg );
5151

52+
void updateCRSCache( const QString &authid );
53+
5254
protected:
5355
QgsCRSCache();
5456

0 commit comments

Comments
 (0)
Please sign in to comment.