QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
25 #include <QDomElement>
49 mBearingFormat.reset( format );
55 return mBearingFormat.get();
60 mGeographicCoordinateFormat.reset( format );
66 return mGeographicCoordinateFormat.get();
72 const QDomElement bearingElement = element.firstChildElement( QStringLiteral(
"BearingFormat" ) );
78 const QDomElement geographicElement = element.firstChildElement( QStringLiteral(
"GeographicCoordinateFormat" ) );
79 if ( !geographicElement.isNull() )
83 else if (
QgsProject *project = qobject_cast< QgsProject * >( parent() ) )
87 const QString format = project->readEntry( QStringLiteral(
"PositionPrecision" ), QStringLiteral(
"/DegreeFormat" ), QString(), &ok );
90 mGeographicCoordinateFormat = std::make_unique< QgsGeographicCoordinateNumericFormat >();
91 mGeographicCoordinateFormat->setShowDirectionalSuffix(
true );
92 if ( format == QLatin1String(
"DM" ) )
94 else if ( format == QLatin1String(
"DMS" ) )
116 QDomElement element = doc.createElement( QStringLiteral(
"ProjectDisplaySettings" ) );
119 QDomElement bearingElement = doc.createElement( QStringLiteral(
"BearingFormat" ) );
120 mBearingFormat->writeXml( bearingElement, doc, context );
121 element.appendChild( bearingElement );
125 QDomElement geographicElement = doc.createElement( QStringLiteral(
"GeographicCoordinateFormat" ) );
126 mGeographicCoordinateFormat->writeXml( geographicElement, doc, context );
127 element.appendChild( geographicElement );
void setBearingFormat(QgsBearingNumericFormat *format)
Sets the project bearing format, which controls how bearings associated with the project are displaye...
QgsProjectDisplaySettings(QObject *parent=nullptr)
Constructor for QgsProjectDisplaySettings with the specified parent object.
The class is used as a container of context for various read/write operations on other objects.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
void geographicCoordinateFormatChanged()
Emitted when the geographic coordinate format changes.
QDomElement writeXml(QDomDocument &doc, const QgsReadWriteContext &context) const
Returns a DOM element representing the settings.
const QgsGeographicCoordinateNumericFormat * geographicCoordinateFormat() const
Returns the project's geographic coordinate format, which controls how geographic coordinates associa...
static QgsGeographicCoordinateNumericFormat * geographicCoordinateFormat()
Returns the default geographic coordinate format, which controls how geographic coordinates are displ...
bool readXml(const QDomElement &element, const QgsReadWriteContext &context)
Reads the settings's state from a DOM element.
void reset()
Resets the settings to a default state.
const QgsBearingNumericFormat * bearingFormat() const
Returns the project bearing's format, which controls how bearings associated with the project are dis...
void bearingFormatChanged()
Emitted when the bearing format changes.
static QgsNumericFormatRegistry * numericFormatRegistry()
Gets the registry of available numeric formats.
~QgsProjectDisplaySettings() override
void setGeographicCoordinateFormat(QgsGeographicCoordinateNumericFormat *format)
Sets the project geographic coordinate format, which controls how geographic coordinates associated w...
static QgsBearingNumericFormat * bearingFormat()
Returns the default bearing format, which controls how angular bearings are displayed.