QGIS API Documentation 4.1.0-Master (376402f9aeb)
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
30
31
32#ifndef SIP_RUN
33
43struct CORE_EXPORT QgsCrsDbRecord
44{
45 QString description;
47 QString srsId;
48 QString authName;
49 QString authId;
51 bool deprecated = false;
52};
53#endif
54
66class CORE_EXPORT QgsCoordinateReferenceSystemRegistry : public QObject
67{
68 Q_OBJECT
69 public:
71
73
75
79 explicit QgsCoordinateReferenceSystemRegistry( QObject *parent = nullptr );
80
82
89 {
90 public:
92 long id = -1;
93
95 QString name;
96
98 QString proj;
99
104 QString wkt;
105
108 };
109
114 QList< QgsCoordinateReferenceSystemRegistry::UserCrsDetails > userCrsList() const;
115
130 long addUserCrs( const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat = Qgis::CrsDefinitionFormat::Wkt );
131
148 bool updateUserCrs( long id, const QgsCoordinateReferenceSystem &crs, const QString &name, Qgis::CrsDefinitionFormat nativeFormat = Qgis::CrsDefinitionFormat::Wkt );
149
157 bool removeUserCrs( long id );
158
166 QMap< QString, QgsProjOperation > projOperations() const;
167
173 QList< QgsCelestialBody > celestialBodies() const;
174
182 QSet< QString > authorities() const;
183
190 QList< QgsCrsDbRecord > crsDbRecords() const SIP_SKIP;
191
198
206 void pushRecent( const QgsCoordinateReferenceSystem &crs );
207
216
224 void clearRecent();
225
226 signals:
227
240 void userCrsChanged( const QString &id );
241
250 void userCrsAdded( const QString &id );
251
258 void userCrsRemoved( long id );
259
265
274
283
292
293 private:
294 bool insertProjection( const QString &projectionAcronym );
295
296 mutable QReadWriteLock mCrsDbRecordsLock;
297 mutable bool mCrsDbRecordsPopulated = false;
298 mutable QList< QgsCrsDbRecord > mCrsDbRecords;
299};
300
301
302#endif // QGSCOORDINATEREFERENCESYSTEMREGISTRY_H
CrsType
Coordinate reference system types.
Definition qgis.h:2462
@ Unknown
Unknown type.
Definition qgis.h:2463
CrsDefinitionFormat
CRS definition formats.
Definition qgis.h:4075
@ Wkt
WKT format (always recommended over proj string format).
Definition qgis.h:4076
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.
static const QgsSettingsEntryStringList * settingsRecentProjectionsProj4
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.
static const QgsSettingsEntryStringList * settingsRecentProjectionsWkt
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.
static const QgsSettingsEntryStringList * settingsRecentProjectionsAuthId
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.
A string list settings entry.
#define SIP_SKIP
Definition qgis_sip.h:133