QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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
21#include <QObject>
22#include <QMap>
23#include <QSet>
25
28
29
30#ifndef SIP_RUN
31
41struct CORE_EXPORT QgsCrsDbRecord
42{
43 QString description;
45 QString srsId;
46 QString authName;
47 QString authId;
49 bool deprecated = false;
50};
51#endif
52
64class CORE_EXPORT QgsCoordinateReferenceSystemRegistry : public QObject
65{
66 Q_OBJECT
67 public:
68
72 explicit QgsCoordinateReferenceSystemRegistry( QObject *parent = nullptr );
73
75
82 {
83 public:
84
86 long id = -1;
87
89 QString name;
90
92 QString proj;
93
98 QString wkt;
99
102 };
103
108 QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > userCrsList() const;
109
124 long addUserCrs( const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat = Qgis::CrsDefinitionFormat::Wkt );
125
142 bool updateUserCrs( long id, const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat = Qgis::CrsDefinitionFormat::Wkt );
143
151 bool removeUserCrs( long id );
152
160 QMap< QString, QgsProjOperation > projOperations() const;
161
171 QList< QgsCelestialBody > celestialBodies() const;
172
180 QSet< QString > authorities() const;
181
188 QList< QgsCrsDbRecord > crsDbRecords() const SIP_SKIP;
189
195 QList< QgsCoordinateReferenceSystem > recentCrs();
196
204 void pushRecent( const QgsCoordinateReferenceSystem &crs );
205
213 void removeRecent( const QgsCoordinateReferenceSystem &crs );
214
222 void clearRecent();
223
224 signals:
225
238 void userCrsChanged( const QString &id );
239
248 void userCrsAdded( const QString &id );
249
256 void userCrsRemoved( long id );
257
262 void crsDefinitionsChanged();
263
271 void recentCrsPushed( const QgsCoordinateReferenceSystem &crs );
272
280 void recentCrsRemoved( const QgsCoordinateReferenceSystem &crs );
281
289 void recentCrsCleared();
290
291 private:
292
293 bool insertProjection( const QString &projectionAcronym );
294
295 mutable QList< QgsCelestialBody > mCelestialBodies;
296 mutable QMap< QString, QgsProjOperation > mProjOperations;
297 mutable QSet< QString > mKnownAuthorities;
298 mutable QList< QgsCrsDbRecord > mCrsDbRecords;
299
300};
301
302
303#endif // QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
CrsType
Coordinate reference system types.
Definition: qgis.h:1865
@ Unknown
Unknown type.
CrsDefinitionFormat
CRS definition formats.
Definition: qgis.h:3167
@ Wkt
WKT format (always recommended over proj string format)
Contains information about a celestial body.
QgsCoordinateReferenceSystem crs
QgsCoordinateReferenceSystem object representing the user-defined CRS.
A registry for known coordinate reference system (CRS) definitions, including any user-defined CRSes.
This class represents a coordinate reference system (CRS).
Contains information about a PROJ operation.
#define SIP_SKIP
Definition: qgis_sip.h:126
const QgsCoordinateReferenceSystem & crs