@@ -73,13 +73,15 @@ class CORE_EXPORT QgsDiagramLayerSettings
7373 {
7474 }
7575
76+ ~QgsDiagramLayerSettings ();
77+
7678 // pal placement properties
7779 Placement placement;
7880 LinePlacementFlags placementFlags;
7981 int priority; // 0 = low, 10 = high
8082 bool obstacle; // whether it's an obstacle
8183 double dist; // distance from the feature (in mm)
82- QgsDiagramRendererV2* renderer;
84+ QgsDiagramRendererV2* renderer; // if any renderer is assigned, it is owned by this class
8385
8486 // assigned when layer gets prepared
8587 pal::Layer* palLayer;
@@ -167,6 +169,10 @@ class CORE_EXPORT QgsDiagramRendererV2
167169 QgsDiagramRendererV2 ();
168170 virtual ~QgsDiagramRendererV2 ();
169171
172+ /* * Returns new instance that is equivalent to this one
173+ * @note added in 2.1 */
174+ virtual QgsDiagramRendererV2* clone () const = 0;
175+
170176 /* *Returns size of the diagram for feature f in map units. Returns an invalid QSizeF in case of error*/
171177 virtual QSizeF sizeMapUnits ( const QgsAttributes& attributes, const QgsRenderContext& c );
172178
@@ -187,6 +193,7 @@ class CORE_EXPORT QgsDiagramRendererV2
187193 virtual void writeXML ( QDomElement& layerElem, QDomDocument& doc, const QgsVectorLayer* layer ) const = 0;
188194
189195 protected:
196+ QgsDiagramRendererV2 ( const QgsDiagramRendererV2& other );
190197
191198 /* *Returns diagram settings for a feature (or false if the diagram for the feature is not to be rendered). Used internally within renderDiagram()
192199 * @param att attribute map
@@ -219,6 +226,8 @@ class CORE_EXPORT QgsSingleCategoryDiagramRenderer : public QgsDiagramRendererV2
219226 QgsSingleCategoryDiagramRenderer ();
220227 ~QgsSingleCategoryDiagramRenderer ();
221228
229+ QgsDiagramRendererV2* clone () const ;
230+
222231 QString rendererName () const { return " SingleCategory" ; }
223232
224233 QList<int > diagramAttributes () const { return mSettings .categoryIndices ; }
@@ -245,6 +254,8 @@ class CORE_EXPORT QgsLinearlyInterpolatedDiagramRenderer : public QgsDiagramRend
245254 QgsLinearlyInterpolatedDiagramRenderer ();
246255 ~QgsLinearlyInterpolatedDiagramRenderer ();
247256
257+ QgsDiagramRendererV2* clone () const ;
258+
248259 /* *Returns list with all diagram settings in the renderer*/
249260 QList<QgsDiagramSettings> diagramSettings () const ;
250261
0 commit comments