QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
core
diagram
qgsstackeddiagram.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgsstackediagram.cpp
3
---------------------
4
begin : June 2024
5
copyright : (C) 2024 by Germán Carrillo
6
email : german at opengis dot ch
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#include "
qgsstackeddiagram.h
"
16
17
#include "
qgsdiagramrenderer.h
"
18
#include "
qgsrendercontext.h
"
19
20
#include <QString>
21
22
using namespace
Qt::StringLiterals;
23
24
const
QString
QgsStackedDiagram::DIAGRAM_NAME_STACKED
= u
"StackedDiagram"
_s;
25
26
QgsStackedDiagram::QgsStackedDiagram
()
27
{}
28
29
QgsStackedDiagram
*
QgsStackedDiagram::clone
()
const
30
{
31
return
new
QgsStackedDiagram
( *
this
);
32
}
33
34
void
QgsStackedDiagram::subDiagramPosition
( QPointF &newPos,
const
QgsRenderContext
&
c
,
const
QgsDiagramSettings
&s,
const
QgsDiagramSettings
&subSettings )
35
{
36
QSizeF size =
sizePainterUnits
( subSettings.
size
, subSettings,
c
);
37
const
double
spacing =
c
.convertToPainterUnits( s.
stackedDiagramSpacing
(), s.
stackedDiagramSpacingUnit
(), s.
stackedDiagramSpacingMapUnitScale
() );
38
39
if
( s.
stackedDiagramMode
==
QgsDiagramSettings::Horizontal
)
40
{
41
newPos += QPointF( size.width() + spacing, 0 );
42
}
43
else
44
{
45
newPos -= QPointF( 0, size.height() + spacing );
46
}
47
}
48
49
QSizeF
QgsStackedDiagram::diagramSize
(
const
QgsFeature
&feature,
const
QgsRenderContext
&
c
,
const
QgsDiagramSettings
&s,
const
QgsDiagramInterpolationSettings
&is )
50
{
51
Q_UNUSED( feature )
52
Q_UNUSED(
c
)
53
Q_UNUSED( s )
54
Q_UNUSED( is )
55
return
QSize( 0, 0 );
56
}
57
58
double
QgsStackedDiagram::legendSize
(
double
value,
const
QgsDiagramSettings
&s,
const
QgsDiagramInterpolationSettings
&is )
const
59
{
60
Q_UNUSED( value )
61
Q_UNUSED( s )
62
Q_UNUSED( is )
63
return
0;
64
}
65
66
QString
QgsStackedDiagram::diagramName
()
const
67
{
68
return
QgsStackedDiagram::DIAGRAM_NAME_STACKED
;
69
}
70
71
QSizeF
QgsStackedDiagram::diagramSize
(
const
QgsAttributes
&attributes,
const
QgsRenderContext
&
c
,
const
QgsDiagramSettings
&s )
72
{
73
Q_UNUSED( attributes )
74
Q_UNUSED(
c
)
75
Q_UNUSED( s )
76
return
QSizeF( 0, 0 );
77
}
78
79
void
QgsStackedDiagram::renderDiagram
(
const
QgsFeature
&feature,
QgsRenderContext
&
c
,
const
QgsDiagramSettings
&s, QPointF position )
80
{
81
Q_UNUSED( feature )
82
Q_UNUSED(
c
)
83
Q_UNUSED( s )
84
Q_UNUSED( position )
85
}
QgsAttributes
A vector of attributes.
Definition
qgsattributes.h:57
QgsDiagramInterpolationSettings
Additional diagram settings for interpolated size rendering.
Definition
qgsdiagramrenderer.h:718
QgsDiagramSettings
Stores the settings for rendering a single diagram.
Definition
qgsdiagramrenderer.h:367
QgsDiagramSettings::stackedDiagramMode
StackedDiagramMode stackedDiagramMode
Definition
qgsdiagramrenderer.h:442
QgsDiagramSettings::stackedDiagramSpacingUnit
Qgis::RenderUnit stackedDiagramSpacingUnit() const
Returns the units for the spacing between subdiagrams in a stacked diagram.
Definition
qgsdiagramrenderer.h:585
QgsDiagramSettings::Horizontal
@ Horizontal
Definition
qgsdiagramrenderer.h:400
QgsDiagramSettings::stackedDiagramSpacingMapUnitScale
const QgsMapUnitScale & stackedDiagramSpacingMapUnitScale() const
Returns the map unit scale for the spacing between subdiagrams in a stacked diagram.
Definition
qgsdiagramrenderer.h:605
QgsDiagramSettings::stackedDiagramSpacing
double stackedDiagramSpacing() const
Returns the spacing between subdiagrams in a stacked diagram.
Definition
qgsdiagramrenderer.h:552
QgsDiagramSettings::size
QSizeF size
Definition
qgsdiagramrenderer.h:415
QgsDiagram::sizePainterUnits
QSizeF sizePainterUnits(QSizeF size, const QgsDiagramSettings &s, const QgsRenderContext &c)
Calculates a size to match the current settings and rendering context.
Definition
qgsdiagram.cpp:57
QgsFeature
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition
qgsfeature.h:60
QgsRenderContext
Contains information about the context of a rendering operation.
Definition
qgsrendercontext.h:63
QgsStackedDiagram::DIAGRAM_NAME_STACKED
static const QString DIAGRAM_NAME_STACKED
Definition
qgsstackeddiagram.h:38
QgsStackedDiagram::clone
QgsStackedDiagram * clone() const override
Returns an instance that is equivalent to this one.
Definition
qgsstackeddiagram.cpp:29
QgsStackedDiagram::subDiagramPosition
void subDiagramPosition(QPointF &newPos, const QgsRenderContext &c, const QgsDiagramSettings &s, const QgsDiagramSettings &subSettings)
Calculates the position for the next subdiagram, updating the newPos object.
Definition
qgsstackeddiagram.cpp:34
QgsStackedDiagram::diagramSize
QSizeF diagramSize(const QgsAttributes &attributes, const QgsRenderContext &c, const QgsDiagramSettings &s) override
Returns the size in map units the diagram will use to render.
Definition
qgsstackeddiagram.cpp:71
QgsStackedDiagram::renderDiagram
void renderDiagram(const QgsFeature &feature, QgsRenderContext &c, const QgsDiagramSettings &s, QPointF position) override
Draws the diagram at the given position (in pixel coordinates).
Definition
qgsstackeddiagram.cpp:79
QgsStackedDiagram::diagramName
QString diagramName() const override
Gets a descriptive name for this diagram type.
Definition
qgsstackeddiagram.cpp:66
QgsStackedDiagram::QgsStackedDiagram
QgsStackedDiagram()
Definition
qgsstackeddiagram.cpp:26
QgsStackedDiagram::legendSize
double legendSize(double value, const QgsDiagramSettings &s, const QgsDiagramInterpolationSettings &is) const override
Returns the size of the legend item for the diagram corresponding to a specified value.
Definition
qgsstackeddiagram.cpp:58
c
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
Definition
porting_processing.dox:1
qgsdiagramrenderer.h
qgsrendercontext.h
qgsstackeddiagram.h
Generated on
for QGIS API Documentation by
1.17.0