QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | Static Public Member Functions | List of all members
QgsRasterLayerElevationProperties Class Reference

Raster layer specific subclass of QgsMapLayerElevationProperties. More...

#include <qgsrasterlayerelevationproperties.h>

Inheritance diagram for QgsRasterLayerElevationProperties:
Inheritance graph
[legend]

Public Member Functions

 QgsRasterLayerElevationProperties (QObject *parent)
 Constructor for QgsRasterLayerElevationProperties, with the specified parent object. More...
 
 ~QgsRasterLayerElevationProperties () override
 
int bandForElevationRange (QgsRasterLayer *layer, const QgsDoubleRange &range) const
 Returns the band corresponding to the specified range. More...
 
int bandNumber () const
 Returns the band number from which the elevation should be taken. More...
 
QgsDoubleRange calculateZRange (QgsMapLayer *layer) const override
 Attempts to calculate the overall elevation or z range for the specified layer, using the settings defined by this elevation properties object. More...
 
QgsRasterLayerElevationPropertiesclone () const override
 Creates a clone of the properties. More...
 
double elevationLimit () const
 Returns the elevation limit, which is used when profileSymbology() is Qgis::ProfileSurfaceSymbology::FillBelow or Qgis::ProfileSurfaceSymbology::FillAbove to limit the fill to a specific elevation range. More...
 
QgsDoubleRange elevationRangeForPixelValue (QgsRasterLayer *layer, int band, double pixelValue) const
 Returns the elevation range corresponding to a raw pixel value from the specified band. More...
 
QgsDoubleRange fixedRange () const
 Returns the fixed elevation range for the raster. More...
 
QMap< int, QgsDoubleRangefixedRangePerBand () const
 Returns the fixed elevation range for each band. More...
 
QgsMapLayerElevationProperties::Flags flags () const override
 Returns flags associated to the elevation properties. More...
 
bool hasElevation () const override
 Returns true if the layer has an elevation or z component. More...
 
QString htmlSummary () const override
 Returns a HTML formatted summary of the properties. More...
 
bool isEnabled () const
 Returns true if the elevation properties are enabled, i.e. More...
 
bool isVisibleInZRange (const QgsDoubleRange &range, QgsMapLayer *layer=nullptr) const override
 Returns true if the layer should be visible and rendered for the specified z range. More...
 
Qgis::RasterElevationMode mode () const
 Returns the elevation mode. More...
 
QgsFillSymbolprofileFillSymbol () const
 Returns the fill symbol used to render the raster profile in elevation profile plots. More...
 
QgsLineSymbolprofileLineSymbol () const
 Returns the line symbol used to render the raster profile in elevation profile plots. More...
 
Qgis::ProfileSurfaceSymbology profileSymbology () const
 Returns the symbology option used to render the raster profile in elevation profile plots. More...
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads the elevation properties from a DOM element previously written by writeXml(). More...
 
void setBandNumber (int band)
 Sets the band number from which the elevation should be taken. More...
 
void setElevationLimit (double limit)
 Sets the elevation limit, which is used when profileSymbology() is Qgis::ProfileSurfaceSymbology::FillBelow or Qgis::ProfileSurfaceSymbology::FillAbove to limit the fill to a specific elevation range. More...
 
void setEnabled (bool enabled)
 Sets whether the elevation properties are enabled, i.e. More...
 
void setFixedRange (const QgsDoubleRange &range)
 Sets the fixed elevation range for the raster. More...
 
void setFixedRangePerBand (const QMap< int, QgsDoubleRange > &ranges)
 Sets the fixed elevation range for each band. More...
 
void setMode (Qgis::RasterElevationMode mode)
 Sets the elevation mode. More...
 
void setProfileFillSymbol (QgsFillSymbol *symbol)
 Sets the fill symbol used to render the raster profile in elevation profile plots. More...
 
void setProfileLineSymbol (QgsLineSymbol *symbol)
 Sets the line symbol used to render the raster profile in elevation profile plots. More...
 
void setProfileSymbology (Qgis::ProfileSurfaceSymbology symbology)
 Sets the symbology option used to render the raster profile in elevation profile plots. More...
 
bool showByDefaultInElevationProfilePlots () const override
 Returns true if the layer should be visible by default in newly created elevation profile plots. More...
 
QDomElement writeXml (QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context) override
 Writes the properties to a DOM element, to be used later with readXml(). More...
 
