Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a new QgsCoordinateReferenceSystemRegistry singleton attached
to QgsApplication In the long term all methods for retrieving available CRS details should be moved here (instead of being scattered all over the place, as they are now). But for now the logic for saving and updating user CRS definitions has been moved here only. The initial motivation is to create a central place where objects can connect to in order to listen for when a user makes changes to their custom projections. Refs #40704
- Loading branch information
1 parent
064825b
commit 1499250
Showing
15 changed files
with
642 additions
and
116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
python/core/auto_generated/qgscoordinatereferencesystemregistry.sip.in
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgscoordinatereferencesystemregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ | ||
|
||
|
||
|
||
|
||
class QgsCoordinateReferenceSystemRegistry : QObject | ||
{ | ||
%Docstring | ||
A registry for known coordinate reference system (CRS) definitions, including | ||
any user-defined CRSes. | ||
|
||
QgsCoordinateReferenceSystemRegistry is not usually directly created, but rather accessed through | ||
:py:func:`QgsApplication.coordinateReferenceSystemRegistry()`. | ||
|
||
.. versionadded:: 3.18 | ||
%End | ||
|
||
%TypeHeaderCode | ||
#include "qgscoordinatereferencesystemregistry.h" | ||
%End | ||
public: | ||
|
||
explicit QgsCoordinateReferenceSystemRegistry( QObject *parent = 0 ); | ||
%Docstring | ||
Constructor for QgsCoordinateReferenceSystemRegistry, with the specified ``parent`` object. | ||
%End | ||
|
||
long addUserCrs( const QgsCoordinateReferenceSystem &crs, const QString &name, QgsCoordinateReferenceSystem::Format nativeFormat = QgsCoordinateReferenceSystem::FormatWkt ); | ||
%Docstring | ||
Adds a new ``crs`` definition as a custom ("USER") CRS. | ||
|
||
Returns the new CRS :py:func:`~QgsCoordinateReferenceSystemRegistry.srsid`, or -1 if the CRS could not be saved. | ||
|
||
The ``nativeFormat`` argument specifies the format to use when saving the CRS | ||
definition. FormatWkt is recommended as it is a lossless format. | ||
|
||
.. warning:: | ||
|
||
Not all CRS definitions can be represented as a Proj string, so | ||
take care when using the FormatProj option. | ||
|
||
.. seealso:: :py:func:`updateUserCrs` | ||
|
||
.. seealso:: :py:func:`userCrsAdded` | ||
%End | ||
|
||
bool updateUserCrs( long id, const QgsCoordinateReferenceSystem &crs, const QString &name, QgsCoordinateReferenceSystem::Format nativeFormat = QgsCoordinateReferenceSystem::FormatWkt ); | ||
%Docstring | ||
Updates the definition of the existing user CRS with matching ``id``. | ||
|
||
The ``crs`` argument specifies a CRS with the desired new definition. | ||
|
||
Returns ``False`` if the new CRS definition could not be saved. | ||
|
||
The ``nativeFormat`` argument specifies the format to use when saving the CRS | ||
definition. FormatWkt is recommended as it is a lossless format. | ||
|
||
.. warning:: | ||
|
||
Not all CRS definitions can be represented as a Proj string, so | ||
take care when using the FormatProj option. | ||
|
||
.. seealso:: :py:func:`addUserCrs` | ||
|
||
.. seealso:: :py:func:`userCrsChanged` | ||
%End | ||
|
||
signals: | ||
|
||
void userCrsChanged( const QString &id ); | ||
%Docstring | ||
Emitted whenever an existing user CRS definition is changed. | ||
|
||
The ``id`` argument specifies the ID of the user CRS which has been changed. | ||
|
||
Objects which store QgsCoordinateReferenceSystem members should connect to this signal | ||
and update any stored CRS definitions to ensure that they always use the current | ||
definition of any user defined CRSes. | ||
|
||
.. seealso:: :py:func:`crsDefinitionsChanged` | ||
|
||
.. seealso:: :py:func:`userCrsAdded` | ||
%End | ||
|
||
void userCrsAdded( const QString &id ); | ||
%Docstring | ||
Emitted whenever a new user CRS definition is added. | ||
|
||
The ``id`` argument specifies the ID of the user CRS which has been changed. | ||
|
||
.. seealso:: :py:func:`userCrsChanged` | ||
|
||
.. seealso:: :py:func:`crsDefinitionsChanged` | ||
%End | ||
|
||
void crsDefinitionsChanged(); | ||
%Docstring | ||
Emitted whenever an operation has caused any of the known CRS definitions (including | ||
user-defined CRS) to change. | ||
%End | ||
|
||
}; | ||
|
||
/************************************************************************ | ||
* This file has been generated automatically from * | ||
* * | ||
* src/core/qgscoordinatereferencesystemregistry.h * | ||
* * | ||
* Do not edit manually ! Edit header and run scripts/sipify.pl again * | ||
************************************************************************/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.