QGIS API Documentation  2.6.0-Brighton
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsfillsymbollayerv2.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgsfillsymbollayerv2.h
3  ---------------------
4  begin : November 2009
5  copyright : (C) 2009 by Martin Dobias
6  email : wonder dot sk at gmail dot com
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 
16 #ifndef QGSFILLSYMBOLLAYERV2_H
17 #define QGSFILLSYMBOLLAYERV2_H
18 
19 #include "qgssymbollayerv2.h"
20 
21 #define DEFAULT_SIMPLEFILL_COLOR QColor(0,0,255)
22 #define DEFAULT_SIMPLEFILL_STYLE Qt::SolidPattern
23 #define DEFAULT_SIMPLEFILL_BORDERCOLOR QColor(0,0,0)
24 #define DEFAULT_SIMPLEFILL_BORDERSTYLE Qt::SolidLine
25 #define DEFAULT_SIMPLEFILL_BORDERWIDTH DEFAULT_LINE_WIDTH
26 #define DEFAULT_SIMPLEFILL_JOINSTYLE Qt::BevelJoin
27 
28 #define INF 1E20
29 
30 #include <QPen>
31 #include <QBrush>
32 
34 {
35  public:
37  Qt::BrushStyle style = DEFAULT_SIMPLEFILL_STYLE,
38  QColor borderColor = DEFAULT_SIMPLEFILL_BORDERCOLOR,
39  Qt::PenStyle borderStyle = DEFAULT_SIMPLEFILL_BORDERSTYLE,
40  double borderWidth = DEFAULT_SIMPLEFILL_BORDERWIDTH,
41  Qt::PenJoinStyle penJoinStyle = DEFAULT_SIMPLEFILL_JOINSTYLE
42  );
43 
44  // static stuff
45 
46  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
47  static QgsSymbolLayerV2* createFromSld( QDomElement &element );
48 
49  // implemented from base classes
50 
51  QString layerType() const;
52 
53  void startRender( QgsSymbolV2RenderContext& context );
54 
55  void stopRender( QgsSymbolV2RenderContext& context );
56 
57  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
58 
59  QgsStringMap properties() const;
60 
61  QgsSymbolLayerV2* clone() const;
62 
63  void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
64 
65  QString ogrFeatureStyle( double mmScaleFactor, double mapUnitScaleFactor ) const;
66 
67  Qt::BrushStyle brushStyle() const { return mBrushStyle; }
68  void setBrushStyle( Qt::BrushStyle style ) { mBrushStyle = style; }
69 
70  QColor borderColor() const { return mBorderColor; }
71  void setBorderColor( QColor borderColor ) { mBorderColor = borderColor; }
72 
75  QColor outlineColor() const { return borderColor(); }
78  void setOutlineColor( const QColor& color ) { setBorderColor( color ); }
79 
82  QColor fillColor() const { return color(); }
85  void setFillColor( const QColor& color ) { setColor( color ); }
86 
87  Qt::PenStyle borderStyle() const { return mBorderStyle; }
88  void setBorderStyle( Qt::PenStyle borderStyle ) { mBorderStyle = borderStyle; }
89 
90  double borderWidth() const { return mBorderWidth; }
91  void setBorderWidth( double borderWidth ) { mBorderWidth = borderWidth; }
92 
93  Qt::PenJoinStyle penJoinStyle() const { return mPenJoinStyle; }
94  void setPenJoinStyle( Qt::PenJoinStyle style ) { mPenJoinStyle = style; }
95 
96  void setOffset( QPointF offset ) { mOffset = offset; }
97  QPointF offset() { return mOffset; }
98 
99  void setBorderWidthUnit( QgsSymbolV2::OutputUnit unit ) { mBorderWidthUnit = unit; }
100  QgsSymbolV2::OutputUnit borderWidthUnit() const { return mBorderWidthUnit; }
101 
102  void setBorderWidthMapUnitScale( const QgsMapUnitScale& scale ) { mBorderWidthMapUnitScale = scale; }
103  const QgsMapUnitScale& borderWidthMapUnitScale() const { return mBorderWidthMapUnitScale; }
104 
105  void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
106  QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
107 
108  void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
109  const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
110 
113 
114  void setMapUnitScale( const QgsMapUnitScale &scale );
116 
117  double estimateMaxBleed() const;
118 
119  double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
120  QColor dxfColor( const QgsSymbolV2RenderContext& context ) const;
121  Qt::PenStyle dxfPenStyle() const;
122  QColor dxfBrushColor( const QgsSymbolV2RenderContext& context ) const;
123  Qt::BrushStyle dxfBrushStyle() const;
124 
125  protected:
126  QBrush mBrush;
127  QBrush mSelBrush;
128  Qt::BrushStyle mBrushStyle;
129  QColor mBorderColor;
130  Qt::PenStyle mBorderStyle;
131  double mBorderWidth;
134  Qt::PenJoinStyle mPenJoinStyle;
135  QPen mPen;
136  QPen mSelPen;
137 
138  QPointF mOffset;
141 
142  private:
143  //helper functions for data defined symbology
144  void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QBrush& brush, QPen& pen, QPen& selPen );
145 };
146 
148 
150 {
151  public:
152 
154  {
156  ColorRamp
157  };
158 
160  {
163  Conical
164  };
165 
167  {
169  Viewport
170  };
171 
173  {
176  Repeat
177  };
178 
180  QColor color2 = Qt::white,
181  GradientColorType gradientColorType = SimpleTwoColor,
182  GradientType gradientType = Linear,
183  GradientCoordinateMode coordinateMode = Feature,
184  GradientSpread gradientSpread = Pad
185  );
186 
187  virtual ~QgsGradientFillSymbolLayerV2();
188 
189  // static stuff
190 
191  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
192 
193  // implemented from base classes
194 
195  QString layerType() const;
196 
197  void startRender( QgsSymbolV2RenderContext& context );
198 
199  void stopRender( QgsSymbolV2RenderContext& context );
200 
201  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
202 
203  QgsStringMap properties() const;
204 
205  QgsSymbolLayerV2* clone() const;
206 
207  double estimateMaxBleed() const;
208 
210  GradientType gradientType() const { return mGradientType; }
211  void setGradientType( GradientType gradientType ) { mGradientType = gradientType; }
212 
214  GradientColorType gradientColorType() const { return mGradientColorType; }
215  void setGradientColorType( GradientColorType gradientColorType ) { mGradientColorType = gradientColorType; }
216 
218  QgsVectorColorRampV2* colorRamp() { return mGradientRamp; }
219  void setColorRamp( QgsVectorColorRampV2* ramp );
220 
222  QColor color2() const { return mColor2; }
223  void setColor2( QColor color2 ) { mColor2 = color2; }
224 
226  GradientCoordinateMode coordinateMode() const { return mCoordinateMode; }
227  void setCoordinateMode( GradientCoordinateMode coordinateMode ) { mCoordinateMode = coordinateMode; }
228 
230  GradientSpread gradientSpread() const { return mGradientSpread; }
231  void setGradientSpread( GradientSpread gradientSpread ) { mGradientSpread = gradientSpread; }
232 
234  void setReferencePoint1( QPointF referencePoint ) { mReferencePoint1 = referencePoint; }
235  QPointF referencePoint1() const { return mReferencePoint1; }
236 
238  void setReferencePoint1IsCentroid( bool isCentroid ) { mReferencePoint1IsCentroid = isCentroid; }
239  bool referencePoint1IsCentroid() const { return mReferencePoint1IsCentroid; }
240 
242  void setReferencePoint2( QPointF referencePoint ) { mReferencePoint2 = referencePoint; }
243  QPointF referencePoint2() const { return mReferencePoint2; }
244 
246  void setReferencePoint2IsCentroid( bool isCentroid ) { mReferencePoint2IsCentroid = isCentroid; }
247  bool referencePoint2IsCentroid() const { return mReferencePoint2IsCentroid; }
248 
250  void setAngle( double angle ) { mAngle = angle; }
251  double angle() const { return mAngle; }
252 
254  void setOffset( QPointF offset ) { mOffset = offset; }
255  QPointF offset() const { return mOffset; }
256 
258  void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
259  QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
260 
261  void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
262  const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
263 
266 
267  void setMapUnitScale( const QgsMapUnitScale &scale );
269 
270  protected:
271  QBrush mBrush;
272  QBrush mSelBrush;
273 
275  QColor mColor2;
280 
285  double mAngle;
286 
287  QPointF mOffset;
290 
291  private:
292 
293  //helper functions for data defined symbology
294  void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, const QPolygonF& points );
295 
297  void applyGradient( const QgsSymbolV2RenderContext& context, QBrush& brush, const QColor& color, const QColor& color2,
298  const GradientColorType &gradientColorType, QgsVectorColorRampV2 *gradientRamp, const GradientType &gradientType,
299  const GradientCoordinateMode &coordinateMode, const GradientSpread &gradientSpread,
300  const QPointF &referencePoint1, const QPointF &referencePoint2, const double angle );
301 
303  QPointF rotateReferencePoint( const QPointF & refPoint, double angle );
304 };
305 
307 {
308  public:
309 
311  {
313  ColorRamp
314  };
315 
316  QgsShapeburstFillSymbolLayerV2( QColor color = DEFAULT_SIMPLEFILL_COLOR, QColor color2 = Qt::white,
317  ShapeburstColorType colorType = SimpleTwoColor,
318  int blurRadius = 0, bool useWholeShape = true, double maxDistance = 5 );
319 
321 
322  // static stuff
323 
324  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
325 
326  // implemented from base classes
327 
328  QString layerType() const;
329 
330  void startRender( QgsSymbolV2RenderContext& context );
331 
332  void stopRender( QgsSymbolV2RenderContext& context );
333 
334  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
335 
336  QgsStringMap properties() const;
337 
338  QgsSymbolLayerV2* clone() const;
339 
340  double estimateMaxBleed() const;
341 
347  void setBlurRadius( int blurRadius ) { mBlurRadius = blurRadius; }
353  int blurRadius() const { return mBlurRadius; }
354 
362  void setUseWholeShape( double useWholeShape ) { mUseWholeShape = useWholeShape; }
369  double useWholeShape() const { return mUseWholeShape; }
370 
378  void setMaxDistance( double maxDistance ) { mMaxDistance = maxDistance; }
386  double maxDistance() const { return mMaxDistance; }
387 
394  void setDistanceUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceUnit = unit; }
401  QgsSymbolV2::OutputUnit distanceUnit() const { return mDistanceUnit; }
402 
403  void setDistanceMapUnitScale( const QgsMapUnitScale& scale ) { mDistanceMapUnitScale = scale; }
404  const QgsMapUnitScale& distanceMapUnitScale() const { return mDistanceMapUnitScale; }
405 
415  void setColorType( ShapeburstColorType colorType ) { mColorType = colorType; }
425  ShapeburstColorType colorType() const { return mColorType; }
426 
433  void setColorRamp( QgsVectorColorRampV2* ramp );
440  QgsVectorColorRampV2* colorRamp() { return mGradientRamp; }
441 
448  void setColor2( QColor color2 ) { mColor2 = color2; }
455  QColor color2() const { return mColor2; }
456 
463  void setIgnoreRings( double ignoreRings ) { mIgnoreRings = ignoreRings; }
469  double ignoreRings() const { return mIgnoreRings; }
470 
477  void setOffset( QPointF offset ) { mOffset = offset; }
484  QPointF offset() const { return mOffset; }
485 
492  void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
499  QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
500 
501  void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
502  const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
503 
506 
507  void setMapUnitScale( const QgsMapUnitScale &scale );
509 
510  protected:
511  QBrush mBrush;
512  QBrush mSelBrush;
513 
515 
517  double mMaxDistance;
520 
522  QColor mColor2;
525 
527 
528  QPointF mOffset;
531 
532  private:
533 
534  //helper functions for data defined symbology
535  void applyDataDefinedSymbology( QgsSymbolV2RenderContext& context, QColor& color, QColor& color2, int& blurRadius, bool& useWholeShape,
536  double& maxDistance, bool &ignoreRings );
537 
538  /* distance transform of a 1d function using squared distance */
539  void distanceTransform1d( double *f, int n, int *v, double *z, double *d );
540  /* distance transform of 2d function using squared distance */
541  void distanceTransform2d( double * im, int width, int height );
542  /* distance transform of a binary QImage */
543  double * distanceTransform( QImage * im );
544 
545  /* fills a QImage with values from an array of doubles containing squared distance transform values */
546  void dtArrayToQImage( double * array, QImage *im, QgsVectorColorRampV2* ramp, double layerAlpha = 1, bool useWholeShape = true, int maxPixelDistance = 0 );
547 };
548 
551 {
552  public:
554  virtual ~QgsImageFillSymbolLayer();
555  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
556 
557  virtual QgsSymbolV2* subSymbol() { return mOutline; }
558  virtual bool setSubSymbol( QgsSymbolV2* symbol );
559 
560  void setOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mOutlineWidthUnit = unit; }
561  QgsSymbolV2::OutputUnit outlineWidthUnit() const { return mOutlineWidthUnit; }
562 
563  void setOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mOutlineWidthMapUnitScale = scale; }
564  const QgsMapUnitScale& outlineWidthMapUnitScale() const { return mOutlineWidthMapUnitScale; }
565 
568 
569  void setMapUnitScale( const QgsMapUnitScale& scale );
571 
572  virtual double estimateMaxBleed() const;
573 
574  virtual double dxfWidth( const QgsDxfExport& e, const QgsSymbolV2RenderContext& context ) const;
575  virtual QColor dxfColor( const QgsSymbolV2RenderContext& context ) const;
576  virtual Qt::PenStyle dxfPenStyle() const;
577 
578  protected:
579  QBrush mBrush;
580  double mNextAngle; // mAngle / data defined angle
581 
586 
589 
590  virtual void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context ) { Q_UNUSED( context ); }
591 };
592 
596 {
597  public:
598  QgsSVGFillSymbolLayer( const QString& svgFilePath = "", double width = 20, double rotation = 0.0 );
599  QgsSVGFillSymbolLayer( const QByteArray& svgData, double width = 20, double rotation = 0.0 );
601 
602  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
603  static QgsSymbolLayerV2* createFromSld( QDomElement &element );
604 
605  // implemented from base classes
606 
607  QString layerType() const;
608 
609  void startRender( QgsSymbolV2RenderContext& context );
610  void stopRender( QgsSymbolV2RenderContext& context );
611 
612  QgsStringMap properties() const;
613 
614  QgsSymbolLayerV2* clone() const;
615 
616  void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
617 
618  //getters and setters
619  void setSvgFilePath( const QString& svgPath );
620  QString svgFilePath() const { return mSvgFilePath; }
621  void setPatternWidth( double width ) { mPatternWidth = width;}
622  double patternWidth() const { return mPatternWidth; }
623 
624  void setSvgFillColor( const QColor& c ) { mSvgFillColor = c; }
625  QColor svgFillColor() const { return mSvgFillColor; }
626  void setSvgOutlineColor( const QColor& c ) { mSvgOutlineColor = c; }
627  QColor svgOutlineColor() const { return mSvgOutlineColor; }
628  void setSvgOutlineWidth( double w ) { mSvgOutlineWidth = w; }
629  double svgOutlineWidth() const { return mSvgOutlineWidth; }
630 
631  void setPatternWidthUnit( QgsSymbolV2::OutputUnit unit ) { mPatternWidthUnit = unit; }
632  QgsSymbolV2::OutputUnit patternWidthUnit() const { return mPatternWidthUnit; }
633 
634  void setPatternWidthMapUnitScale( const QgsMapUnitScale& scale ) { mPatternWidthMapUnitScale = scale; }
635  const QgsMapUnitScale& patternWidthMapUnitScale() const { return mPatternWidthMapUnitScale; }
636 
637  void setSvgOutlineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mSvgOutlineWidthUnit = unit; }
638  QgsSymbolV2::OutputUnit svgOutlineWidthUnit() const { return mSvgOutlineWidthUnit; }
639 
640  void setSvgOutlineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mSvgOutlineWidthMapUnitScale = scale; }
641  const QgsMapUnitScale& svgOutlineWidthMapUnitScale() const { return mSvgOutlineWidthMapUnitScale; }
642 
645 
646  void setMapUnitScale( const QgsMapUnitScale &scale );
648 
649  protected:
654 
656  QByteArray mSvgData;
658  QString mSvgFilePath;
660  QRectF mSvgViewBox;
662  QImage* mSvgPattern;
663 
664  //param(fill), param(outline), param(outline-width) are going
665  //to be replaced in memory
671 
672  void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context );
673 
674  private:
676  void storeViewBox();
677  void setDefaultSvgParams(); //fills mSvgFillColor, mSvgOutlineColor, mSvgOutlineWidth with default values for mSvgFilePath
678 
680  void applyPattern( QBrush& brush, const QString& svgFilePath, double patternWidth, QgsSymbolV2::OutputUnit patternWidthUnit, const QColor& svgFillColor, const QColor& svgOutlineColor,
681  double svgOutlineWidth, QgsSymbolV2::OutputUnit svgOutlineWidthUnit, const QgsSymbolV2RenderContext& context, const QgsMapUnitScale& patternWidthMapUnitScale, const QgsMapUnitScale &svgOutlineWidthMapUnitScale );
682 };
683 
685 {
686  public:
689 
690  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
691  static QgsSymbolLayerV2* createFromSld( QDomElement &element );
692 
693  QString layerType() const;
694 
695  void startRender( QgsSymbolV2RenderContext& context );
696 
697  void stopRender( QgsSymbolV2RenderContext& context );
698 
699  QgsStringMap properties() const;
700 
701  QgsSymbolLayerV2* clone() const;
702 
703  void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
704 
705  double estimateMaxBleed() const;
706 
707  QString ogrFeatureStyleWidth( double widthScaleFactor ) const;
708 
709  //getters and setters
710  void setLineAngle( double a ) { mLineAngle = a; }
711  double lineAngle() const { return mLineAngle; }
712  void setDistance( double d ) { mDistance = d; }
713  double distance() const { return mDistance; }
714  void setLineWidth( double w );
715  double lineWidth() const { return mLineWidth; }
716  void setColor( const QColor& c );
717  QColor color() const { return mColor; }
718  void setOffset( double offset ) { mOffset = offset; }
719  double offset() const { return mOffset; }
720 
721  void setDistanceUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceUnit = unit; }
722  QgsSymbolV2::OutputUnit distanceUnit() const { return mDistanceUnit; }
723 
724  void setDistanceMapUnitScale( const QgsMapUnitScale& scale ) { mDistanceMapUnitScale = scale; }
725  const QgsMapUnitScale& distanceMapUnitScale() const { return mDistanceMapUnitScale; }
726 
727  void setLineWidthUnit( QgsSymbolV2::OutputUnit unit ) { mLineWidthUnit = unit; }
728  QgsSymbolV2::OutputUnit lineWidthUnit() const { return mLineWidthUnit; }
729 
730  void setLineWidthMapUnitScale( const QgsMapUnitScale& scale ) { mLineWidthMapUnitScale = scale; }
731  const QgsMapUnitScale& lineWidthMapUnitScale() const { return mLineWidthMapUnitScale; }
732 
733  void setOffsetUnit( QgsSymbolV2::OutputUnit unit ) { mOffsetUnit = unit; }
734  QgsSymbolV2::OutputUnit offsetUnit() const { return mOffsetUnit; }
735 
736  void setOffsetMapUnitScale( const QgsMapUnitScale& scale ) { mOffsetMapUnitScale = scale; }
737  const QgsMapUnitScale& offsetMapUnitScale() const { return mOffsetMapUnitScale; }
738 
741 
742  void setMapUnitScale( const QgsMapUnitScale& scale );
744 
745  bool setSubSymbol( QgsSymbolV2* symbol );
747 
748  protected:
750  double mDistance;
754  double mLineWidth;
757  QColor mColor;
759  double mLineAngle;
761  double mOffset;
764 
765  void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context );
766 
767  private:
769  void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& brush, double lineAngle, double distance, double lineWidth, const QColor& color );
770 
772  QgsLineSymbolV2* mFillLineSymbol;
773 };
774 
776 {
777  public:
780 
781  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
782  static QgsSymbolLayerV2* createFromSld( QDomElement &element );
783 
784  QString layerType() const;
785 
786  void startRender( QgsSymbolV2RenderContext& context );
787 
788  void stopRender( QgsSymbolV2RenderContext& context );
789 
790  QgsStringMap properties() const;
791 
792  QgsSymbolLayerV2* clone() const;
793 
794  void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
795 
796  double estimateMaxBleed() const;
797 
798  //getters and setters
799  double distanceX() const { return mDistanceX; }
800  void setDistanceX( double d ) { mDistanceX = d; }
801 
802  double distanceY() const { return mDistanceY; }
803  void setDistanceY( double d ) { mDistanceY = d; }
804 
805  double displacementX() const { return mDisplacementX; }
806  void setDisplacementX( double d ) { mDisplacementX = d; }
807 
808  double displacementY() const { return mDisplacementY; }
809  void setDisplacementY( double d ) { mDisplacementY = d; }
810 
811  bool setSubSymbol( QgsSymbolV2* symbol );
812  virtual QgsSymbolV2* subSymbol() { return mMarkerSymbol; }
813 
814  void setDistanceXUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceXUnit = unit; }
815  QgsSymbolV2::OutputUnit distanceXUnit() const { return mDistanceXUnit; }
816 
817  void setDistanceXMapUnitScale( const QgsMapUnitScale& scale ) { mDistanceXMapUnitScale = scale; }
818  const QgsMapUnitScale& distanceXMapUnitScale() const { return mDistanceXMapUnitScale; }
819 
820  void setDistanceYUnit( QgsSymbolV2::OutputUnit unit ) { mDistanceYUnit = unit; }
821  QgsSymbolV2::OutputUnit distanceYUnit() const { return mDistanceYUnit; }
822 
823  void setDistanceYMapUnitScale( const QgsMapUnitScale& scale ) { mDistanceYMapUnitScale = scale; }
824  const QgsMapUnitScale& distanceYMapUnitScale() const { return mDistanceYMapUnitScale; }
825 
826  void setDisplacementXUnit( QgsSymbolV2::OutputUnit unit ) { mDisplacementXUnit = unit; }
827  QgsSymbolV2::OutputUnit displacementXUnit() const { return mDisplacementXUnit; }
828 
829  void setDisplacementXMapUnitScale( const QgsMapUnitScale& scale ) { mDisplacementXMapUnitScale = scale; }
830  const QgsMapUnitScale& displacementXMapUnitScale() const { return mDisplacementXMapUnitScale; }
831 
832  void setDisplacementYUnit( QgsSymbolV2::OutputUnit unit ) { mDisplacementYUnit = unit; }
833  QgsSymbolV2::OutputUnit displacementYUnit() const { return mDisplacementYUnit; }
834 
835  void setDisplacementYMapUnitScale( const QgsMapUnitScale& scale ) { mDisplacementYMapUnitScale = scale; }
836  const QgsMapUnitScale& displacementYMapUnitScale() const { return mDisplacementYMapUnitScale; }
837 
840 
841  void setMapUnitScale( const QgsMapUnitScale &scale );
843 
844  virtual QSet<QString> usedAttributes() const;
845 
846  protected:
848  double mDistanceX;
851  double mDistanceY;
860 
861  void applyDataDefinedSettings( const QgsSymbolV2RenderContext& context );
862 
863  private:
864  void applyPattern( const QgsSymbolV2RenderContext& context, QBrush& brush, double distanceX, double distanceY,
865  double displacementX, double displacementY );
866 };
867 
869 {
870  public:
873 
874  // static stuff
875 
876  static QgsSymbolLayerV2* create( const QgsStringMap& properties = QgsStringMap() );
877  static QgsSymbolLayerV2* createFromSld( QDomElement &element );
878 
879  // implemented from base classes
880 
881  QString layerType() const;
882 
883  void startRender( QgsSymbolV2RenderContext& context );
884 
885  void stopRender( QgsSymbolV2RenderContext& context );
886 
887  void renderPolygon( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
888 
889  QgsStringMap properties() const;
890 
891  QgsSymbolLayerV2* clone() const;
892 
893  void toSld( QDomDocument &doc, QDomElement &element, QgsStringMap props ) const;
894 
895  void setColor( const QColor& color );
896 
898  bool setSubSymbol( QgsSymbolV2* symbol );
899 
902 
903  void setMapUnitScale( const QgsMapUnitScale &scale );
905 
906  virtual QSet<QString> usedAttributes() const;
907 
908  void setPointOnSurface( bool pointOnSurface ) { mPointOnSurface = pointOnSurface; }
909  bool pointOnSurface() const { return mPointOnSurface; }
910 
911  protected:
914 };
915 
916 #endif
917 
918