QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
46 QDomElement elemDataDefinedProperties = doc.createElement( QStringLiteral(
"data-defined-properties" ) );
48 element.appendChild( elemDataDefinedProperties );
56 const QDomElement elemDataDefinedProperties = element.firstChildElement( QStringLiteral(
"data-defined-properties" ) );
57 if ( !elemDataDefinedProperties.isNull() )
60 mZOffset = element.attribute( QStringLiteral(
"zoffset" ), QStringLiteral(
"0" ) ).toDouble();
61 mZScale = element.attribute( QStringLiteral(
"zscale" ), QStringLiteral(
"1" ) ).toDouble();
120 static std::once_flag initialized;
121 std::call_once( initialized, [ = ]( )
123 initPropertyDefinitions();
128 void QgsMapLayerElevationProperties::initPropertyDefinitions()
130 const QString origin = QStringLiteral(
"elevation" );
void setZOffset(double offset)
Sets the z offset, which is a fixed offset amount which will be added to z values from the layer.
The class is used as a container of context for various read/write operations on other objects.
Base class for storage of map layer elevation properties.
void zOffsetChanged()
Emitted when the z offset changes.
static QgsPropertiesDefinition propertyDefinitions()
Returns the definitions for data defined properties available for use in elevation properties.
virtual bool readXml(const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions)
Reads property collection state from an XML element.
@ ExtrusionHeight
Z offset.
void zScaleChanged()
Emitted when the z scale changes.
@ Double
Double value (including negative values)
virtual void setDefaultsFromLayer(QgsMapLayer *layer)
Sets default properties based on sensible choices for the given map layer.
virtual bool isVisibleInZRange(const QgsDoubleRange &range) const
Returns true if the layer should be visible and rendered for the specified z range.
QString qgsDoubleToString(double a, int precision=17)
Returns a string representation of a double.
void readCommonProperties(const QDomElement &element, const QgsReadWriteContext &context)
Reads common class properties from a DOM element previously written by writeXml().
virtual QgsDoubleRange calculateZRange(QgsMapLayer *layer) const
Attempts to calculate the overall elevation or z range for the specified layer, using the settings de...
virtual bool hasElevation() const
Returns true if the layer has an elevation or z component.
virtual QString htmlSummary() const
Returns a HTML formatted summary of the properties.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
double zScale() const
Returns the z scale, which is a scaling factor which should be applied to z values from the layer.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the object's property collection, used for data defined overrides.
bool qgsDoubleNear(double a, double b, double epsilon=4 *std::numeric_limits< double >::epsilon())
Compare two doubles (but allow some difference)
QgsPropertyCollection mDataDefinedProperties
Property collection for data defined elevation settings.
Definition for a property.
void copyCommonProperties(const QgsMapLayerElevationProperties *other)
Copies common properties from another object.
QgsMapLayerElevationProperties(QObject *parent)
Constructor for QgsMapLayerElevationProperties, with the specified parent object.
void profileGenerationPropertyChanged()
Emitted when any of the elevation properties which relate solely to generation of elevation profiles ...
static QgsPropertiesDefinition sPropertyDefinitions
Property definitions.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
QgsRange which stores a range of double values.
Base class for all map layer types. This is the base class for all map layer types (vector,...
virtual bool showByDefaultInElevationProfilePlots() const
Returns true if the layer should be visible by default in newly created elevation profile plots.
void changed()
Emitted when any of the elevation properties have changed.
double zOffset() const
Returns the z offset, which is a fixed offset amount which should be added to z values from the layer...
void writeCommonProperties(QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)
Writes common class properties to a DOM element, to be used later with readXml().
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the object's property collection, used for data defined overrides.
void setZScale(double scale)
Sets the z scale, which is a scaling factor which will be applied to z values from the layer.
virtual bool writeXml(QDomElement &collectionElem, const QgsPropertiesDefinition &definitions) const
Writes the current state of the property collection into an XML element.
@ DoublePositive
Positive double value (including 0)