- Public Member Functions inherited from QgsMapLayerElevationProperties
 QgsMapLayerElevationProperties (QObject *parent)
 Constructor for QgsMapLayerElevationProperties, with the specified parent object. More...
 
virtual QgsDoubleRange calculateZRange (QgsMapLayer *layer) const
 Attempts to calculate the overall elevation or z range for the specified layer, using the settings defined by this elevation properties object. More...
 
virtual QgsMapLayerElevationPropertiesclone () const =0
 Creates a clone of the properties. More...
 
QgsPropertyCollectiondataDefinedProperties ()
 Returns a reference to the object's property collection, used for data defined overrides. More...
 
const QgsPropertyCollectiondataDefinedProperties () const
 Returns a reference to the object's property collection, used for data defined overrides. More...
 
virtual QgsMapLayerElevationProperties::Flags flags () const
 Returns flags associated to the elevation properties. More...
 
virtual bool hasElevation () const
 Returns true if the layer has an elevation or z component. More...
 
virtual QString htmlSummary () const
 Returns a HTML formatted summary of the properties. More...
 
virtual bool isVisibleInZRange (const QgsDoubleRange &range, QgsMapLayer *layer=nullptr) const
 Returns true if the layer should be visible and rendered for the specified z range. More...
 
virtual bool readXml (const QDomElement &element, const QgsReadWriteContext &context)=0
 Reads the elevation properties from a DOM element previously written by writeXml(). More...
 
void setDataDefinedProperties (const QgsPropertyCollection &collection)
 Sets the object's property collection, used for data defined overrides. More...
 
virtual void setDefaultsFromLayer (QgsMapLayer *layer)
 Sets default properties based on sensible choices for the given map layer. More...
 
void setZOffset (double offset)
 Sets the z offset, which is a fixed offset amount which will be added to z values from the layer. More...
 
void setZScale (double scale)
 Sets the z scale, which is a scaling factor which will be applied to z values from the layer. More...
 
virtual bool showByDefaultInElevationProfilePlots () const
 Returns true if the layer should be visible by default in newly created elevation profile plots. More...
 
virtual QDomElement writeXml (QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)=0
 Writes the properties to a DOM element, to be used later with readXml(). More...
 
double zOffset () const
 Returns the z offset, which is a fixed offset amount which should be added to z values from the layer. More...
 
double zScale () const
 Returns the z scale, which is a scaling factor which should be applied to z values from the layer. More...
 

Static Public Member Functions

static bool layerLooksLikeDem (QgsRasterLayer *layer)
 Returns true if a raster layer looks like a DEM. More...
 
- Static Public Member Functions inherited from QgsMapLayerElevationProperties
static QgsPropertiesDefinition propertyDefinitions ()
 Returns the definitions for data defined properties available for use in elevation properties. More...
 

Additional Inherited Members

- Public Types inherited from QgsMapLayerElevationProperties
enum  Flag { FlagDontInvalidateCachedRendersWhenRangeChanges = 1 }
 Flags attached to the elevation property. More...
 
typedef QFlags< FlagFlags
 
enum class  Property : int { ZOffset , ExtrusionHeight , RasterPerBandLowerElevation , RasterPerBandUpperElevation }
 Data definable properties. More...
 
- Signals inherited from QgsMapLayerElevationProperties
void changed ()
 Emitted when any of the elevation properties have changed. More...
 
void profileGenerationPropertyChanged ()
 Emitted when any of the elevation properties which relate solely to generation of elevation profiles have changed. More...
 
void profileRenderingPropertyChanged ()
 Emitted when any of the elevation properties which relate solely to presentation of elevation results have changed. More...
 
void zOffsetChanged ()
 Emitted when the z offset changes. More...
 
void zScaleChanged ()
 Emitted when the z scale changes. More...
 
- Protected Member Functions inherited from QgsMapLayerElevationProperties
void copyCommonProperties (const QgsMapLayerElevationProperties *other)
 Copies common properties from another object. More...
 
void readCommonProperties (const QDomElement &element, const QgsReadWriteContext &context)
 Reads common class properties from a DOM element previously written by writeXml(). More...
 
void writeCommonProperties (QDomElement &element, QDomDocument &doc, const QgsReadWriteContext &context)
 Writes common class properties to a DOM element, to be used later with readXml(). More...
 
