@@ -67,9 +67,29 @@ class CORE_EXPORT QgsSimpleFillSymbolLayerV2 : public QgsFillSymbolLayerV2
6767 QPointF mOffset ;
6868};
6969
70+ /* *Base class for polygon renderers generating texture images*/
71+ class CORE_EXPORT QgsImageFillSymbolLayer: public QgsFillSymbolLayerV2
72+ {
73+ public:
74+ QgsImageFillSymbolLayer ();
75+ virtual ~QgsImageFillSymbolLayer ();
76+ void renderPolygon ( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
77+
78+ virtual QgsSymbolV2* subSymbol () { return mOutline ; }
79+ virtual bool setSubSymbol ( QgsSymbolV2* symbol );
80+
81+ protected:
82+ QBrush mBrush ;
83+
84+ /* *Outline width*/
85+ double mOutlineWidth ;
86+ /* *Custom outline*/
87+ QgsLineSymbolV2* mOutline ;
88+ };
89+
7090/* *A class for svg fill patterns. The class automatically scales the pattern to
7191 the appropriate pixel dimensions of the output device*/
72- class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsFillSymbolLayerV2
92+ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsImageFillSymbolLayer
7393{
7494 public:
7595 QgsSVGFillSymbolLayer ( const QString& svgFilePath = " " , double width = 20 , double rotation = 0.0 );
@@ -85,8 +105,6 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsFillSymbolLayerV2
85105 void startRender ( QgsSymbolV2RenderContext& context );
86106 void stopRender ( QgsSymbolV2RenderContext& context );
87107
88- void renderPolygon ( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context );
89-
90108 QgsStringMap properties () const ;
91109
92110 QgsSymbolLayerV2* clone () const ;
@@ -97,9 +115,6 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsFillSymbolLayerV2
97115 void setPatternWidth ( double width ) { mPatternWidth = width;}
98116 double patternWidth () const { return mPatternWidth ; }
99117
100- QgsSymbolV2* subSymbol () { return mOutline ; }
101- bool setSubSymbol ( QgsSymbolV2* symbol );
102-
103118 protected:
104119 /* *Width of the pattern (in QgsSymbolV2 output units)*/
105120 double mPatternWidth ;
@@ -109,19 +124,90 @@ class CORE_EXPORT QgsSVGFillSymbolLayer: public QgsFillSymbolLayerV2
109124 QString mSvgFilePath ;
110125 /* *SVG view box (to keep the aspect ratio */
111126 QRectF mSvgViewBox ;
112- /* *Brush that receives rendered pixel image in startRender() method*/
113- QBrush mBrush ;
114- /* *Outline width*/
115- double mOutlineWidth ;
116- /* *Custom outline*/
117- QgsLineSymbolV2* mOutline ;
118127
119128 private:
120129 /* *Helper function that gets the view box from the byte array*/
121130 void storeViewBox ();
122131};
123132
133+ class CORE_EXPORT QgsLinePatternFillSymbolLayer: public QgsImageFillSymbolLayer
134+ {
135+ public:
136+ QgsLinePatternFillSymbolLayer ();
137+ ~QgsLinePatternFillSymbolLayer ();
138+
139+ static QgsSymbolLayerV2* create ( const QgsStringMap& properties = QgsStringMap() );
140+
141+ QString layerType () const ;
142+
143+ void startRender ( QgsSymbolV2RenderContext& context );
144+
145+ void stopRender ( QgsSymbolV2RenderContext& context );
124146
147+ QgsStringMap properties () const ;
148+
149+ QgsSymbolLayerV2* clone () const ;
150+
151+ // getters and setters
152+ void setAngle ( double a ){ mAngle = a; }
153+ double angle () const { return mAngle ; }
154+ void setDistance ( double d ){ mDistance = d; }
155+ double distance () const { return mDistance ; }
156+ void setLineWidth ( double w ){ mLineWidth = w; }
157+ double lineWidth () const { return mLineWidth ; }
158+ void setColor ( const QColor& c ){ mColor = c; }
159+ QColor color () const { return mColor ; }
160+
161+ protected:
162+ /* *Distance (in mm or map units) between lines*/
163+ double mDistance ;
164+ /* *Line width (in mm or map units)*/
165+ double mLineWidth ;
166+ QColor mColor ;
167+ // todo: line type
168+ double mAngle ;
169+ };
170+
171+ class CORE_EXPORT QgsPointPatternFillSymbolLayer: public QgsImageFillSymbolLayer
172+ {
173+ public:
174+ QgsPointPatternFillSymbolLayer ();
175+ ~QgsPointPatternFillSymbolLayer ();
176+
177+ static QgsSymbolLayerV2* create ( const QgsStringMap& properties = QgsStringMap() );
178+ QString layerType () const ;
179+
180+ void startRender ( QgsSymbolV2RenderContext& context );
181+
182+ void stopRender ( QgsSymbolV2RenderContext& context );
183+
184+ QgsStringMap properties () const ;
185+
186+ QgsSymbolLayerV2* clone () const ;
187+
188+ // getters and setters
189+ double distanceX () const { return mDistanceX ; }
190+ void setDistanceX ( double d ) { mDistanceX = d; }
191+
192+ double distanceY () const { return mDistanceY ; }
193+ void setDistanceY ( double d ) { mDistanceY = d; }
194+
195+ double displacementX () const { return mDisplacementX ; }
196+ void setDisplacementX ( double d ){ mDisplacementX = d; }
197+
198+ double displacementY () const { return mDisplacementY ; }
199+ void setDisplacementY ( double d ){ mDisplacementY = d; }
200+
201+ bool setSubSymbol ( QgsSymbolV2* symbol );
202+ virtual QgsSymbolV2* subSymbol () { return mMarkerSymbol ; }
203+
204+ protected:
205+ QgsMarkerSymbolV2* mMarkerSymbol ;
206+ double mDistanceX ;
207+ double mDistanceY ;
208+ double mDisplacementX ;
209+ double mDisplacementY ;
210+ };
125211
126212class CORE_EXPORT QgsCentroidFillSymbolLayerV2 : public QgsFillSymbolLayerV2
127213{
0 commit comments