QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
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>
23 
35 class CORE_EXPORT QgsCoordinateReferenceSystemRegistry : public QObject
36 {
37  Q_OBJECT
38  public:
39 
43  explicit QgsCoordinateReferenceSystemRegistry( QObject *parent = nullptr );
44 
51  {
52  public:
53 
55  long id = -1;
56 
58  QString name;
59 
61  QString proj;
62 
67  QString wkt;
68 
71  };
72 
77  QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > userCrsList() const;
78 
93  long addUserCrs( const QgsCoordinateReferenceSystem &crs, const QString &name, QgsCoordinateReferenceSystem::Format nativeFormat = QgsCoordinateReferenceSystem::FormatWkt );
94 
111  bool updateUserCrs( long id, const QgsCoordinateReferenceSystem &crs, const QString &name, QgsCoordinateReferenceSystem::Format nativeFormat = QgsCoordinateReferenceSystem::FormatWkt );
112 
120  bool removeUserCrs( long id );
121 
122  signals:
123 
136  void userCrsChanged( const QString &id );
137 
146  void userCrsAdded( const QString &id );
147 
154  void userCrsRemoved( long id );
155 
161 
162  private:
163 
164  bool insertProjection( const QString &projectionAcronym );
165 
166 };
167 
168 
169 #endif // QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
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)
const QgsCoordinateReferenceSystem & crs