15#ifndef QGSDIAGRAMRENDERER_H
16#define QGSDIAGRAMRENDERER_H
25#include <QDomDocument>
80 MapOrientation = 1 << 4,
180 double zIndex()
const {
return mZIndex; }
267 void readXml(
const QDomElement &elem );
273 void writeXml( QDomElement &layerElem, QDomDocument &doc )
const;
316 Placement mPlacement = AroundPoint;
319 LinePlacementFlags mPlacementFlags = OnLine;
329 double mZIndex = 0.0;
332 bool mObstacle =
false;
335 double mDistance = 0.0;
341 bool mShowAll =
true;
346 static void initPropertyDefinitions();
436 double penWidth = 0.0;
440 double barWidth = 5.0;
443 double opacity = 1.0;
445 bool scaleByArea =
true;
450 double rotationOffset = 270;
452 bool scaleBasedVisibility =
false;
460 double maximumScale = 0;
468 double minimumScale = 0;
471 double minimumSize = 0.0;
618 void setDirection(
Direction direction );
661 bool showAxis()
const;
671 void setShowAxis(
bool showAxis );
699 double mStackedDiagramSpacing = 0;
705 bool mShowAxis =
false;
706 std::unique_ptr< QgsLineSymbol > mAxisLineSymbol;
707 std::unique_ptr< QgsPaintEffect > mPaintEffect;
743 if ( sipCpp->rendererName() == QLatin1String(
"SingleCategory" ) )
744 sipType = sipType_QgsSingleCategoryDiagramRenderer;
745 else if ( sipCpp->rendererName() == QLatin1String(
"LinearlyInterpolated" ) )
746 sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer;
747 else if ( sipCpp->rendererName() == QLatin1String(
"Stacked" ) )
748 sipType = sipType_QgsStackedDiagramRenderer;
842 void convertSizeToMapUnits( QSizeF &size,
const QgsRenderContext &context )
const;
845 static int dpiPaintDevice(
const QPainter * );
859 void _writeXml( QDomElement &rendererElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
865 bool mShowAttributeLegend =
true;
877 static const QString DIAGRAM_RENDERER_NAME_SINGLE_CATEGORY
SIP_SKIP;
889 QList<QgsDiagramSettings> diagramSettings()
const override;
892 void writeXml( QDomElement &layerElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
913 static const QString DIAGRAM_RENDERER_NAME_LINEARLY_INTERPOLATED
SIP_SKIP;
928 QList<QString> diagramAttributes()
const override;
934 void setLowerValue(
double val ) { mInterpolationSettings.lowerValue = val; }
935 double lowerValue()
const {
return mInterpolationSettings.lowerValue; }
937 void setUpperValue(
double val ) { mInterpolationSettings.upperValue = val; }
938 double upperValue()
const {
return mInterpolationSettings.upperValue; }
940 void setLowerSize( QSizeF s ) { mInterpolationSettings.lowerSize = s; }
941 QSizeF
lowerSize()
const {
return mInterpolationSettings.lowerSize; }
943 void setUpperSize( QSizeF s ) { mInterpolationSettings.upperSize = s; }
944 QSizeF
upperSize()
const {
return mInterpolationSettings.upperSize; }
965 void writeXml( QDomElement &layerElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
1003 static const QString DIAGRAM_RENDERER_NAME_STACKED
SIP_SKIP;
1029 QList<QString> diagramAttributes()
const override;
1034 void writeXml( QDomElement &layerElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
1046 void _writeXmlSubRenderers( QDomElement &rendererElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
1056 QList< QgsDiagramRenderer * > renderers(
bool sortByDiagramMode =
false )
const;
1076 int rendererCount()
const;
1084 QList< QgsDiagramRenderer * > mDiagramRenderers;
RenderUnit
Rendering size units.
@ Millimeters
Millimeters.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Additional diagram settings for interpolated size rendering.
bool classificationAttributeIsExpression
QString classificationField
Name of the field for classification.
QString classificationAttributeExpression
Stores the settings for rendering of all diagrams for a layer.
LinePlacementFlag
Line placement flags for controlling line based placements.
void setZIndex(double index)
Sets the diagram z-index.
Placement placement() const
Returns the diagram placement.
QgsCoordinateTransform coordinateTransform() const
Returns the coordinate transform associated with the layer, or an invalid transform if no transformat...
QFlags< LinePlacementFlag > LinePlacementFlags
bool showAllDiagrams() const
Returns whether the layer should show all diagrams, including overlapping diagrams.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the diagram's property collection, used for data defined overrides.
LinePlacementFlags linePlacementFlags() const
Returns the diagram placement flags.
Property
Data definable properties.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the diagram's property collection, used for data defined overrides.
void setShowAllDiagrams(bool showAllDiagrams)
Sets whether the layer should show all diagrams, including overlapping diagrams.
void setDistance(double distance)
Sets the distance between the diagram and the feature.
void setPriority(int value)
Sets the diagram priority.
int priority() const
Returns the diagram priority.
const QgsDiagramRenderer * renderer() const
Returns the diagram renderer associated with the layer.
void setIsObstacle(bool isObstacle)
Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
QgsDiagramRenderer * renderer()
Returns the diagram renderer associated with the layer.
bool isObstacle() const
Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagram...
void setPlacement(Placement value)
Sets the diagram placement.
void setLinePlacementFlags(LinePlacementFlags flags)
Sets the the diagram placement flags.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the diagram's property collection, used for data defined overrides.
double zIndex() const
Returns the diagram z-index.
double distance() const
Returns the distance between the diagram and the feature (in mm).
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
virtual QString rendererName() const =0
QgsDiagram * diagram() const
virtual QSizeF diagramSize(const QgsFeature &feature, const QgsRenderContext &c) const =0
Returns size of the diagram (in painter units) or an invalid size in case of error.
void setAttributeLegend(bool enabled)
Sets whether the renderer will show legend items for diagram attributes.
virtual bool diagramSettings(const QgsFeature &feature, const QgsRenderContext &c, QgsDiagramSettings &s) const =0
Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered...
virtual void writeXml(QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes diagram state to a DOM element.
virtual QList< QString > diagramAttributes() const =0
Returns attribute indices needed for diagram rendering.
std::unique_ptr< QgsDiagram > mDiagram
Reference to the object that does the real diagram rendering.
virtual ~QgsDiagramRenderer()=default
virtual QList< QgsDiagramSettings > diagramSettings() const =0
Returns list with all diagram settings in the renderer.
QgsDiagramRenderer()=default
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads diagram state from a DOM element.
bool attributeLegend() const
Returns true if renderer will show legend items for diagram attributes.
virtual QgsDiagramRenderer * clone() const =0
Returns new instance that is equivalent to this one.
Stores the settings for rendering a single diagram.
void setStackedDiagramSpacing(double spacing)
Sets the spacing between subdiagrams in a stacked diagram.
DiagramOrientation
Orientation of histogram.
void setStackedDiagramSpacingUnit(Qgis::RenderUnit unit)
Sets the unit for the spacing between subdiagrams in a stacked diagram.
void setSpacingUnit(Qgis::RenderUnit unit)
Sets the unit for the content spacing.
QList< QString > categoryAttributes
QList< QString > categoryLabels
Qgis::RenderUnit stackedDiagramSpacingUnit() const
Returns the units for the spacing between subdiagrams in a stacked diagram.
QgsMapUnitScale lineSizeScale
Line unit scale.
StackedDiagramMode
Orientation of the stacked diagrams.
double spacing() const
Returns the spacing between diagram contents.
QList< QColor > categoryColors
QgsMapUnitScale sizeScale
Diagram size unit scale.
const QgsMapUnitScale & stackedDiagramSpacingMapUnitScale() const
Returns the map unit scale for the spacing between subdiagrams in a stacked diagram.
void setSpacing(double spacing)
Sets the spacing between diagram contents.
void setSpacingMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the content spacing.
const QgsMapUnitScale & spacingMapUnitScale() const
Returns the map unit scale for the content spacing.
Direction
Angular directions.
@ Counterclockwise
Counter-clockwise orientation.
@ Clockwise
Clockwise orientation.
double stackedDiagramSpacing() const
Returns the spacing between subdiagrams in a stacked diagram.
void setStackedDiagramSpacingMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the spacing between subdiagrams in a stacked diagram.
Qgis::RenderUnit spacingUnit() const
Returns the units for the content spacing.
Base class for all diagram types.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Layer tree node points to a map layer.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
A line symbol type, for rendering LineString and MultiLineString geometries.
Alters the size of rendered diagrams using a linear scaling.
void setLowerValue(double val)
double upperValue() const
QString classificationAttributeExpression() const
double lowerValue() const
void setLowerSize(QSizeF s)
QString classificationField() const
Returns the field name used for interpolating the diagram size.
void setClassificationAttributeExpression(const QString &expression)
bool classificationAttributeIsExpression() const
QString rendererName() const override
void setClassificationField(const QString &field)
Sets the field name used for interpolating the diagram size.
void setClassificationAttributeIsExpression(bool isExpression)
void setUpperSize(QSizeF s)
void setUpperValue(double val)
static const QString DIAGRAM_RENDERER_NAME_LINEARLY_INTERPOLATED
Perform transforms between map coordinates and device coordinates.
Struct for storing maximum and minimum scales for measurements in map units.
Base class for visual effects which can be applied to QPicture drawings.
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
The class is used as a container of context for various read/write operations on other objects.
Contains information about the context of a rendering operation.
Renders the diagrams for all features with the same settings.
void setDiagramSettings(const QgsDiagramSettings &s)
QgsSingleCategoryDiagramRenderer()=default
static const QString DIAGRAM_RENDERER_NAME_SINGLE_CATEGORY
QList< QString > diagramAttributes() const override
Returns attribute indices needed for diagram rendering.
Renders diagrams using mixed diagram render types.
static const QString DIAGRAM_RENDERER_NAME_STACKED
QString rendererName() const override
QgsStackedDiagramRenderer()=default
Represents a vector layer which manages a vector based data sets.
A set of features which influence the labeling process.
As part of the API refactoring and improvements which landed in the Processing API was substantially reworked from the x version This was done in order to allow much of the underlying Processing framework to be ported into c
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
#define SIP_ENUM_BASETYPE(type)
#define SIP_MONKEYPATCH_SCOPEENUM_UNNEST(OUTSIDE_CLASS, FORMERNAME)
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.