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

A labeling engine rule which prevents labels being placed too close to features from a different layer. More...

#include <qgslabelingenginerule_impl.h>

Inheritance diagram for QgsLabelingEngineRuleMinimumDistanceLabelToFeature:
Inheritance graph
[legend]

Public Member Functions

 QgsLabelingEngineRuleMinimumDistanceLabelToFeature ()
 
 ~QgsLabelingEngineRuleMinimumDistanceLabelToFeature () override
 
QgsLabelingEngineRuleMinimumDistanceLabelToFeatureclone () const override
 Creates a clone of this rule.
 
QString description () const override
 Returns a user-friendly description of the rule.
 
QString displayType () const override
 Returns a user-friendly, translated string representing the rule type.
 
QString id () const override
 Returns a string uniquely identifying the rule subclass.
 
- Public Member Functions inherited from QgsAbstractLabelingEngineRuleDistanceFromFeature
 QgsAbstractLabelingEngineRuleDistanceFromFeature ()
 
 ~QgsAbstractLabelingEngineRuleDistanceFromFeature () override
 
void alterCandidateCost (pal::LabelPosition *candidate, QgsLabelingEngineContext &context) const override
 Provides an opportunity for the rule to alter the cost for a candidate.
 
bool candidateIsIllegal (const pal::LabelPosition *candidate, QgsLabelingEngineContext &context) const override
 Returns true if a labeling candidate violates the rule and should be eliminated.
 
double cost () const
 Returns the penalty cost incurred when the rule is violated.
 
double distance () const
 Returns the acceptable distance threshold between labels and the features from the targetLayer().
 
Qgis::RenderUnit distanceUnit () const
 Returns the units for the distance between labels and the features from the targetLayer().
 
const QgsMapUnitScaledistanceUnitScale () const
 Returns the scaling for the distance between labels and the features from the targetLayer().
 
bool isAvailable () const override
 Returns true if the rule is available for use within the current QGIS environment.
 
QgsMapLayerlabeledLayer () const
 Returns the layer providing the labels.
 
bool prepare (QgsRenderContext &context) override
 Prepares the rule.
 
void readXml (const QDomElement &element, const QgsReadWriteContext &context) override
 Reads the rule properties from an XML element.
 
void resolveReferences (const QgsProject *project) override
 Resolves reference to layers from stored layer ID.
 
void setCost (double cost)
 Sets the penalty cost incurred when the rule is violated.
 
void setDistance (double distance)
 Sets the acceptable distance threshold between labels and the features from the targetLayer().
 
void setDistanceUnit (Qgis::RenderUnit unit)
 Sets the unit for the distance between labels and the features from the targetLayer().
 
void setDistanceUnitScale (const QgsMapUnitScale &scale)
 Sets the scale for the distance between labels and the features from the targetLayer().
 
void setLabeledLayer (QgsMapLayer *layer)
 Sets the layer providing the labels.
 
void setTargetLayer (QgsVectorLayer *layer)
 Sets the layer providing the features which labels must be distant from (or close to).
 
QgsVectorLayertargetLayer () const
 Returns the layer providing the features which labels must be distant from (or close to).
 
void writeXml (QDomDocument &doc, QDomElement &element, const QgsReadWriteContext &context) const override
 Writes the rule properties to an XML element.
 
- Public Member Functions inherited from QgsAbstractLabelingEngineRule
virtual ~QgsAbstractLabelingEngineRule ()
 
bool active () const
 Returns true if the rule is active.
 
virtual bool candidatesAreConflicting (const pal::LabelPosition *lp1, const pal::LabelPosition *lp2) const
 Returns true if a labeling candidate lp1 conflicts with lp2 after applying the rule.
 
virtual QgsRectangle modifyCandidateConflictSearchBoundingBox (const QgsRectangle &candidateBounds) const
 Returns a (possibly expanded) bounding box to use when searching for conflicts for a candidate.
 
QString name () const
 Returns the name for this instance of the rule.
 
void setActive (bool active)
 Sets whether the rule is active.
 
void setName (const QString &name)
 Sets the name for this instance of the rule.
 

Additional Inherited Members

- Protected Member Functions inherited from QgsAbstractLabelingEngineRuleDistanceFromFeature
void copyCommonProperties (QgsAbstractLabelingEngineRule *other) const override
 Copies common properties from this object to an other.
 
- Protected Attributes inherited from QgsAbstractLabelingEngineRuleDistanceFromFeature
bool mMustBeDistant = true
 true if labels must be distant from features, false if they must be close
 

Detailed Description

A labeling engine rule which prevents labels being placed too close to features from a different layer.

Since
QGIS 3.40

Definition at line 194 of file qgslabelingenginerule_impl.h.

Constructor & Destructor Documentation

◆ QgsLabelingEngineRuleMinimumDistanceLabelToFeature()

QgsLabelingEngineRuleMinimumDistanceLabelToFeature::QgsLabelingEngineRuleMinimumDistanceLabelToFeature ( )
default

◆ ~QgsLabelingEngineRuleMinimumDistanceLabelToFeature()

QgsLabelingEngineRuleMinimumDistanceLabelToFeature::~QgsLabelingEngineRuleMinimumDistanceLabelToFeature ( )
overridedefault

Member Function Documentation

◆ clone()

QgsLabelingEngineRuleMinimumDistanceLabelToFeature * QgsLabelingEngineRuleMinimumDistanceLabelToFeature::clone ( ) const
overridevirtual

Creates a clone of this rule.

The caller takes ownership of the returned object.

Implements QgsAbstractLabelingEngineRule.

Definition at line 245 of file qgslabelingenginerule_impl.cpp.

◆ description()

QString QgsLabelingEngineRuleMinimumDistanceLabelToFeature::description ( ) const
overridevirtual

Returns a user-friendly description of the rule.

This should include the rule name() if set, and other useful details for users to quickly identify the rule's purpose when shown in a tooltip.

The returned string may contain HTML formatting.

Reimplemented from QgsAbstractLabelingEngineRule.

Definition at line 262 of file qgslabelingenginerule_impl.cpp.

◆ displayType()

QString QgsLabelingEngineRuleMinimumDistanceLabelToFeature::displayType ( ) const
overridevirtual

Returns a user-friendly, translated string representing the rule type.

Implements QgsAbstractLabelingEngineRule.

Definition at line 257 of file qgslabelingenginerule_impl.cpp.

◆ id()

QString QgsLabelingEngineRuleMinimumDistanceLabelToFeature::id ( ) const
overridevirtual

Returns a string uniquely identifying the rule subclass.

Implements QgsAbstractLabelingEngineRule.

Definition at line 252 of file qgslabelingenginerule_impl.cpp.


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