Skip to content
Permalink
Browse files

add an update CRS cache function, still not effective though

  • Loading branch information
leyan authored and mhugent committed Jun 14, 2013
1 parent 2a81aba commit 1962c3c46c378a1040eb1786c74bf435d6f7e0c4
Showing with 14 additions and 0 deletions.
  1. +3 −0 src/app/qgscustomprojectiondialog.cpp
  2. +9 −0 src/core/qgscrscache.cpp
  3. +2 −0 src/core/qgscrscache.h
@@ -24,6 +24,7 @@
#include "qgsapplication.h"
#include "qgslogger.h"
#include "qgsgenericprojectionselector.h"
#include "qgscrscache.h"

//qt includes
#include <QFileInfo>
@@ -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.
@@ -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 );
@@ -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();

0 comments on commit 1962c3c

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