QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
15 #ifndef QGSDIAGRAMRENDERER_H
16 #define QGSDIAGRAMRENDERER_H
18 #include "qgis_core.h"
25 #include <QDomDocument>
83 Q_DECLARE_FLAGS( LinePlacementFlags, LinePlacementFlag )
181 double zIndex()
const {
return mZIndex; }
280 void readXml(
const QDomElement &elem );
286 void writeXml( QDomElement &layerElem, QDomDocument &doc )
const;
334 Placement mPlacement = AroundPoint;
337 LinePlacementFlags mPlacementFlags =
OnLine;
347 double mZIndex = 0.0;
350 bool mObstacle =
false;
353 double mDistance = 0.0;
359 bool mShowAll =
true;
364 static void initPropertyDefinitions();
451 double penWidth = 0.0;
454 double barWidth = 5.0;
457 double opacity = 1.0;
459 bool scaleByArea =
true;
465 double rotationOffset = 270;
467 bool scaleBasedVisibility =
false;
475 double maximumScale = 0;
483 double minimumScale = 0;
486 double minimumSize = 0.0;
559 Direction direction()
const;
567 void setDirection( Direction direction );
611 bool showAxis()
const;
621 void setShowAxis(
bool showAxis );
648 Direction mDirection = Counterclockwise;
650 bool mShowAxis =
false;
651 std::unique_ptr< QgsLineSymbol > mAxisLineSymbol;
652 std::unique_ptr< QgsPaintEffect > mPaintEffect;
688 if ( sipCpp->rendererName() == QLatin1String(
"SingleCategory" ) )
689 sipType = sipType_QgsSingleCategoryDiagramRenderer;
690 else if ( sipCpp->rendererName() == QLatin1String(
"LinearlyInterpolated" ) )
691 sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer;
789 void convertSizeToMapUnits( QSizeF &size,
const QgsRenderContext &context )
const;
792 static int dpiPaintDevice(
const QPainter * );
806 void _writeXml( QDomElement &rendererElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
812 bool mShowAttributeLegend =
true;
828 QString rendererName()
const override {
return QStringLiteral(
"SingleCategory" ); }
871 QString
rendererName()
const override {
return QStringLiteral(
"LinearlyInterpolated" ); }
873 void setLowerValue(
double val ) { mInterpolationSettings.lowerValue = val; }
874 double lowerValue()
const {
return mInterpolationSettings.lowerValue; }
876 void setUpperValue(
double val ) { mInterpolationSettings.upperValue = val; }
877 double upperValue()
const {
return mInterpolationSettings.upperValue; }
879 void setLowerSize( QSizeF s ) { mInterpolationSettings.lowerSize = s; }
880 QSizeF
lowerSize()
const {
return mInterpolationSettings.lowerSize; }
882 void setUpperSize( QSizeF s ) { mInterpolationSettings.upperSize = s; }
883 QSizeF
upperSize()
const {
return mInterpolationSettings.upperSize; }
940 #endif // QGSDIAGRAMRENDERER_H
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool showAllDiagrams() const
Returns whether the layer should show all diagrams, including overlapping diagrams.
double upperValue() const
bool isObstacle() const
Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagram...
Base class for all diagram types.
@ StartAngle
Angle offset for pie diagram.
double lowerValue() const
std::unique_ptr< QgsDiagram > mDiagram
Reference to the object that does the real diagram rendering.
RenderUnit
Rendering size units.
QgsCoordinateTransform coordinateTransform() const
Returns the coordinate transform associated with the layer, or an invalid transform if no transformat...
QString classificationAttributeExpression() const
The class is used as a container of context for various read/write operations on other objects.
int priority() const
Returns the diagram priority.
void setSpacingMapUnitScale(const QgsMapUnitScale &scale)
Sets the map unit scale for the content spacing.
QgsDiagramRenderer * renderer()
Returns the diagram renderer associated with the layer.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the diagram's property collection, used for data defined overrides.
QList< QString > diagramAttributes() const override
Returns attribute indices needed for diagram rendering.
QList< QColor > categoryColors
QString classificationField() const
Returns the field name used for interpolating the diagram size.
@ Clockwise
Clockwise orientation.
MapOrientation
Signifies that the AboveLine and BelowLine flags should respect the map's orientation rather than the...
QgsSingleCategoryDiagramRenderer()=default
Constructor for QgsSingleCategoryDiagramRenderer.
AboveLine
Labels can be placed above a line feature.
virtual QSet< QString > referencedFields(const QgsExpressionContext &context=QgsExpressionContext()) const
Returns the set of any fields required for diagram rendering.
void setZIndex(double index)
Sets the diagram z-index.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend.
Contains information about the context of a rendering operation.
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the diagram's property collection, used for data defined overrides.
@ RenderMillimeters
Millimeters.
void setAttributeLegend(bool enabled)
Sets whether the renderer will show legend items for diagram attributes.
const QgsMapUnitScale & spacingMapUnitScale() const
Returns the map unit scale for the content spacing.
QString classificationField
Name of the field for classification.
@ Show
Whether to show the diagram.
virtual QString rendererName() const =0
@ PositionY
Y-coordinate data defined diagram position.
void setLowerValue(double val)
@ ZIndex
Z-index for diagram ordering.
DiagramOrientation
Orientation of histogram.
double spacing() const
Returns the spacing between diagram contents.
void setClassificationField(const QString &field)
Sets the field name used for interpolating the diagram size.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
void setShowAllDiagrams(bool showAllDiagrams)
Sets whether the layer should show all diagrams, including overlapping diagrams.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
void setDiagramSettings(const QgsDiagramSettings &s)
virtual QList< QString > diagramAttributes() const =0
Returns attribute indices needed for diagram rendering.
void setUpperSize(QSizeF s)
QString rendererName() const override
bool classificationAttributeIsExpression() const
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the diagram's property collection, used for data defined overrides.
virtual QList< QgsLayerTreeModelLegendNode * > legendItems(QgsLayerTreeLayer *nodeLayer) const
Returns list of legend nodes for the diagram.
@ Distance
Distance to diagram from feature.
const QgsDiagramRenderer * renderer() const
Returns the diagram renderer associated with the layer.
void setClassificationAttributeExpression(const QString &expression)
Layer tree node points to a map layer.
void setClassificationAttributeIsExpression(bool isExpression)
A line symbol type, for rendering LineString and MultiLineString geometries.
Stores the settings for rendering of all diagrams for a layer.
virtual QgsDiagramRenderer * clone() const =0
Returns new instance that is equivalent to this one.
bool attributeLegend() const
Returns true if renderer will show legend items for diagram attributes.
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
@ Counterclockwise
Counter-clockwise orientation.
@ BackgroundColor
Diagram background color.
Struct for storing maximum and minimum scales for measurements in map units.
virtual QList< QgsDiagramSettings > diagramSettings() const =0
Returns list with all diagram settings in the renderer.
void setUpperValue(double val)
Additional diagram settings for interpolated size rendering.
QgsDiagram * diagram() const
virtual void writeXml(QDomElement &layerElem, QDomDocument &doc, const QgsReadWriteContext &context) const =0
Writes diagram state to a DOM element.
Placement placement() const
Returns the diagram placement.
double zIndex() const
Returns the diagram z-index.
bool classificationAttributeIsExpression
OnLine
Labels can be placed directly over a line feature.
void setDiagramSettings(const QgsDiagramSettings &s)
QgsDiagramRenderer()=default
Constructor for QgsDiagramRenderer.
QgsMapUnitScale lineSizeScale
Line unit scale.
QList< QString > categoryLabels
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
Renders the diagrams for all features with the same settings.
void setSpacingUnit(QgsUnitTypes::RenderUnit unit)
Sets the unit for the content spacing.
LinePlacementFlags linePlacementFlags() const
Returns the diagram placement flags.
@ StrokeColor
Stroke color.
LinePlacementFlag
Line placement flags for controlling line based placements.
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
virtual void readXml(const QDomElement &elem, const QgsReadWriteContext &context)=0
Reads diagram state from a DOM element.
QgsMapUnitScale sizeScale
Diagram size unit scale.
Perform transforms between map coordinates and device coordinates.
double distance() const
Returns the distance between the diagram and the feature (in mm).
Represents a vector layer which manages a vector based data sets.
void setSpacing(double spacing)
Sets the spacing between diagram contents.
void setLinePlacementFlags(LinePlacementFlags flags)
Sets the the diagram placement flags.
Base class for visual effects which can be applied to QPicture drawings.
Direction
Angular directions.
A set of features which influence the labeling process.
void setPriority(int value)
Sets the diagram priority.
void setPlacement(Placement value)
Sets the diagram placement.
void setDistance(double distance)
Sets the distance between the diagram and the feature.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
@ AlwaysShow
Whether the diagram should always be shown, even if it overlaps other diagrams/labels.
virtual ~QgsDiagramRenderer()=default
@ PositionX
X-coordinate data defined diagram position.
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...
Property
Data definable properties.
QgsUnitTypes::RenderUnit spacingUnit() const
Returns the units for the content spacing.
@ StrokeWidth
Stroke width.
virtual QSizeF diagramSize(const QgsFeature &features, const QgsRenderContext &c) const =0
Returns size of the diagram (in painter units) or an invalid size in case of error.
QList< QString > categoryAttributes
@ IsObstacle
Whether diagram features act as obstacles for other diagrams/labels.
void setIsObstacle(bool isObstacle)
Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
@ Priority
Diagram priority (between 0 and 10)
BelowLine
Labels can be placed below a line feature.
QgsDiagramRenderer & operator=(const QgsDiagramRenderer &other)
QString classificationAttributeExpression
Stores the settings for rendering a single diagram.
void setLowerSize(QSizeF s)
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...