- Protected Attributes inherited from QgsMapLayerElevationProperties
QgsPropertyCollection mDataDefinedProperties
 Property collection for data defined elevation settings. More...
 
double mZOffset = 0.0
 Z offset. More...
 
double mZScale = 1.0
 Z scale. More...
 
- Static Protected Attributes inherited from QgsMapLayerElevationProperties
static QgsPropertiesDefinition sPropertyDefinitions
 Property definitions. More...
 

Detailed Description

Raster layer specific subclass of QgsMapLayerElevationProperties.

Since
QGIS 3.26

Definition at line 36 of file qgsrasterlayerelevationproperties.h.

Constructor & Destructor Documentation

◆ QgsRasterLayerElevationProperties()

QgsRasterLayerElevationProperties::QgsRasterLayerElevationProperties ( QObject *  parent)

Constructor for QgsRasterLayerElevationProperties, with the specified parent object.

Definition at line 29 of file qgsrasterlayerelevationproperties.cpp.

◆ ~QgsRasterLayerElevationProperties()

QgsRasterLayerElevationProperties::~QgsRasterLayerElevationProperties ( )
overridedefault

Member Function Documentation

◆ bandForElevationRange()

int QgsRasterLayerElevationProperties::bandForElevationRange ( QgsRasterLayer layer,
const QgsDoubleRange range 
) const

Returns the band corresponding to the specified range.

Note
This is only considered when mode() is Qgis::RasterElevationMode::FixedRangePerBand or Qgis::RasterElevationMode::DynamicRangePerBand. For other modes it will always return -1.
Since
QGIS 3.38

Definition at line 477 of file qgsrasterlayerelevationproperties.cpp.

◆ bandNumber()

int QgsRasterLayerElevationProperties::bandNumber ( ) const
inline

Returns the band number from which the elevation should be taken.

Note
This is only considered when mode() is Qgis::RasterElevationMode::RepresentsElevationSurface.
See also
setBandNumber()

Definition at line 96 of file qgsrasterlayerelevationproperties.h.

◆ calculateZRange()

QgsDoubleRange QgsRasterLayerElevationProperties::calculateZRange ( QgsMapLayer layer) const
overridevirtual

Attempts to calculate the overall elevation or z range for the specified layer, using the settings defined by this elevation properties object.

May return an infinite range if the extent could not be calculated.

Reimplemented from QgsMapLayerElevationProperties.

Definition at line 275 of file qgsrasterlayerelevationproperties.cpp.

◆ clone()

QgsRasterLayerElevationProperties * QgsRasterLayerElevationProperties::clone ( ) const
overridevirtual

Creates a clone of the properties.

Since
QGIS 3.26

Implements QgsMapLayerElevationProperties.

Definition at line 167 of file qgsrasterlayerelevationproperties.cpp.

◆ elevationLimit()

double QgsRasterLayerElevationProperties::elevationLimit ( ) const

Returns the elevation limit, which is used when profileSymbology() is Qgis::ProfileSurfaceSymbology::FillBelow or Qgis::ProfileSurfaceSymbology::FillAbove to limit the fill to a specific elevation range.

By default this is NaN, which indicates that there is no elevation limit.

See also
setElevationLimit()
Since
QGIS 3.32

Definition at line 591 of file qgsrasterlayerelevationproperties.cpp.

◆ elevationRangeForPixelValue()

QgsDoubleRange QgsRasterLayerElevationProperties::elevationRangeForPixelValue ( QgsRasterLayer layer,
int  band,
double  pixelValue 
) const

Returns the elevation range corresponding to a raw pixel value from the specified band.

Returns an infinite range if the pixel value does not correspond to an elevation value.

Since
QGIS 3.38

Definition at line 416 of file qgsrasterlayerelevationproperties.cpp.

◆ fixedRange()

QgsDoubleRange QgsRasterLayerElevationProperties::fixedRange ( ) const

Returns the fixed elevation range for the raster.

Note
This is only considered when mode() is Qgis::RasterElevationMode::FixedElevationRange.
When a fixed range is set any zOffset() and zScale() is ignored.
See also
setFixedRange()
Since
QGIS 3.38

Definition at line 709 of file qgsrasterlayerelevationproperties.cpp.

◆ fixedRangePerBand()

QMap< int, QgsDoubleRange > QgsRasterLayerElevationProperties::fixedRangePerBand ( ) const

