20 #include "qgis_core.h" 53 sipType = sipType_QgsSimpleLineCallout;
57 sipType = sipType_QgsManhattanLineCallout;
88 PoleOfInaccessibility = 0,
103 virtual QString type()
const = 0;
133 virtual void readProperties(
const QVariantMap &props,
const QgsReadWriteContext &context );
142 virtual bool saveProperties( QDomDocument &doc, QDomElement &element,
const QgsReadWriteContext &context )
const;
151 virtual void restoreProperties(
const QDomElement &element,
const QgsReadWriteContext &context );
180 virtual QSet< QString > referencedFields(
const QgsRenderContext &context )
const;
198 bool allFeaturePartsLabeled =
false;
234 void setEnabled(
bool enabled );
284 static QString encodeAnchorPoint(
AnchorPoint anchor );
320 bool mEnabled =
false;
330 static void initPropertyDefinitions();
362 QString
type()
const override;
544 std::unique_ptr< QgsLineSymbol > mLineSymbol;
545 double mMinCalloutLength = 0;
549 double mOffsetFromAnchorDistance = 0;
553 double mOffsetFromLabelDistance = 0;
557 bool mDrawCalloutToAllParts =
false;
590 QString
type()
const override;
604 #endif // QGSCALLOUT_H void setOffsetFromLabelUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from label area distance.
QgsUnitTypes::RenderUnit minimumLengthUnit() const
Returns the units for the minimum length of callout lines.
The class is used as a container of context for various read/write operations on other objects...
double offsetFromLabel() const
Returns the offset distance from label area at which to end the line.
Abstract base class for callout renderers.
void setMinimumLengthUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the minimum length of callout lines.
const QgsMapUnitScale & offsetFromAnchorMapUnitScale() const
Returns the map unit scale for the offset from anchor.
Minimum length of callouts.
virtual void stopRender(QgsRenderContext &context)
Finalises the callout after a set of rendering operations on the specified render context...
Distance to offset lines from anchor points.
Property
Data definable properties.
QgsUnitTypes::RenderUnit offsetFromAnchorUnit() const
Returns the units for the offset from anchor point.
Contains additional contextual information about the context in which a callout is being rendered...
virtual void draw(QgsRenderContext &context, QRectF bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCalloutContext &calloutContext)=0
Performs the actual rendering of the callout implementation onto the specified render context...
void setOffsetFromAnchorMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from anchor.
virtual QgsCallout * clone() const =0
Duplicates a callout by creating a deep copy of the callout.
void draw(QgsRenderContext &context, QRectF bodyBoundingBox, const double angle, const QgsGeometry &anchor, QgsCallout::QgsCalloutContext &calloutContext) override
Performs the actual rendering of the callout implementation onto the specified render context...
QString type() const override
Returns a unique string representing the callout type.
The surface's centroid is used as anchor for polygon geometries.
A geometry is the spatial representation of a feature.
Feature's anchor point position.
const QgsMapUnitScale & minimumLengthMapUnitScale() const
Returns the map unit scale for the minimum callout length.
void setMinimumLength(double length)
Sets the minimum length of callout lines.
const QgsMapUnitScale & offsetFromLabelMapUnitScale() const
Returns the map unit scale for the minimum callout length.
void setAnchorPoint(AnchorPoint anchor)
Sets the feature's anchor point position.
double ANALYSIS_EXPORT angle(QgsPoint *p1, QgsPoint *p2, QgsPoint *p3, QgsPoint *p4)
Calculates the angle between two segments (in 2 dimension, z-values are ignored)
A line symbol type, for rendering LineString and MultiLineString geometries.
void setDrawCalloutToAllParts(bool drawToAllParts)
Sets whether callout lines should be drawn to all feature parts.
virtual QSet< QString > referencedFields(const QgsRenderContext &context) const
Returns the set of attributes referenced by the callout.
void setOffsetFromAnchor(double distance)
Sets the offset distance from the anchor point at which to start the line.
Render callouts below their individual associated labels, some callouts may be drawn over other label...
QgsSimpleLineCallout & operator=(const QgsSimpleLineCallout &)=delete
bool drawCalloutToAllParts() const
Returns true if callout lines should be drawn to all feature parts.
Render callouts below all labels.
virtual void startRender(QgsRenderContext &context)
Prepares the callout for rendering on the specified render context.
Draws straight (right angled) lines as callouts.
Distance to offset lines from label area.
A simple direct line callout style.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
void setOffsetFromLabel(double distance)
Sets the offset distance from label area at which to end the line.
void setOffsetFromAnchorUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the offset from anchor distance.
A point on the surface's outline closest to the label is used as anchor for polygon geometries...
QgsUnitTypes::RenderUnit offsetFromLabelUnit() const
Returns the units for the offset from label area.
void setMinimumLengthMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the minimum callout length.
virtual QString type() const =0
Returns a unique string representing the callout type.
Whether callout lines should be drawn to all feature parts.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the callout's property collection, used for data defined overrides.
double offsetFromAnchor() const
Returns the offset distance from the anchor point at which to start the line.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the callout's property collection, used for data defined overrides.
Contains information about the context of a rendering operation.
bool enabled() const
Returns true if the the callout is enabled.
Struct for storing maximum and minimum scales for measurements in map units.
void setOffsetFromLabelMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the offset from label area.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
double minimumLength() const
Returns the minimum length of callout lines.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
AnchorPoint
Feature's anchor point position.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the callout's property collection, used for data defined overrides.
virtual void readProperties(const QVariantMap &props, const QgsReadWriteContext &context)
Reads a string map of an callout's properties and restores the callout to the state described by the ...
AnchorPoint anchorPoint() const
Returns the feature's anchor point position.
DrawOrder
Options for draw order (stacking) of callouts.
virtual QVariantMap properties(const QgsReadWriteContext &context) const
Returns the properties describing the callout encoded in a string format.
A point guaranteed to be on the surface is used as anchor for polygon geometries. ...
RenderUnit
Rendering size units.
static QgsCallout * create(const QVariantMap &properties=QVariantMap(), const QgsReadWriteContext &context=QgsReadWriteContext())
Creates a new QgsSimpleLineCallout, using the settings serialized in the properties map (correspondin...
QgsSimpleLineCallout * clone() const override
Duplicates a callout by creating a deep copy of the callout.
record about vertex coordinates and index of anchor to which it is snapped