QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgscoordinatereferencesystemregistry.h
Go to the documentation of this file.
1/***************************************************************************
2 qgscoordinatereferencesystemregistry.h
3 -------------------
4 begin : January 2021
5 copyright : (C) 2021 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************/
8
9/***************************************************************************
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the GNU General Public License as published by *
13 * the Free Software Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 ***************************************************************************/
17
18#ifndef QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
19#define QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
20
22
23#include <QMap>
24#include <QObject>
25#include <QSet>
26
29
30
31#ifndef SIP_RUN
32
42struct CORE_EXPORT QgsCrsDbRecord
43{
44 QString description;
46 QString srsId;
47 QString authName;
48 QString authId;
50 bool deprecated = false;
51};
52#endif
53
65class CORE_EXPORT QgsCoordinateReferenceSystemRegistry : public QObject
66{
67 Q_OBJECT
68 public:
69
73 explicit QgsCoordinateReferenceSystemRegistry( QObject *parent = nullptr );
74
76
83 {
84 public:
85
87 long id = -1;
88
90 QString name;
91
93 QString proj;
94
99 QString wkt;
100
103 };
104
109 QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > userCrsList() const;
110
125 long addUserCrs( const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat = Qgis::CrsDefinitionFormat::Wkt );
126
143 bool updateUserCrs( long id, const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat = Qgis::CrsDefinitionFormat::Wkt );
144
152 bool removeUserCrs( long id );
153
161 QMap< QString, QgsProjOperation > projOperations() const;
162
168 QList< QgsCelestialBody > celestialBodies() const;
169
177 QSet< QString > authorities() const;
178
185 QList< QgsCrsDbRecord > crsDbRecords() const SIP_SKIP;
186
193
201 void pushRecent( const QgsCoordinateReferenceSystem &crs );
202
211
219 void clearRecent();
220
221 signals:
222
235 void userCrsChanged( const QString &id );
236
245 void userCrsAdded( const QString &id );
246
253 void userCrsRemoved( long id );
254
260
269
278
287
288 private:
289
290 bool insertProjection( const QString &projectionAcronym );
291
292 mutable QReadWriteLock mCrsDbRecordsLock;
293 mutable bool mCrsDbRecordsPopulated = false;
294 mutable QList< QgsCrsDbRecord > mCrsDbRecords;
295
296};
297
298
299#endif // QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
CrsType
Coordinate reference system types.
Definition qgis.h:2327
@ Unknown
Unknown type.
Definition qgis.h:2328
CrsDefinitionFormat
CRS definition formats.
Definition qgis.h:3891
@ Wkt
WKT format (always recommended over proj string format).
Definition qgis.h:3892
Contains information about a celestial body.
QgsCoordinateReferenceSystem crs
QgsCoordinateReferenceSystem object representing the user-defined CRS.
QList< QgsCrsDbRecord > crsDbRecords() const
Returns the list of records from the QGIS srs db.
void userCrsAdded(const QString &id)
Emitted whenever a new user CRS definition is added.
void recentCrsRemoved(const QgsCoordinateReferenceSystem &crs)
Emitted when a recently used CRS has been removed from the recent CRS list.
void userCrsChanged(const QString &id)
Emitted whenever an existing user CRS definition is changed.
void recentCrsCleared()
Emitted when the list of recently used CRS has been cleared.
void recentCrsPushed(const QgsCoordinateReferenceSystem &crs)
Emitted when a recently used CRS has been pushed to the top of the recent CRS list.
QList< QgsCelestialBody > celestialBodies() const
Returns a list of all known celestial bodies.
void userCrsRemoved(long id)
Emitted when the user CRS with matching id is removed from the database.
void crsDefinitionsChanged()
Emitted whenever an operation has caused any of the known CRS definitions (including user-defined CRS...
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.
QgsCoordinateReferenceSystemRegistry(QObject *parent=nullptr)
Constructor for QgsCoordinateReferenceSystemRegistry, with the specified parent object.
void removeRecent(const QgsCoordinateReferenceSystem &crs)
Removes a CRS from the list of recently used CRS.
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.
bool removeUserCrs(long id)
Removes the existing user CRS with matching id.
void clearRecent()
Cleans the list of recently used CRS.
QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > userCrsList() const
Returns a list containing the details of all registered custom (user-defined) CRSes.
QList< QgsCoordinateReferenceSystem > recentCrs()
Returns a list of recently used CRS.
void pushRecent(const QgsCoordinateReferenceSystem &crs)
Pushes a recently used CRS to the top of the recent CRS list.
QMap< QString, QgsProjOperation > projOperations() const
Returns a map of all valid PROJ operations.
Represents a coordinate reference system (CRS).
Contains information about a PROJ operation.
#define SIP_SKIP
Definition qgis_sip.h:134