QGIS API Documentation 3.34.0-Prizren (ffbdd678812)
|
A registry for known coordinate reference system (CRS) definitions, including any user-defined CRSes. More...
#include <qgscoordinatereferencesystemregistry.h>
Classes | |
class | UserCrsDetails |
Contains details of a custom (user defined) CRS. More... | |
Signals | |
void | crsDefinitionsChanged () |
Emitted whenever an operation has caused any of the known CRS definitions (including user-defined CRS) to change. | |
void | userCrsAdded (const QString &id) |
Emitted whenever a new user CRS definition is added. | |
void | userCrsChanged (const QString &id) |
Emitted whenever an existing user CRS definition is changed. | |
void | userCrsRemoved (long id) |
Emitted when the user CRS with matching id is removed from the database. | |
Public Member Functions | |
QgsCoordinateReferenceSystemRegistry (QObject *parent=nullptr) | |
Constructor for QgsCoordinateReferenceSystemRegistry, with the specified parent object. | |
~QgsCoordinateReferenceSystemRegistry () | |
long | addUserCrs (const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat=Qgis::CrsDefinitionFormat::Wkt) |
Adds a new crs definition as a custom ("USER") CRS. | |
QSet< QString > | authorities () const |
Returns a list of all known authorities. | |
QList< QgsCelestialBody > | celestialBodies () const |
Returns a list of all known celestial bodies. | |
QList< QgsCrsDbRecord > | crsDbRecords () const |
Returns the list of records from the QGIS srs db. | |
QMap< QString, QgsProjOperation > | projOperations () const |
Returns a map of all valid PROJ operations. | |
bool | removeUserCrs (long id) |
Removes the existing user CRS with matching id. | |
bool | updateUserCrs (long id, const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat=Qgis::CrsDefinitionFormat::Wkt) |
Updates the definition of the existing user CRS with matching id. | |
QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > | userCrsList () const |
Returns a list containing the details of all registered custom (user-defined) CRSes. | |
A registry for known coordinate reference system (CRS) definitions, including any user-defined CRSes.
QgsCoordinateReferenceSystemRegistry is not usually directly created, but rather accessed through QgsApplication::coordinateReferenceSystemRegistry().
Definition at line 64 of file qgscoordinatereferencesystemregistry.h.
|
explicit |
Constructor for QgsCoordinateReferenceSystemRegistry, with the specified parent object.
Definition at line 36 of file qgscoordinatereferencesystemregistry.cpp.
|
default |
long QgsCoordinateReferenceSystemRegistry::addUserCrs | ( | const QgsCoordinateReferenceSystem & | crs, |
const QString & | name, | ||
Qgis::CrsDefinitionFormat | nativeFormat = Qgis::CrsDefinitionFormat::Wkt |
||
) |
Adds a new crs definition as a custom ("USER") CRS.
Returns the new CRS srsid(), or -1 if the CRS could not be saved.
The nativeFormat argument specifies the format to use when saving the CRS definition. FormatWkt is recommended as it is a lossless format.
Definition at line 83 of file qgscoordinatereferencesystemregistry.cpp.
QSet< QString > QgsCoordinateReferenceSystemRegistry::authorities | ( | ) | const |
Returns a list of all known authorities.
Definition at line 414 of file qgscoordinatereferencesystemregistry.cpp.
QList< QgsCelestialBody > QgsCoordinateReferenceSystemRegistry::celestialBodies | ( | ) | const |
Returns a list of all known celestial bodies.
QgsNotSupportedException | on QGIS builds based on PROJ 8.0 or earlier. |
Definition at line 378 of file qgscoordinatereferencesystemregistry.cpp.
QList< QgsCrsDbRecord > QgsCoordinateReferenceSystemRegistry::crsDbRecords | ( | ) | const |
Returns the list of records from the QGIS srs db.
Definition at line 436 of file qgscoordinatereferencesystemregistry.cpp.
|
signal |
Emitted whenever an operation has caused any of the known CRS definitions (including user-defined CRS) to change.
QMap< QString, QgsProjOperation > QgsCoordinateReferenceSystemRegistry::projOperations | ( | ) | const |
Returns a map of all valid PROJ operations.
The map keys correspond to PROJ operation IDs.
Definition at line 350 of file qgscoordinatereferencesystemregistry.cpp.
bool QgsCoordinateReferenceSystemRegistry::removeUserCrs | ( | long | id | ) |
Removes the existing user CRS with matching id.
Returns false
if the CRS could not be removed.
Definition at line 245 of file qgscoordinatereferencesystemregistry.cpp.
bool QgsCoordinateReferenceSystemRegistry::updateUserCrs | ( | long | id, |
const QgsCoordinateReferenceSystem & | crs, | ||
const QString & | name, | ||
Qgis::CrsDefinitionFormat | nativeFormat = Qgis::CrsDefinitionFormat::Wkt |
||
) |
Updates the definition of the existing user CRS with matching id.
The crs argument specifies a CRS with the desired new definition.
Returns false
if the new CRS definition could not be saved.
The nativeFormat argument specifies the format to use when saving the CRS definition. FormatWkt is recommended as it is a lossless format.
Definition at line 175 of file qgscoordinatereferencesystemregistry.cpp.
|
signal |
Emitted whenever a new user CRS definition is added.
The id argument specifies the ID of the user CRS which has been changed.
|
signal |
Emitted whenever an existing user CRS definition is changed.
The id argument specifies the ID of the user CRS which has been changed.
Objects which store QgsCoordinateReferenceSystem members should connect to this signal and update any stored CRS definitions to ensure that they always use the current definition of any user defined CRSes.
QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > QgsCoordinateReferenceSystemRegistry::userCrsList | ( | ) | const |
Returns a list containing the details of all registered custom (user-defined) CRSes.
Definition at line 44 of file qgscoordinatereferencesystemregistry.cpp.
|
signal |
Emitted when the user CRS with matching id is removed from the database.