@@ -174,6 +174,51 @@ void QgsSimpleLineSymbolLayerV2::stopRender( QgsSymbolV2RenderContext& context )
174
174
Q_UNUSED ( context );
175
175
}
176
176
177
+ void QgsSimpleLineSymbolLayerV2::renderPolygonOutline ( const QPolygonF& points, QList<QPolygonF>* rings, QgsSymbolV2RenderContext& context )
178
+ {
179
+ QPainter* p = context.renderContext ().painter ();
180
+ if ( !p )
181
+ {
182
+ return ;
183
+ }
184
+
185
+ if ( mDrawInsidePolygon )
186
+ {
187
+ // only drawing the line on the interior of the polygon, so set clip path for painter
188
+ p->save ();
189
+ QPainterPath clipPath;
190
+ clipPath.addPolygon ( points );
191
+
192
+ if ( rings != NULL )
193
+ {
194
+ // add polygon rings
195
+ QList<QPolygonF>::const_iterator it = rings->constBegin ();
196
+ for ( ; it != rings->constEnd (); ++it )
197
+ {
198
+ QPolygonF ring = *it;
199
+ clipPath.addPolygon ( ring );
200
+ }
201
+ }
202
+
203
+ // use intersect mode, as a clip path may already exist (eg, for composer maps)
204
+ p->setClipPath ( clipPath, Qt::IntersectClip );
205
+ }
206
+
207
+ renderPolyline ( points, context );
208
+ if ( rings )
209
+ {
210
+ foreach ( const QPolygonF& ring, *rings )
211
+ renderPolyline ( ring, context );
212
+ }
213
+
214
+ if ( mDrawInsidePolygon )
215
+ {
216
+ // restore painter to reset clip path
217
+ p->restore ();
218
+ }
219
+
220
+ }
221
+
177
222
void QgsSimpleLineSymbolLayerV2::renderPolyline ( const QPolygonF& points, QgsSymbolV2RenderContext& context )
178
223
{
179
224
QPainter* p = context.renderContext ().painter ();
@@ -198,15 +243,6 @@ void QgsSimpleLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
198
243
}
199
244
#endif
200
245
201
- if ( mDrawInsidePolygon )
202
- {
203
- // only drawing the line on the interior of the polygon, so set clip path for painter
204
- p->save ();
205
- QPainterPath clipPath;
206
- clipPath.addPolygon ( points );
207
- p->setClipPath ( clipPath, Qt::IntersectClip );
208
- }
209
-
210
246
if ( offset == 0 )
211
247
{
212
248
p->drawPolyline ( points );
@@ -216,12 +252,6 @@ void QgsSimpleLineSymbolLayerV2::renderPolyline( const QPolygonF& points, QgsSym
216
252
double scaledOffset = offset * QgsSymbolLayerV2Utils::lineWidthScaleFactor ( context.renderContext (), mOffsetUnit );
217
253
p->drawPolyline ( ::offsetLine ( points, scaledOffset ) );
218
254
}
219
-
220
- if ( mDrawInsidePolygon )
221
- {
222
- // restore painter to reset clip path
223
- p->restore ();
224
- }
225
255
}
226
256
227
257
QgsStringMap QgsSimpleLineSymbolLayerV2::properties () const
0 commit comments