@@ -25,13 +25,14 @@ class QgsDiagramLayerSettings
2525 };
2626
2727 // ! Line placement flags for controlling line based placements
28- enum LinePlacementFlags
28+ enum LinePlacementFlag
2929 {
3030 OnLine,
3131 AboveLine,
3232 BelowLine,
3333 MapOrientation,
3434 };
35+ typedef QFlags<QgsDiagramLayerSettings::LinePlacementFlag> LinePlacementFlags;
3536
3637 QgsDiagramLayerSettings ();
3738
@@ -44,8 +45,7 @@ class QgsDiagramLayerSettings
4445 * @see setPlacement()
4546 * @note added in QGIS 2.16
4647 */
47- // TODO QGIS 3.0 - rename getter to placement()
48- Placement getPlacement () const ;
48+ Placement placement () const ;
4949
5050 /* * Sets the diagram placement.
5151 * @param value placement value
@@ -54,28 +54,20 @@ class QgsDiagramLayerSettings
5454 */
5555 void setPlacement ( Placement value );
5656
57- // ! Diagram placement
58- // TODO QGIS 3.0 - make private, rename to mPlacement
59- Placement placement;
60-
6157 /* * Returns the diagram placement flags. These are only used if the diagram placement
6258 * is set to a line type.
6359 * @see setLinePlacementFlags()
6460 * @note added in QGIS 2.16
6561 */
66- unsigned int linePlacementFlags () const ;
62+ LinePlacementFlags linePlacementFlags () const ;
6763
6864 /* * Sets the the diagram placement flags. These are only used if the diagram placement
6965 * is set to a line type.
7066 * @param flags placement value
7167 * @see getPlacement()
7268 * @note added in QGIS 2.16
7369 */
74- void setLinePlacementFlags ( unsigned int flags );
75-
76- // ! Diagram placement flags
77- // TODO QGIS 3.0 - make private, rename to mPlacementFlags, use QFlags
78- unsigned int placementFlags;
70+ void setLinePlacementFlags ( LinePlacementFlags flags );
7971
8072 /* * Returns the diagram priority.
8173 * @returns diagram priority, where 0 = low and 10 = high
@@ -84,8 +76,7 @@ class QgsDiagramLayerSettings
8476 * @see setPriority()
8577 * @note added in QGIS 2.16
8678 */
87- // TODO QGIS 3.0 - rename getter to priority()
88- int getPriority () const ;
79+ int priority () const ;
8980
9081 /* * Sets the diagram priority.
9182 * @param value priority, where 0 = low and 10 = high
@@ -94,21 +85,14 @@ class QgsDiagramLayerSettings
9485 */
9586 void setPriority ( int value );
9687
97- // ! Placement priority, where 0 = low and 10 = high
98- // ! @note placement priority is shared with labeling, so diagrams with a high priority may displace labels
99- // ! and vice-versa
100- // TODO QGIS 3.0 - make private, rename to mPriority
101- int priority;
102-
10388 /* * Returns the diagram z-index. Diagrams (or labels) with a higher z-index are drawn over diagrams
10489 * with a lower z-index.
10590 * @note z-index ordering is shared with labeling, so diagrams with a high z-index may be drawn over labels
10691 * with a low z-index and vice-versa
10792 * @see setZIndex()
10893 * @note added in QGIS 2.16
10994 */
110- // TODO QGIS 3.0 - rename getter to zIndex()
111- double getZIndex () const ;
95+ double zIndex () const ;
11296
11397 /* * Sets the diagram z-index. Diagrams (or labels) with a higher z-index are drawn over diagrams
11498 * with a lower z-index.
@@ -118,10 +102,6 @@ class QgsDiagramLayerSettings
118102 */
119103 void setZIndex ( double index );
120104
121- // ! Z-index of diagrams, where diagrams with a higher z-index are drawn on top of diagrams with a lower z-index
122- // TODO QGIS 3.0 - rename to mZIndex, make private
123- double zIndex;
124-
125105 /* * Returns whether the feature associated with a diagram acts as an obstacle for other labels or diagrams.
126106 * @see setIsObstacle()
127107 * @note added in QGIS 2.16
@@ -135,10 +115,6 @@ class QgsDiagramLayerSettings
135115 */
136116 void setIsObstacle ( bool isObstacle );
137117
138- // ! Whether associated feature acts as an obstacle for other labels or diagrams
139- // TODO QGIS 3.0 - rename to mObstacle, make private
140- bool obstacle;
141-
142118 /* * Returns the distance between the diagram and the feature (in mm).
143119 * @see setDistance()
144120 * @note added in QGIS 2.16
@@ -152,35 +128,25 @@ class QgsDiagramLayerSettings
152128 */
153129 void setDistance ( double distance );
154130
155- // ! Distance between diagram and the feature (in mm)
156- // TODO QGIS 3.0 - make private, rename to mDistance
157- double dist;
158-
159131 /* * Returns the diagram renderer associated with the layer.
160132 * @see setRenderer()
161133 * @note added in QGIS 2.16
162134 */
163- // TODO QGIS 3.0 - rename to renderer()
164- QgsDiagramRenderer* getRenderer ();
135+ QgsDiagramRenderer* renderer ();
165136
166137 /* * Returns the diagram renderer associated with the layer.
167138 * @see setRenderer()
168139 * @note added in QGIS 2.16
169140 */
170- // TODO QGIS 3.0 - rename to renderer()
171- // const QgsDiagramRenderer* getRenderer() const;
141+ // const QgsDiagramRenderer* renderer() const;
172142
173143 /* * Sets the diagram renderer associated with the layer.
174144 * @param diagramRenderer diagram renderer. Ownership is transferred to the object.
175- * @see getRenderer ()
145+ * @see renderer ()
176146 * @note added in QGIS 2.16
177147 */
178148 void setRenderer ( QgsDiagramRenderer* diagramRenderer /Transfer/ );
179149
180- // ! Associated diagram renderer. Owned by this object.
181- // TODO QGIS 3.0 - make private, rename to mRenderer
182- QgsDiagramRenderer* renderer;
183-
184150 /* * Returns the coordinate transform associated with the layer, or an
185151 * invalid transform if no transformation is required.
186152 * @see setCoordinateTransform()
@@ -214,10 +180,6 @@ class QgsDiagramLayerSettings
214180 */
215181 void setShowAllDiagrams ( bool showAllDiagrams );
216182
217- // ! Whether to show all diagrams, including overlapping diagrams
218- // TODO QGIS 3.0 - make private, rename to mShowAll
219- bool showAll;
220-
221183 void readXml ( const QDomElement& elem, const QgsVectorLayer* layer );
222184 void writeXml ( QDomElement& layerElem, QDomDocument& doc, const QgsVectorLayer* layer ) const ;
223185
@@ -329,8 +291,8 @@ class QgsDiagramInterpolationSettings
329291 QSizeF upperSize;
330292 double lowerValue;
331293 double upperValue;
332- /* * Index of the classification attribute */
333- int classificationAttribute ;
294+ // ! Name of the field for classification
295+ QString classificationField ;
334296 QString classificationAttributeExpression;
335297 bool classificationAttributeIsExpression;
336298};
@@ -368,8 +330,7 @@ class QgsDiagramRenderer
368330 * @param fields layer fields
369331 * @note added in QGIS 2.16
370332 */
371- // TODO QGIS 3.0 - remove need for fields parameter
372- virtual QSet< QString > referencedFields ( const QgsExpressionContext& context = QgsExpressionContext(), const QgsFields& fields = QgsFields() ) const ;
333+ virtual QSet< QString > referencedFields ( const QgsExpressionContext& context = QgsExpressionContext() ) const ;
373334
374335 void renderDiagram ( const QgsFeature& feature, QgsRenderContext& c, QPointF pos );
375336
@@ -511,7 +472,7 @@ class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRenderer
511472
512473 QList<QString> diagramAttributes () const ;
513474
514- virtual QSet< QString > referencedFields ( const QgsExpressionContext& context = QgsExpressionContext(), const QgsFields& fields = QgsFields() ) const ;
475+ virtual QSet< QString > referencedFields ( const QgsExpressionContext& context = QgsExpressionContext() ) const ;
515476
516477 QString rendererName () const ;
517478
@@ -527,8 +488,19 @@ class QgsLinearlyInterpolatedDiagramRenderer : QgsDiagramRenderer
527488 void setUpperSize ( QSizeF s );
528489 QSizeF upperSize () const ;
529490
530- int classificationAttribute () const ;
531- void setClassificationAttribute ( int index );
491+ /* *
492+ * Returns the field name used for interpolating the diagram size.
493+ * @see setClassificationField()
494+ * @note added in QGIS 3.0
495+ */
496+ QString classificationField () const ;
497+
498+ /* *
499+ * Sets the field name used for interpolating the diagram size.
500+ * @see classificationField()
501+ * @note added in QGIS 3.0
502+ */
503+ void setClassificationField ( const QString& field );
532504
533505 QString classificationAttributeExpression () const ;
534506 void setClassificationAttributeExpression ( const QString& expression );
0 commit comments