QGIS API Documentation 3.41.0-Master (af5edcb665c)
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | List of all members
QgsRasterLayerSimpleLabeling Class Reference

Basic implementation of the labeling interface for raster layers. More...

#include <qgsrasterlabeling.h>

Inheritance diagram for QgsRasterLayerSimpleLabeling:
Inheritance graph
[legend]

Public Member Functions

 QgsRasterLayerSimpleLabeling ()
 
 ~QgsRasterLayerSimpleLabeling () override
 
bool accept (QgsStyleEntityVisitorInterface *visitor) const override
 Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling.
 
int band () const
 Returns the raster band to use for label values.
 
QgsRasterLayerSimpleLabelingclone () const override
 Returns a new copy of the object.
 
bool hasScaleBasedVisibility () const
 Returns whether scale based visibility is enabled for the labels.
 
bool isInScaleRange (double scale) const override
 Tests whether the labels should be visible at the specified scale.
 
double maximumScale () const
 Returns the maximum map scale (i.e.
 
double minimumScale () const
 Returns the minimum map scale (i.e.
 
void multiplyOpacity (double opacityFactor) override
 Multiply opacity by opacityFactor.
 
const QgsNumericFormatnumericFormat () const
 Returns the numeric format used for the labels.
 
QgsLabelPlacementSettingsplacementSettings ()
 Returns the label placement settings.
 
const QgsLabelPlacementSettingsplacementSettings () const
 Returns the label placement settings.
 
double priority () const
 Returns the priority of labels.
 
std::unique_ptr< QgsRasterLayerLabelProviderprovider (QgsRasterLayer *layer) const override
 Creates a raster label provider corresponding to this object's configuration.
 
bool requiresAdvancedEffects () const override
 Returns true if drawing labels requires advanced effects like composition modes, which could prevent it being used as an isolated cached image or exported to a vector format.
 
Qgis::RasterResamplingMethod resampleMethod () const
 Returns the resampling method used when the raster labels are being resampled over neighboring pixels.
 
int resampleOver () const
 Returns the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.
 
QDomElement save (QDomDocument &doc, const QgsReadWriteContext &context) const override
 Saves the labeling configuration to an XML element.
 
void setBand (int band)
 Sest the raster band to use for label values.
 
void setMaximumScale (double scale)
 Sets the maximum map scale (i.e.
 
void setMinimumScale (double scale)
 Sets the minimum map scale (i.e.
 
void setNumericFormat (QgsNumericFormat *format)
 Sets the numeric format used for the labels.
 
void setPlacementSettings (const QgsLabelPlacementSettings &settings)
 Sets the label placement settings.
 
void setPriority (double priority)
 Sets the priority of labels.
 
void setResampleMethod (Qgis::RasterResamplingMethod method)
 Sets the resampling method to use when the raster labels are being resampled over neighboring pixels.
 
void setResampleOver (int pixels)
 Sets the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.
 
void setScaleBasedVisibility (bool enabled)
 Sets whether scale based visibility is enabled for the labels.
 
void setTextFormat (const QgsTextFormat &format)
 Sets the text format used for rendering the labels.
 
void setThinningSettings (const QgsLabelThinningSettings &settings)
 Sets the label thinning settings.
 
void setZIndex (double index)
 Sets the Z-Index of the labels.
 
QgsTextFormat textFormat () const
 Returns the text format used for rendering the labels.
 
QgsLabelThinningSettingsthinningSettings ()
 Returns the label thinning settings.
 
const QgsLabelThinningSettingsthinningSettings () const
 Returns the label thinning settings.
 
QString type () const override
 Unique type string of the labeling configuration implementation.
 
double zIndex () const
 Returns the Z-Index of the labels.
 
- Public Member Functions inherited from QgsAbstractRasterLayerLabeling
 QgsAbstractRasterLayerLabeling ()=default
 
 QgsAbstractRasterLayerLabeling (const QgsAbstractRasterLayerLabeling &rhs)=delete
 QgsAbstractRasterLayerLabeling cannot be copied, use clone() instead.
 
virtual ~QgsAbstractRasterLayerLabeling ()=default
 
QgsAbstractRasterLayerLabelingoperator= (const QgsAbstractRasterLayerLabeling &rhs)=delete
 QgsAbstractRasterLayerLabeling cannot be copied, use clone() instead.
 
virtual void toSld (QDomNode &parent, const QVariantMap &props) const
 Writes the SE 1.1 TextSymbolizer element based on the current layer labeling settings.
 

Static Public Member Functions

static QgsRasterLayerSimpleLabelingcreate (const QDomElement &element, const QgsReadWriteContext &context)
 Creates a QgsRasterLayerSimpleLabeling from a DOM element with saved configuration.
 
- Static Public Member Functions inherited from QgsAbstractRasterLayerLabeling
static QgsAbstractRasterLayerLabelingcreateFromElement (const QDomElement &element, const QgsReadWriteContext &context)
 Tries to create an instance of an implementation based on the XML data.
 
static QgsAbstractRasterLayerLabelingdefaultLabelingForLayer (QgsRasterLayer *layer)
 Creates default labeling for a raster layer.
 

Detailed Description

Basic implementation of the labeling interface for raster layers.

Since
QGIS 3.42

Definition at line 273 of file qgsrasterlabeling.h.

Constructor & Destructor Documentation

◆ QgsRasterLayerSimpleLabeling()

QgsRasterLayerSimpleLabeling::QgsRasterLayerSimpleLabeling ( )
explicit

Definition at line 354 of file qgsrasterlabeling.cpp.

◆ ~QgsRasterLayerSimpleLabeling()

QgsRasterLayerSimpleLabeling::~QgsRasterLayerSimpleLabeling ( )
overridedefault

Member Function Documentation

◆ accept()

bool QgsRasterLayerSimpleLabeling::accept ( QgsStyleEntityVisitorInterface visitor) const
overridevirtual

Accepts the specified symbology visitor, causing it to visit all symbols associated with the labeling.

Returns true if the visitor should continue visiting other objects, or false if visiting should be canceled.

Reimplemented from QgsAbstractRasterLayerLabeling.

Definition at line 461 of file qgsrasterlabeling.cpp.

◆ band()

int QgsRasterLayerSimpleLabeling::band ( ) const
inline

Returns the raster band to use for label values.

See also
setBand()

Definition at line 326 of file qgsrasterlabeling.h.

◆ clone()

QgsRasterLayerSimpleLabeling * QgsRasterLayerSimpleLabeling::clone ( ) const
overridevirtual

Returns a new copy of the object.

Implements QgsAbstractRasterLayerLabeling.

Definition at line 369 of file qgsrasterlabeling.cpp.

◆ create()

QgsRasterLayerSimpleLabeling * QgsRasterLayerSimpleLabeling::create ( const QDomElement &  element,
const QgsReadWriteContext context 
)
static

Creates a QgsRasterLayerSimpleLabeling from a DOM element with saved configuration.

Definition at line 475 of file qgsrasterlabeling.cpp.

◆ hasScaleBasedVisibility()

bool QgsRasterLayerSimpleLabeling::hasScaleBasedVisibility ( ) const

Returns whether scale based visibility is enabled for the labels.

See also
minimumScale()
maximumScale()
setScaleBasedVisibility()

Definition at line 569 of file qgsrasterlabeling.cpp.

◆ isInScaleRange()

bool QgsRasterLayerSimpleLabeling::isInScaleRange ( double  scale) const
overridevirtual

Tests whether the labels should be visible at the specified scale.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map.

Returns
true if the labels are visible at the given scale.

Reimplemented from QgsAbstractRasterLayerLabeling.

Definition at line 574 of file qgsrasterlabeling.cpp.

◆ maximumScale()

double QgsRasterLayerSimpleLabeling::maximumScale ( ) const

Returns the maximum map scale (i.e.

most "zoomed in" scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is true.

See also
setMaximumScale()
minimumScale()
hasScaleBasedVisibility()

Definition at line 549 of file qgsrasterlabeling.cpp.

◆ minimumScale()

double QgsRasterLayerSimpleLabeling::minimumScale ( ) const

Returns the minimum map scale (i.e.

most "zoomed out" scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no minimum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is true.

See also
setMinimumScale()
maximumScale()
hasScaleBasedVisibility()

Definition at line 559 of file qgsrasterlabeling.cpp.

◆ multiplyOpacity()

void QgsRasterLayerSimpleLabeling::multiplyOpacity ( double  opacityFactor)
overridevirtual

Multiply opacity by opacityFactor.

This method multiplies the opacity of the labeling elements (text, shadow, buffer etc.) by opacity effectively changing the opacity of the whole labeling elements.

Reimplemented from QgsAbstractRasterLayerLabeling.

Definition at line 608 of file qgsrasterlabeling.cpp.

◆ numericFormat()

const QgsNumericFormat * QgsRasterLayerSimpleLabeling::numericFormat ( ) const

Returns the numeric format used for the labels.

See also
setNumericFormat()

Definition at line 528 of file qgsrasterlabeling.cpp.

◆ placementSettings() [1/2]

QgsLabelPlacementSettings & QgsRasterLayerSimpleLabeling::placementSettings ( )
inline

Returns the label placement settings.

See also
setPlacementSettings()

Definition at line 366 of file qgsrasterlabeling.h.

◆ placementSettings() [2/2]

const QgsLabelPlacementSettings & QgsRasterLayerSimpleLabeling::placementSettings ( ) const
inline

Returns the label placement settings.

See also
setPlacementSettings()
Note
Not available in Python bindings

Definition at line 360 of file qgsrasterlabeling.h.

◆ priority()

double QgsRasterLayerSimpleLabeling::priority ( ) const
inline

Returns the priority of labels.

This is a value between 0 to 1, where 0 = highest priority and 1 = lowest priority.

The default is 0.5.

See also
setPriority()

Definition at line 344 of file qgsrasterlabeling.h.

◆ provider()

std::unique_ptr< QgsRasterLayerLabelProvider > QgsRasterLayerSimpleLabeling::provider ( QgsRasterLayer layer) const
overridevirtual

Creates a raster label provider corresponding to this object's configuration.

Note
not available in Python bindings

Implements QgsAbstractRasterLayerLabeling.

Definition at line 391 of file qgsrasterlabeling.cpp.

◆ requiresAdvancedEffects()

bool QgsRasterLayerSimpleLabeling::requiresAdvancedEffects ( ) const
overridevirtual

Returns true if drawing labels requires advanced effects like composition modes, which could prevent it being used as an isolated cached image or exported to a vector format.

Implements QgsAbstractRasterLayerLabeling.

Definition at line 470 of file qgsrasterlabeling.cpp.

◆ resampleMethod()

Qgis::RasterResamplingMethod QgsRasterLayerSimpleLabeling::resampleMethod ( ) const

Returns the resampling method used when the raster labels are being resampled over neighboring pixels.

See also
setResampleMethod()
resampleOver()

Definition at line 583 of file qgsrasterlabeling.cpp.

◆ resampleOver()

int QgsRasterLayerSimpleLabeling::resampleOver ( ) const

Returns the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.

See also
setResampleOver()
resampleMethod()

Definition at line 593 of file qgsrasterlabeling.cpp.

◆ save()

QDomElement QgsRasterLayerSimpleLabeling::save ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const
overridevirtual

Saves the labeling configuration to an XML element.

See also
createFromElement()

Implements QgsAbstractRasterLayerLabeling.

Definition at line 409 of file qgsrasterlabeling.cpp.

◆ setBand()

void QgsRasterLayerSimpleLabeling::setBand ( int  band)
inline

Sest the raster band to use for label values.

See also
band()

Definition at line 333 of file qgsrasterlabeling.h.

◆ setMaximumScale()

void QgsRasterLayerSimpleLabeling::setMaximumScale ( double  scale)

Sets the maximum map scale (i.e.

most "zoomed in" scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no maximum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is true.

See also
maximumScale()
setMinimumScale()
setScaleBasedVisibility()

Definition at line 554 of file qgsrasterlabeling.cpp.

◆ setMinimumScale()

void QgsRasterLayerSimpleLabeling::setMinimumScale ( double  scale)

Sets the minimum map scale (i.e.

most "zoomed out" scale) at which the labels will be visible.

The scale value indicates the scale denominator, e.g. 1000.0 for a 1:1000 map. A scale of 0 indicates no minimum scale visibility.

This setting is only considered if hasScaleBasedVisibility() is true.

See also
minimumScale()
setMaximumScale()
hasScaleBasedVisibility()

Definition at line 564 of file qgsrasterlabeling.cpp.

◆ setNumericFormat()

void QgsRasterLayerSimpleLabeling::setNumericFormat ( QgsNumericFormat format)

Sets the numeric format used for the labels.

Ownership of format is transferred to the labeling.

See also
numericFormat()

Definition at line 533 of file qgsrasterlabeling.cpp.

◆ setPlacementSettings()

void QgsRasterLayerSimpleLabeling::setPlacementSettings ( const QgsLabelPlacementSettings settings)
inline

Sets the label placement settings.

See also
placementSettings()

Definition at line 372 of file qgsrasterlabeling.h.

◆ setPriority()

void QgsRasterLayerSimpleLabeling::setPriority ( double  priority)
inline

Sets the priority of labels.

This is a value between 0 to 1, where 0 = highest priority and 1 = lowest priority.

See also
priority()

Definition at line 353 of file qgsrasterlabeling.h.

◆ setResampleMethod()

void QgsRasterLayerSimpleLabeling::setResampleMethod ( Qgis::RasterResamplingMethod  method)

Sets the resampling method to use when the raster labels are being resampled over neighboring pixels.

See also
resampleMethod()
setResampleOver()

Definition at line 588 of file qgsrasterlabeling.cpp.

◆ setResampleOver()

void QgsRasterLayerSimpleLabeling::setResampleOver ( int  pixels)

Sets the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.

See also
resampleOver()
setResampleMethod()

Definition at line 598 of file qgsrasterlabeling.cpp.

◆ setScaleBasedVisibility()

void QgsRasterLayerSimpleLabeling::setScaleBasedVisibility ( bool  enabled)

Sets whether scale based visibility is enabled for the labels.

See also
setMinimumScale()
setMaximumScale()
hasScaleBasedVisibility()

Definition at line 603 of file qgsrasterlabeling.cpp.

◆ setTextFormat()

void QgsRasterLayerSimpleLabeling::setTextFormat ( const QgsTextFormat format)

Sets the text format used for rendering the labels.

See also
textFormat()

Definition at line 523 of file qgsrasterlabeling.cpp.

◆ setThinningSettings()

void QgsRasterLayerSimpleLabeling::setThinningSettings ( const QgsLabelThinningSettings settings)
inline

Sets the label thinning settings.

See also
thinningSettings()

Definition at line 391 of file qgsrasterlabeling.h.

◆ setZIndex()

void QgsRasterLayerSimpleLabeling::setZIndex ( double  index)

Sets the Z-Index of the labels.

Labels with a higher z-index are rendered on top of labels with a lower z-index.

See also
zIndex()

Definition at line 544 of file qgsrasterlabeling.cpp.

◆ textFormat()

QgsTextFormat QgsRasterLayerSimpleLabeling::textFormat ( ) const

Returns the text format used for rendering the labels.

See also
setTextFormat()

Definition at line 518 of file qgsrasterlabeling.cpp.

◆ thinningSettings() [1/2]

QgsLabelThinningSettings & QgsRasterLayerSimpleLabeling::thinningSettings ( )
inline

Returns the label thinning settings.

See also
setThinningSettings()

Definition at line 385 of file qgsrasterlabeling.h.

◆ thinningSettings() [2/2]

const QgsLabelThinningSettings & QgsRasterLayerSimpleLabeling::thinningSettings ( ) const
inline

Returns the label thinning settings.

See also
setThinningSettings()
Note
Not available in Python bindings

Definition at line 379 of file qgsrasterlabeling.h.

◆ type()

QString QgsRasterLayerSimpleLabeling::type ( ) const
overridevirtual

Unique type string of the labeling configuration implementation.

Implements QgsAbstractRasterLayerLabeling.

Definition at line 364 of file qgsrasterlabeling.cpp.

◆ zIndex()

double QgsRasterLayerSimpleLabeling::zIndex ( ) const

Returns the Z-Index of the labels.

Labels with a higher z-index are rendered on top of labels with a lower z-index.

See also
setZIndex()

Definition at line 539 of file qgsrasterlabeling.cpp.


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