Skip to content

Commit

Permalink
add an update CRS cache function, still not effective though
Browse files Browse the repository at this point in the history
  • Loading branch information
leyan authored and mhugent committed Jun 14, 2013
1 parent 2a81aba commit 1962c3c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/qgscustomprojectiondialog.cpp
Expand Up @@ -24,6 +24,7 @@
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsgenericprojectionselector.h"
#include "qgscrscache.h"

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

QgsCRSCache::instance()->updateCRSCache( QString( "USER:%1" ).arg( myId ) );

// If we have a projection acronym not in the user db previously, add it.
// This is a must, or else we can't select it from the vw_srs table.
// Actually, add it always and let the SQL PRIMARY KEY remove duplicates.
Expand Down
9 changes: 9 additions & 0 deletions src/core/qgscrscache.cpp
Expand Up @@ -77,6 +77,15 @@ QgsCRSCache::~QgsCRSCache()
delete mInstance;
}

void QgsCRSCache::updateCRSCache( const QString& authid )
{
QgsCoordinateReferenceSystem s;
if ( s.createFromOgcWmsCrs( authid ) )
{
mCRS.insert( authid, s );
}
}

const QgsCoordinateReferenceSystem& QgsCRSCache::crsByAuthId( const QString& authid )
{
QHash< QString, QgsCoordinateReferenceSystem >::const_iterator crsIt = mCRS.find( authid );
Expand Down
2 changes: 2 additions & 0 deletions src/core/qgscrscache.h
Expand Up @@ -49,6 +49,8 @@ class CORE_EXPORT QgsCRSCache
const QgsCoordinateReferenceSystem& crsByAuthId( const QString& authid );
const QgsCoordinateReferenceSystem& crsByEpsgId( long epsg );

void updateCRSCache( const QString &authid );

protected:
QgsCRSCache();

Expand Down

0 comments on commit 1962c3c

Please sign in to comment.