Returns the fixed elevation range for each band.

Note
This is only considered when mode() is Qgis::RasterElevationMode::FixedRangePerBand.
When a fixed range is set any zOffset() and zScale() is ignored.
See also
setFixedRangePerBand()
Since
QGIS 3.38

Definition at line 695 of file qgsrasterlayerelevationproperties.cpp.

◆ flags()

QgsMapLayerElevationProperties::Flags QgsRasterLayerElevationProperties::flags ( ) const
overridevirtual

Returns flags associated to the elevation properties.

Reimplemented from QgsMapLayerElevationProperties.

Definition at line 364 of file qgsrasterlayerelevationproperties.cpp.

◆ hasElevation()

bool QgsRasterLayerElevationProperties::hasElevation ( ) const
overridevirtual

Returns true if the layer has an elevation or z component.

Reimplemented from QgsMapLayerElevationProperties.

Definition at line 39 of file qgsrasterlayerelevationproperties.cpp.

◆ htmlSummary()

QString QgsRasterLayerElevationProperties::htmlSummary ( ) const
overridevirtual

Returns a HTML formatted summary of the properties.

Since
QGIS 3.26

Reimplemented from QgsMapLayerElevationProperties.

Definition at line 183 of file qgsrasterlayerelevationproperties.cpp.

◆ isEnabled()

bool QgsRasterLayerElevationProperties::isEnabled ( ) const
inline

Returns true if the elevation properties are enabled, i.e.

the raster layer values represent an elevation surface.

See also
setEnabled()

Definition at line 64 of file qgsrasterlayerelevationproperties.h.

◆ isVisibleInZRange()

bool QgsRasterLayerElevationProperties::isVisibleInZRange ( const QgsDoubleRange range,
QgsMapLayer layer = nullptr 
) const
overridevirtual

Returns true if the layer should be visible and rendered for the specified z range.

Since QGIS 3.38 the layer argument can be used to specify the target layer.

Reimplemented from QgsMapLayerElevationProperties.

Definition at line 214 of file qgsrasterlayerelevationproperties.cpp.

◆ layerLooksLikeDem()

bool QgsRasterLayerElevationProperties::layerLooksLikeDem ( QgsRasterLayer layer)
static

Returns true if a raster layer looks like a DEM.

This method applies some heuristics to layer to determine whether it looks like a candidate for a DEM layer.

Specifically, it checks:

  • the layer's name for DEM-like wording hints
  • whether the layer contains a single band
  • whether the layer contains an attribute table (if so, it's unlikely to be a DEM)
  • the layer's data type
Since
QGIS 3.32

Definition at line 606 of file qgsrasterlayerelevationproperties.cpp.

◆ mode()

Qgis::RasterElevationMode QgsRasterLayerElevationProperties::mode ( ) const

Returns the elevation mode.

See also
setMode()
Since
QGIS 3.38

Definition at line 392 of file qgsrasterlayerelevationproperties.cpp.

◆ profileFillSymbol()

QgsFillSymbol * QgsRasterLayerElevationProperties::profileFillSymbol ( ) const

Returns the fill symbol used to render the raster profile in elevation profile plots.

See also
setProfileFillSymbol()

Definition at line 569 of file qgsrasterlayerelevationproperties.cpp.

◆ profileLineSymbol()

QgsLineSymbol * QgsRasterLayerElevationProperties::profileLineSymbol ( ) const

Returns the line symbol used to render the raster profile in elevation profile plots.

See also
setProfileLineSymbol()

Definition at line 557 of file qgsrasterlayerelevationproperties.cpp.

◆ profileSymbology()

Qgis::ProfileSurfaceSymbology QgsRasterLayerElevationProperties::profileSymbology ( ) const
inline

Returns the symbology option used to render the raster profile in elevation profile plots.

See also
setProfileSymbology()

Definition at line 211 of file qgsrasterlayerelevationproperties.h.

◆ readXml()

bool QgsRasterLayerElevationProperties::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)
overridevirtual

Reads the elevation properties from a DOM element previously written by writeXml().

See also
writeXml()

Implements QgsMapLayerElevationProperties.

Definition at line 101 of file qgsrasterlayerelevationproperties.cpp.

◆ setBandNumber()

void QgsRasterLayerElevationProperties::setBandNumber ( int  band)

Sets the band number from which the elevation should be taken.

Note
This is only considered when mode() is Qgis::RasterElevationMode::RepresentsElevationSurface.
See also
bandNumber()

Definition at line 406 of file qgsrasterlayerelevationproperties.cpp.

◆ setElevationLimit()

void QgsRasterLayerElevationProperties::setElevationLimit ( double  limit)

Sets the elevation limit, which is used when profileSymbology() is Qgis::ProfileSurfaceSymbology::FillBelow or Qgis::ProfileSurfaceSymbology::FillAbove to limit the fill to a specific elevation range.

Set to NaN to indicate that there is no elevation limit.

See also
elevationLimit()
Since
QGIS 3.32

Definition at line 596 of file qgsrasterlayerelevationproperties.cpp.

◆ setEnabled()

void QgsRasterLayerElevationProperties::setEnabled ( bool  enabled)

Sets whether the elevation properties are enabled, i.e.

the raster layer values represent an elevation surface.

See also
isEnabled()

Definition at line 382 of file qgsrasterlayerelevationproperties.cpp.

◆ setFixedRange()

void QgsRasterLayerElevationProperties::setFixedRange ( const QgsDoubleRange range)

Sets the fixed elevation range for the raster.

Note
This is only considered when mode() is Qgis::RasterElevationMode::FixedElevationRange.
When a fixed range is set any zOffset() and zScale() is ignored.
See also
fixedRange()
Since
QGIS 3.38

Definition at line 714 of file qgsrasterlayerelevationproperties.cpp.

◆ setFixedRangePerBand()

void QgsRasterLayerElevationProperties::setFixedRangePerBand ( const QMap< int, QgsDoubleRange > &  ranges)

Sets the fixed elevation range for each band.

Note
This is only considered when mode() is Qgis::RasterElevationMode::FixedRangePerBand.
When a fixed range is set any zOffset() and zScale() is ignored.
See also
fixedRangePerBand()
Since
QGIS 3.38

Definition at line 700 of file qgsrasterlayerelevationproperties.cpp.

◆ setMode()

void QgsRasterLayerElevationProperties::setMode ( Qgis::RasterElevationMode  mode)

Sets the elevation mode.

See also
mode()
Since
QGIS 3.38

Definition at line 397 of file qgsrasterlayerelevationproperties.cpp.

◆ setProfileFillSymbol()

void QgsRasterLayerElevationProperties::setProfileFillSymbol ( QgsFillSymbol symbol)

Sets the fill symbol used to render the raster profile in elevation profile plots.

Ownership of symbol is transferred to the plot.

See also
profileFillSymbol()

Definition at line 574 of file qgsrasterlayerelevationproperties.cpp.

◆ setProfileLineSymbol()

void QgsRasterLayerElevationProperties::setProfileLineSymbol ( QgsLineSymbol symbol)

Sets the line symbol used to render the raster profile in elevation profile plots.

Ownership of symbol is transferred to the plot.

See also
profileLineSymbol()

Definition at line 562 of file qgsrasterlayerelevationproperties.cpp.

◆ setProfileSymbology()

void QgsRasterLayerElevationProperties::setProfileSymbology ( Qgis::ProfileSurfaceSymbology  symbology)

Sets the symbology option used to render the raster profile in elevation profile plots.

See also
setProfileSymbology()

Definition at line 581 of file qgsrasterlayerelevationproperties.cpp.

◆ showByDefaultInElevationProfilePlots()

bool QgsRasterLayerElevationProperties::showByDefaultInElevationProfilePlots ( ) const
overridevirtual

Returns true if the layer should be visible by default in newly created elevation profile plots.

Subclasses should override this with logic which determines whether the layer is likely desirable to be initially checked in these plots.

Since
QGIS 3.26

Reimplemented from QgsMapLayerElevationProperties.

Definition at line 359 of file qgsrasterlayerelevationproperties.cpp.

◆ writeXml()

QDomElement QgsRasterLayerElevationProperties::writeXml ( QDomElement &  element,
QDomDocument &  doc,
const QgsReadWriteContext context 
)
overridevirtual

Writes the properties to a DOM element, to be used later with readXml().

See also
readXml()

Implements QgsMapLayerElevationProperties.

Definition at line 44 of file qgsrasterlayerelevationproperties.cpp.


The documentation for this class was generated from the following files: