QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
QgsCRSCache Class Reference

Caches QgsCoordinateReferenceSystem construction, which may be expensive. More...

#include <qgscrscache.h>

Public Member Functions

Q_DECL_DEPRECATED QgsCoordinateReferenceSystem crsByAuthId (const QString &authid)
 Returns the CRS for authid, e.g. More...
 
QgsCoordinateReferenceSystem crsByEpsgId (long epsg) const
 Returns the CRS from a given EPSG ID. More...
 
QgsCoordinateReferenceSystem crsByOgcWmsCrs (const QString &ogcCrs) const
 Returns the CRS from a given OGC WMS-format Coordinate Reference System string. More...
 
QgsCoordinateReferenceSystem crsByProj4 (const QString &proj4) const
 Returns the CRS from a proj4 style formatted string. More...
 
QgsCoordinateReferenceSystem crsBySrsId (long srsId) const
 Returns the CRS from a specified QGIS SRS ID. More...
 
QgsCoordinateReferenceSystem crsByWkt (const QString &wkt) const
 Returns the CRS from a WKT spatial ref sys definition string. More...
 
void updateCRSCache (const QString &authid)
 Updates the cached definition of a CRS. More...
 

Static Public Member Functions

static QgsCRSCacheinstance ()
 Returns a pointer to the QgsCRSCache singleton. More...
 

Protected Member Functions

 QgsCRSCache ()
 

Detailed Description

Caches QgsCoordinateReferenceSystem construction, which may be expensive.

QgsCRSCache maintains a cache of previously constructed coordinate systems, so that creating a new CRS from the cache can reuse previously calculated parameters. The constructors for QgsCoordinateReferenceSystem can be expensive, so it's recommended to use QgsCRSCache instead of directly calling the QgsCoordinateReferenceSystem constructors.

Definition at line 67 of file qgscrscache.h.

Constructor & Destructor Documentation

◆ QgsCRSCache()

QgsCRSCache::QgsCRSCache ( )
protected

Definition at line 97 of file qgscrscache.cpp.

Member Function Documentation

◆ crsByAuthId()

QgsCoordinateReferenceSystem QgsCRSCache::crsByAuthId ( const QString authid)

Returns the CRS for authid, e.g.

'EPSG:4326' (or an invalid CRS in case of error)

Deprecated:
use crsByOgcWmsCrs() instead

Definition at line 120 of file qgscrscache.cpp.

◆ crsByEpsgId()

QgsCoordinateReferenceSystem QgsCRSCache::crsByEpsgId ( long  epsg) const

Returns the CRS from a given EPSG ID.

Parameters
epsgepsg CRS ID
Returns
matching CRS, or an invalid CRS if string could not be matched

Definition at line 155 of file qgscrscache.cpp.

◆ crsByOgcWmsCrs()

QgsCoordinateReferenceSystem QgsCRSCache::crsByOgcWmsCrs ( const QString ogcCrs) const

Returns the CRS from a given OGC WMS-format Coordinate Reference System string.

Parameters
ogcCrsOGR compliant CRS definition, eg "EPSG:4326"
Returns
matching CRS, or an invalid CRS if string could not be matched
Note
added in QGIS 2.16
See also
QgsCoordinateReferenceSystem::createFromOgcWmsCrs()

Definition at line 125 of file qgscrscache.cpp.

◆ crsByProj4()

QgsCoordinateReferenceSystem QgsCRSCache::crsByProj4 ( const QString proj4) const

Returns the CRS from a proj4 style formatted string.

Parameters
proj4proj4 format string
Returns
matching CRS, or an invalid CRS if string could not be matched
Note
added in QGIS 2.16
See also
QgsCoordinateReferenceSystem::createFromProj4()

Definition at line 160 of file qgscrscache.cpp.

◆ crsBySrsId()

QgsCoordinateReferenceSystem QgsCRSCache::crsBySrsId ( long  srsId) const

Returns the CRS from a specified QGIS SRS ID.

Parameters
srsIdinternal QGIS SRS ID
Returns
matching CRS, or an invalid CRS if ID could not be found
Note
added in QGIS 2.16
See also
QgsCoordinateReferenceSystem::createFromSrsId()

Definition at line 220 of file qgscrscache.cpp.

◆ crsByWkt()

QgsCoordinateReferenceSystem QgsCRSCache::crsByWkt ( const QString wkt) const

Returns the CRS from a WKT spatial ref sys definition string.

Parameters
wktWKT for the desired spatial reference system.
Returns
matching CRS, or an invalid CRS if string could not be matched
Note
added in QGIS 2.16
See also
QgsCoordinateReferenceSystem::createFromWkt()

Definition at line 190 of file qgscrscache.cpp.

◆ instance()

QgsCRSCache * QgsCRSCache::instance ( )
static

Returns a pointer to the QgsCRSCache singleton.

Definition at line 91 of file qgscrscache.cpp.

◆ updateCRSCache()

void QgsCRSCache::updateCRSCache ( const QString authid)

Updates the cached definition of a CRS.

Should be called if the definition of a user-created CRS has been changed.

Parameters
authidCRS auth ID, eg "EPSG:4326" or "USER:100009"

Definition at line 104 of file qgscrscache.cpp.


The documentation for this class was generated from the following files: