QGIS API Documentation  3.22.4-Białowieża (ce8e65e95e)
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>
24 
25 class QgsCelestialBody;
26 class QgsProjOperation;
27 
39 class CORE_EXPORT QgsCoordinateReferenceSystemRegistry : public QObject
40 {
41  Q_OBJECT
42  public:
43 
47  explicit QgsCoordinateReferenceSystemRegistry( QObject *parent = nullptr );
48 
50 
57  {
58  public:
59 
61  long id = -1;
62 
64  QString name;
65 
67  QString proj;
68 
73  QString wkt;
74 
77  };
78 
83  QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > userCrsList() const;
84 
99  long addUserCrs( const QgsCoordinateReferenceSystem &crs, const QString &name, QgsCoordinateReferenceSystem::Format nativeFormat = QgsCoordinateReferenceSystem::FormatWkt );
100 
117  bool updateUserCrs( long id, const QgsCoordinateReferenceSystem &crs, const QString &name, QgsCoordinateReferenceSystem::Format nativeFormat = QgsCoordinateReferenceSystem::FormatWkt );
118 
126  bool removeUserCrs( long id );
127 
135  QMap< QString, QgsProjOperation > projOperations() const;
136 
146  QList< QgsCelestialBody > celestialBodies() const;
147 
148  signals:
149 
162  void userCrsChanged( const QString &id );
163 
172  void userCrsAdded( const QString &id );
173 
180  void userCrsRemoved( long id );
181 
187 
188  private:
189 
190  bool insertProjection( const QString &projectionAcronym );
191 
192  mutable QList< QgsCelestialBody > mCelestialBodies;
193  mutable QMap< QString, QgsProjOperation > mProjOperations;
194 
195 };
196 
197 
198 #endif // QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
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.
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.
void crsDefinitionsChanged()
Emitted whenever an operation has caused any of the known CRS definitions (including user-defined CRS...
This class represents a coordinate reference system (CRS).
Format
Projection definition formats.
@ FormatWkt
WKT format (always recommended over proj string format)
Contains information about a PROJ operation.
const QgsCoordinateReferenceSystem & crs