|
QGIS API Documentation 3.99.0-Master (d270888f95f)
|
A labeling engine rule which prevents labels being placed too close to labels from a different layer. More...
#include <qgslabelingenginerule_impl.h>

Public Member Functions | |
| QgsLabelingEngineRuleMinimumDistanceLabelToLabel () | |
| ~QgsLabelingEngineRuleMinimumDistanceLabelToLabel () override | |
| bool | candidatesAreConflicting (const pal::LabelPosition *lp1, const pal::LabelPosition *lp2) const override |
Returns true if a labeling candidate lp1 conflicts with lp2 after applying the rule. | |
| QgsLabelingEngineRuleMinimumDistanceLabelToLabel * | clone () 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. | |
| double | distance () const |
| Returns the minimum permitted distance between labels from the labeledLayer() and the labels from the targetLayer(). | |
| Qgis::RenderUnit | distanceUnit () const |
| Returns the units for the distance between labels from the labeledLayer() and the labels from the targetLayer(). | |
| const QgsMapUnitScale & | distanceUnitScale () const |
| Returns the scaling for the distance between labels from the labeledLayer() and the labels from the targetLayer(). | |
| QString | id () const override |
| Returns a string uniquely identifying the rule subclass. | |
| bool | isAvailable () const override |
Returns true if the rule is available for use within the current QGIS environment. | |
| QgsMapLayer * | labeledLayer () const |
| Returns the layer providing the labels. | |
| QgsRectangle | modifyCandidateConflictSearchBoundingBox (const QgsRectangle &candidateBounds) const override |
| Returns a (possibly expanded) bounding box to use when searching for conflicts for a candidate. | |
| 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 | setDistance (double distance) |
| Sets the minimum permitted distance between labels from the labeledLayer() and the labels from the targetLayer(). | |
| void | setDistanceUnit (Qgis::RenderUnit unit) |
| Sets the unit for the distance between labels from the labeledLayer() and the labels from the targetLayer(). | |
| void | setDistanceUnitScale (const QgsMapUnitScale &scale) |
| Sets the scale for the distance between labels from the labeledLayer() and the labels from the targetLayer(). | |
| void | setLabeledLayer (QgsMapLayer *layer) |
| Sets the layer providing the labels. | |
| void | setTargetLayer (QgsMapLayer *layer) |
| Sets the layer providing the labels which labels must be distant from. | |
| QgsMapLayer * | targetLayer () const |
| Returns the layer providing the labels which labels must be distant from. | |
| 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 void | alterCandidateCost (pal::LabelPosition *candidate, QgsLabelingEngineContext &context) const |
| Provides an opportunity for the rule to alter the cost for a candidate. | |
| virtual bool | candidateIsIllegal (const pal::LabelPosition *candidate, QgsLabelingEngineContext &context) const |
Returns true if a labeling candidate violates the rule and should be eliminated. | |
| 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 QgsAbstractLabelingEngineRule | |
| virtual void | copyCommonProperties (QgsAbstractLabelingEngineRule *other) const |
| Copies common properties from this object to an other. | |
A labeling engine rule which prevents labels being placed too close to labels from a different layer.
Definition at line 260 of file qgslabelingenginerule_impl.h.
|
default |
|
overridedefault |
|
overridevirtual |
Returns true if a labeling candidate lp1 conflicts with lp2 after applying the rule.
The default implementation returns false.
Reimplemented from QgsAbstractLabelingEngineRule.
Definition at line 442 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Creates a clone of this rule.
The caller takes ownership of the returned object.
Implements QgsAbstractLabelingEngineRule.
Definition at line 335 of file qgslabelingenginerule_impl.cpp.
|
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 357 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Returns a user-friendly, translated string representing the rule type.
Implements QgsAbstractLabelingEngineRule.
Definition at line 352 of file qgslabelingenginerule_impl.cpp.
|
inline |
Returns the minimum permitted distance between labels from the labeledLayer() and the labels from the targetLayer().
Definition at line 321 of file qgslabelingenginerule_impl.h.
|
inline |
Returns the units for the distance between labels from the labeledLayer() and the labels from the targetLayer().
Definition at line 339 of file qgslabelingenginerule_impl.h.
|
inline |
Returns the scaling for the distance between labels from the labeledLayer() and the labels from the targetLayer().
Definition at line 357 of file qgslabelingenginerule_impl.h.
|
overridevirtual |
Returns a string uniquely identifying the rule subclass.
Implements QgsAbstractLabelingEngineRule.
Definition at line 347 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Returns true if the rule is available for use within the current QGIS environment.
The base class method returns true.
Rules can return false if required dependencies are not available, e.g. if a library version is too old for the rule.
Reimplemented from QgsAbstractLabelingEngineRule.
Definition at line 372 of file qgslabelingenginerule_impl.cpp.
| QgsMapLayer * QgsLabelingEngineRuleMinimumDistanceLabelToLabel::labeledLayer | ( | ) | const |
Returns the layer providing the labels.
Definition at line 475 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Returns a (possibly expanded) bounding box to use when searching for conflicts for a candidate.
The return value is permitted to grow the bounding box, but may NOT shrink it.
The default implementation returns the same bounds.
Reimplemented from QgsAbstractLabelingEngineRule.
Definition at line 437 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Prepares the rule.
This must be called on the main render thread, prior to commencing the render operation. Thread sensitive logic (such as creation of feature sources) can be performed in this method.
Implements QgsAbstractLabelingEngineRule.
Definition at line 431 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Reads the rule properties from an XML element.
Implements QgsAbstractLabelingEngineRule.
Definition at line 403 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Resolves reference to layers from stored layer ID.
Should be called following a call readXml().
Reimplemented from QgsAbstractLabelingEngineRule.
Definition at line 425 of file qgslabelingenginerule_impl.cpp.
|
inline |
Sets the minimum permitted distance between labels from the labeledLayer() and the labels from the targetLayer().
Definition at line 330 of file qgslabelingenginerule_impl.h.
|
inline |
Sets the unit for the distance between labels from the labeledLayer() and the labels from the targetLayer().
Definition at line 348 of file qgslabelingenginerule_impl.h.
|
inline |
Sets the scale for the distance between labels from the labeledLayer() and the labels from the targetLayer().
Definition at line 366 of file qgslabelingenginerule_impl.h.
| void QgsLabelingEngineRuleMinimumDistanceLabelToLabel::setLabeledLayer | ( | QgsMapLayer * | layer | ) |
Sets the layer providing the labels.
Definition at line 480 of file qgslabelingenginerule_impl.cpp.
| void QgsLabelingEngineRuleMinimumDistanceLabelToLabel::setTargetLayer | ( | QgsMapLayer * | layer | ) |
Sets the layer providing the labels which labels must be distant from.
Definition at line 490 of file qgslabelingenginerule_impl.cpp.
| QgsMapLayer * QgsLabelingEngineRuleMinimumDistanceLabelToLabel::targetLayer | ( | ) | const |
Returns the layer providing the labels which labels must be distant from.
Definition at line 485 of file qgslabelingenginerule_impl.cpp.
|
overridevirtual |
Writes the rule properties to an XML element.
Implements QgsAbstractLabelingEngineRule.
Definition at line 381 of file qgslabelingenginerule_impl.cpp.