15 #ifndef QGSDIAGRAMRENDERERV2_H 16 #define QGSDIAGRAMRENDERERV2_H 18 #include "qgis_core.h" 25 #include <QDomDocument> 79 MapOrientation = 1 << 4,
179 double zIndex()
const {
return mZIndex; }
278 void readXml(
const QDomElement &elem );
284 void writeXml( QDomElement &layerElem, QDomDocument &doc )
const;
335 LinePlacementFlags mPlacementFlags = OnLine;
345 double mZIndex = 0.0;
348 bool mObstacle =
false;
351 double mDistance = 0.0;
357 bool mShowAll =
true;
362 static void initPropertyDefinitions();
433 double penWidth = 0.0;
436 double barWidth = 5.0;
439 double opacity = 1.0;
441 bool scaleByArea =
true;
447 double rotationOffset = 270;
449 bool scaleBasedVisibility =
false;
457 double maximumScale = 0;
465 double minimumScale = 0;
468 double minimumSize = 0.0;
471 void readXml(
const QDomElement &elem );
473 void writeXml( QDomElement &rendererElem, QDomDocument &doc )
const;
516 if ( sipCpp->rendererName() == QStringLiteral(
"SingleCategory" ) )
517 sipType = sipType_QgsSingleCategoryDiagramRenderer;
518 else if ( sipCpp->rendererName() == QStringLiteral(
"LinearlyInterpolated" ) )
519 sipType = sipType_QgsLinearlyInterpolatedDiagramRenderer;
541 virtual QString rendererName()
const = 0;
544 virtual QList<QString> diagramAttributes()
const = 0;
562 virtual QList<QgsDiagramSettings> diagramSettings()
const = 0;
576 virtual void writeXml( QDomElement &layerElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const = 0;
616 void convertSizeToMapUnits( QSizeF &size,
const QgsRenderContext &context )
const;
619 static int dpiPaintDevice(
const QPainter * );
633 void _writeXml( QDomElement &rendererElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const;
639 bool mShowAttributeLegend =
true;
655 QString
rendererName()
const override {
return QStringLiteral(
"SingleCategory" ); }
661 QList<QgsDiagramSettings> diagramSettings()
const override;
664 void writeXml( QDomElement &layerElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
690 QList<QgsDiagramSettings> diagramSettings()
const override;
694 QList<QString> diagramAttributes()
const override;
698 QString
rendererName()
const override {
return QStringLiteral(
"LinearlyInterpolated" ); }
700 void setLowerValue(
double val ) { mInterpolationSettings.lowerValue = val; }
701 double lowerValue()
const {
return mInterpolationSettings.lowerValue; }
703 void setUpperValue(
double val ) { mInterpolationSettings.upperValue = val; }
704 double upperValue()
const {
return mInterpolationSettings.upperValue; }
706 void setLowerSize( QSizeF s ) { mInterpolationSettings.lowerSize = s; }
707 QSizeF
lowerSize()
const {
return mInterpolationSettings.lowerSize; }
709 void setUpperSize( QSizeF s ) { mInterpolationSettings.upperSize = s; }
710 QSizeF
upperSize()
const {
return mInterpolationSettings.upperSize; }
733 void writeXml( QDomElement &layerElem, QDomDocument &doc,
const QgsReadWriteContext &context )
const override;
765 #endif // QGSDIAGRAMRENDERERV2_H void setClassificationAttributeIsExpression(bool isExpression)
The class is used as a container of context for various read/write operations on other objects...
y-coordinate data defined diagram position
Property
Data definable properties.
double zIndex() const
Returns the diagram z-index.
void setClassificationAttributeExpression(const QString &expression)
double distance() const
Returns the distance between the diagram and the feature (in mm).
Diagram background color.
Renders the diagrams for all features with the same settings.
QList< QString > categoryAttributes
bool classificationAttributeIsExpression
QgsDiagramRenderer * renderer()
Returns the diagram renderer associated with the layer.
A set of features which influence the labeling process.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the diagram's property collection, used for data defined overrides.
bool attributeLegend() const
Returns true if renderer will show legend items for diagram attributes.
Whether the diagram should always be shown, even if it overlaps other diagrams/labels.
void setZIndex(double index)
Sets the diagram z-index.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
Z-index for diagram ordering.
const QgsPropertyCollection & dataDefinedProperties() const
Returns a reference to the diagram's property collection, used for data defined overrides.
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
void setDataDefinedProperties(const QgsPropertyCollection &collection)
Sets the diagram's property collection, used for data defined overrides.
Perform transforms between map coordinates and device coordinates.
Diagram priority (between 0 and 10)
double lowerValue() const
bool isObstacle() const
Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagram...
QList< QString > diagramAttributes() const override
Returns attribute indices needed for diagram rendering.
void setShowAllDiagrams(bool showAllDiagrams)
Sets whether the layer should show all diagrams, including overlapping diagrams.
void setDiagramSettings(const QgsDiagramSettings &s)
Evaluates and returns the diagram settings relating to a diagram for a specific feature.
void setAttributeLegend(bool enabled)
Sets whether the renderer will show legend items for diagram attributes.
QString classificationAttributeExpression
void setLowerValue(double val)
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsMapUnitScale sizeScale
Diagram size unit scale.
DiagramOrientation
Orientation of histogram.
void setClassificationField(const QString &field)
Sets the field name used for interpolating the diagram size.
x-coordinate data defined diagram position
QgsDiagram * diagram() const
QString classificationField() const
Returns the field name used for interpolating the diagram size.
Whether diagram features act as obstacles for other diagrams/labels.
LinePlacementFlags linePlacementFlags() const
Returns the diagram placement flags.
std::unique_ptr< QgsDiagram > mDiagram
Reference to the object that does the real diagram rendering.
Placement placement() const
Returns the diagram placement.
QString rendererName() const override
Base class for all diagram types.
QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition
Definition of available properties.
void setUpperSize(QSizeF s)
Stores the settings for rendering of all diagrams for a layer.
QString rendererName() const override
void setPriority(int value)
Sets the diagram priority.
Additional diagram settings for interpolated size rendering.
Contains information about the context of a rendering operation.
Distance to diagram from feature.
void setLinePlacementFlags(LinePlacementFlags flags)
Sets the the diagram placement flags.
Struct for storing maximum and minimum scales for measurements in map units.
bool showAllDiagrams() const
Returns whether the layer should show all diagrams, including overlapping diagrams.
bool classificationAttributeIsExpression() const
QString classificationField
Name of the field for classification.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
void setPlacement(Placement value)
Sets the diagram placement.
The QgsLegendRendererItem class is abstract interface for legend items returned from QgsMapLayerLegen...
A grouped map of multiple QgsProperty objects, each referenced by a integer key value.
QList< QString > categoryLabels
Whether to show the diagram.
LinePlacementFlag
Line placement flags for controlling line based placements.
QgsMapUnitScale lineSizeScale
Line unit scale.
void setDiagramSettings(const QgsDiagramSettings &s)
QString classificationAttributeExpression() const
QgsCoordinateTransform coordinateTransform() const
Returns the coordinate transform associated with the layer, or an invalid transform if no transformat...
Represents a vector layer which manages a vector based data sets.
Object that keeps configuration of appearance of marker symbol's data-defined size in legend...
QList< QColor > categoryColors
double upperValue() const
void setLowerSize(QSizeF s)
const QgsDiagramRenderer * renderer() const
Returns the diagram renderer associated with the layer.
Stores the settings for rendering a single diagram.
int priority() const
Returns the diagram priority.
RenderUnit
Rendering size units.
Layer tree node points to a map layer.
void setIsObstacle(bool isObstacle)
Sets whether the feature associated with a diagram acts as an obstacle for other labels or diagrams...
void setDistance(double distance)
Sets the distance between the diagram and the feature.
void setUpperValue(double val)