QGIS API Documentation 3.41.0-Master (af5edcb665c)
|
Basic implementation of the labeling interface for raster layers. More...
#include <qgsrasterlabeling.h>
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. | |
QgsRasterLayerSimpleLabeling * | clone () 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 QgsNumericFormat * | numericFormat () const |
Returns the numeric format used for the labels. | |
QgsLabelPlacementSettings & | placementSettings () |
Returns the label placement settings. | |
const QgsLabelPlacementSettings & | placementSettings () const |
Returns the label placement settings. | |
double | priority () const |
Returns the priority of labels. | |
std::unique_ptr< QgsRasterLayerLabelProvider > | provider (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. | |
QgsLabelThinningSettings & | thinningSettings () |
Returns the label thinning settings. | |
const QgsLabelThinningSettings & | thinningSettings () 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 |
QgsAbstractRasterLayerLabeling & | operator= (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 QgsRasterLayerSimpleLabeling * | create (const QDomElement &element, const QgsReadWriteContext &context) |
Creates a QgsRasterLayerSimpleLabeling from a DOM element with saved configuration. | |
Static Public Member Functions inherited from QgsAbstractRasterLayerLabeling | |
static QgsAbstractRasterLayerLabeling * | createFromElement (const QDomElement &element, const QgsReadWriteContext &context) |
Tries to create an instance of an implementation based on the XML data. | |
static QgsAbstractRasterLayerLabeling * | defaultLabelingForLayer (QgsRasterLayer *layer) |
Creates default labeling for a raster layer. | |
Basic implementation of the labeling interface for raster layers.
Definition at line 273 of file qgsrasterlabeling.h.
|
explicit |
Definition at line 354 of file qgsrasterlabeling.cpp.
|
overridedefault |
|
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.
|
inline |
Returns the raster band to use for label values.
Definition at line 326 of file qgsrasterlabeling.h.
|
overridevirtual |
Returns a new copy of the object.
Implements QgsAbstractRasterLayerLabeling.
Definition at line 369 of file qgsrasterlabeling.cpp.
|
static |
Creates a QgsRasterLayerSimpleLabeling from a DOM element with saved configuration.
Definition at line 475 of file qgsrasterlabeling.cpp.
bool QgsRasterLayerSimpleLabeling::hasScaleBasedVisibility | ( | ) | const |
Returns whether scale based visibility is enabled for the labels.
Definition at line 569 of file qgsrasterlabeling.cpp.
|
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.
true
if the labels are visible at the given scale. Reimplemented from QgsAbstractRasterLayerLabeling.
Definition at line 574 of file qgsrasterlabeling.cpp.
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
.
Definition at line 549 of file qgsrasterlabeling.cpp.
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
.
Definition at line 559 of file qgsrasterlabeling.cpp.
|
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.
const QgsNumericFormat * QgsRasterLayerSimpleLabeling::numericFormat | ( | ) | const |
Returns the numeric format used for the labels.
Definition at line 528 of file qgsrasterlabeling.cpp.
|
inline |
Returns the label placement settings.
Definition at line 366 of file qgsrasterlabeling.h.
|
inline |
Returns the label placement settings.
Definition at line 360 of file qgsrasterlabeling.h.
|
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.
Definition at line 344 of file qgsrasterlabeling.h.
|
overridevirtual |
Creates a raster label provider corresponding to this object's configuration.
Implements QgsAbstractRasterLayerLabeling.
Definition at line 391 of file qgsrasterlabeling.cpp.
|
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.
Qgis::RasterResamplingMethod QgsRasterLayerSimpleLabeling::resampleMethod | ( | ) | const |
Returns the resampling method used when the raster labels are being resampled over neighboring pixels.
Definition at line 583 of file qgsrasterlabeling.cpp.
int QgsRasterLayerSimpleLabeling::resampleOver | ( | ) | const |
Returns the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.
Definition at line 593 of file qgsrasterlabeling.cpp.
|
overridevirtual |
Saves the labeling configuration to an XML element.
Implements QgsAbstractRasterLayerLabeling.
Definition at line 409 of file qgsrasterlabeling.cpp.
|
inline |
Sest the raster band to use for label values.
Definition at line 333 of file qgsrasterlabeling.h.
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
.
Definition at line 554 of file qgsrasterlabeling.cpp.
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
.
Definition at line 564 of file qgsrasterlabeling.cpp.
void QgsRasterLayerSimpleLabeling::setNumericFormat | ( | QgsNumericFormat * | format | ) |
Sets the numeric format used for the labels.
Ownership of format is transferred to the labeling.
Definition at line 533 of file qgsrasterlabeling.cpp.
|
inline |
Sets the label placement settings.
Definition at line 372 of file qgsrasterlabeling.h.
|
inline |
Sets the priority of labels.
This is a value between 0 to 1, where 0 = highest priority and 1 = lowest priority.
Definition at line 353 of file qgsrasterlabeling.h.
void QgsRasterLayerSimpleLabeling::setResampleMethod | ( | Qgis::RasterResamplingMethod | method | ) |
Sets the resampling method to use when the raster labels are being resampled over neighboring pixels.
Definition at line 588 of file qgsrasterlabeling.cpp.
void QgsRasterLayerSimpleLabeling::setResampleOver | ( | int | pixels | ) |
Sets the number of neighboring pixels to resample over, when labels are showing values resampled over neighboring pixels.
Definition at line 598 of file qgsrasterlabeling.cpp.
void QgsRasterLayerSimpleLabeling::setScaleBasedVisibility | ( | bool | enabled | ) |
Sets whether scale based visibility is enabled for the labels.
Definition at line 603 of file qgsrasterlabeling.cpp.
void QgsRasterLayerSimpleLabeling::setTextFormat | ( | const QgsTextFormat & | format | ) |
Sets the text format used for rendering the labels.
Definition at line 523 of file qgsrasterlabeling.cpp.
|
inline |
Sets the label thinning settings.
Definition at line 391 of file qgsrasterlabeling.h.
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.
Definition at line 544 of file qgsrasterlabeling.cpp.
QgsTextFormat QgsRasterLayerSimpleLabeling::textFormat | ( | ) | const |
Returns the text format used for rendering the labels.
Definition at line 518 of file qgsrasterlabeling.cpp.
|
inline |
Returns the label thinning settings.
Definition at line 385 of file qgsrasterlabeling.h.
|
inline |
Returns the label thinning settings.
Definition at line 379 of file qgsrasterlabeling.h.
|
overridevirtual |
Unique type string of the labeling configuration implementation.
Implements QgsAbstractRasterLayerLabeling.
Definition at line 364 of file qgsrasterlabeling.cpp.
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.
Definition at line 539 of file qgsrasterlabeling.cpp.