QGIS API Documentation 3.29.0-Master (006c3c0232)
qgsprojectdisplaysettings.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsprojectdisplaysettings.h
3 ---------------------------
4 begin : January 2020
5 copyright : (C) 2020 by Nyall Dawson
6 email : nyall dot dawson at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15#ifndef QGSPROJECTDISPLAYSETTINGS_H
16#define QGSPROJECTDISPLAYSETTINGS_H
17
18#include "qgis_core.h"
19#include "qgis_sip.h"
20#include "qgis.h"
22
23#include <QObject>
24#include <QVector>
25#include <memory>
26
27class QDomElement;
29class QDomDocument;
32
40class CORE_EXPORT QgsProjectDisplaySettings : public QObject
41{
42 Q_OBJECT
43
44 public:
45
46 Q_PROPERTY( Qgis::CoordinateDisplayType coordinateType READ coordinateType WRITE setCoordinateType NOTIFY coordinateTypeChanged )
47 Q_PROPERTY( Qgis::CoordinateOrder coordinateAxisOrder READ coordinateAxisOrder WRITE setCoordinateAxisOrder NOTIFY coordinateAxisOrderChanged )
48 Q_PROPERTY( QgsCoordinateReferenceSystem coordinateCustomCrs READ coordinateCustomCrs WRITE setCoordinateCustomCrs NOTIFY coordinateCustomCrsChanged )
49 Q_PROPERTY( QgsCoordinateReferenceSystem coordinateCrs READ coordinateCrs NOTIFY coordinateCrsChanged )
50
51
54 QgsProjectDisplaySettings( QObject *parent = nullptr );
55
57
61 void reset();
62
71 void setBearingFormat( QgsBearingNumericFormat *format SIP_TRANSFER );
72
79 const QgsBearingNumericFormat *bearingFormat() const;
80
91 void setGeographicCoordinateFormat( QgsGeographicCoordinateNumericFormat *format SIP_TRANSFER );
92
99 const QgsGeographicCoordinateNumericFormat *geographicCoordinateFormat() const;
100
106 Qgis::CoordinateDisplayType coordinateType() const { return mCoordinateType; }
107
113 void setCoordinateType( Qgis::CoordinateDisplayType type );
114
121 Qgis::CoordinateOrder coordinateAxisOrder() const { return mCoordinateAxisOrder; }
122
129 void setCoordinateAxisOrder( Qgis::CoordinateOrder order );
130
136 QgsCoordinateReferenceSystem coordinateCustomCrs() const { return mCoordinateCustomCrs; }
137
143 void setCoordinateCustomCrs( const QgsCoordinateReferenceSystem &crs );
144
151 QgsCoordinateReferenceSystem coordinateCrs() const { return mCoordinateCrs; }
152
157 bool readXml( const QDomElement &element, const QgsReadWriteContext &context );
158
163 QDomElement writeXml( QDomDocument &doc, const QgsReadWriteContext &context ) const;
164
165 signals:
166
174
182
191
200
209
218
219 private:
220 void updateCoordinateCrs();
221
222 std::unique_ptr< QgsBearingNumericFormat > mBearingFormat;
223 std::unique_ptr< QgsGeographicCoordinateNumericFormat > mGeographicCoordinateFormat;
224
226 QgsCoordinateReferenceSystem mCoordinateCustomCrs = QgsCoordinateReferenceSystem( QStringLiteral( "EPSG:4326" ) );
227 QgsCoordinateReferenceSystem mCoordinateCrs;
229
230};
231
232#endif // QGSPROJECTDISPLAYSETTINGS_H
CoordinateDisplayType
Relationship capabilities.
Definition: qgis.h:2493
CoordinateOrder
Order of coordinates.
Definition: qgis.h:1308
@ Default
Respect the default axis ordering for the CRS, as defined in the CRS's parameters.
A numeric formatter which returns a text representation of a direction/bearing.
This class represents a coordinate reference system (CRS).
A numeric formatter which returns a text representation of a geographic coordinate (latitude or longi...
Contains settings and properties relating to how a QgsProject should display values such as map coord...
void geographicCoordinateFormatChanged()
Emitted when the geographic coordinate format changes.
void coordinateAxisOrderChanged()
Emitted when the default coordinate axis order changes.
void bearingFormatChanged()
Emitted when the bearing format changes.
QgsCoordinateReferenceSystem coordinateCrs() const
Returns the coordinate display CRS used derived from the coordinate type.
Qgis::CoordinateDisplayType coordinateType() const
Returns default coordinate type for the project.
void coordinateCrsChanged()
Emitted when the coordinate CRS changes.
void coordinateTypeChanged()
Emitted when the default coordinate format changes.
void coordinateCustomCrsChanged()
Emitted when the coordinate custom CRS changes.
QgsCoordinateReferenceSystem coordinateCustomCrs() const
Returns the coordinate custom CRS used when the project coordinate type is set to Qgis....
Qgis::CoordinateOrder coordinateAxisOrder() const
Returns default coordinate axis order to use when displaying coordinates for the project.
~QgsProjectDisplaySettings() override
The class is used as a container of context for various read/write operations on other objects.
#define SIP_TRANSFER
Definition: qgis_sip.h:36
const QgsCoordinateReferenceSystem & crs