@@ -3778,110 +3778,125 @@ void QgsDxfExport::addFeature( QgsSymbolV2RenderContext& ctx, const QString& lay
3778
3778
3779
3779
if ( penStyle != Qt::NoPen )
3780
3780
{
3781
- // single line
3782
- if ( QgsWKBTypes::flatType ( geometryType ) == QgsWKBTypes::LineString )
3783
- {
3784
- const QgsAbstractGeometryV2 *offsetGeom = geom;
3785
- if ( !qgsDoubleNear ( offset, 0.0 ) )
3786
- {
3787
- QgsGeos geos ( geom );
3788
- offsetGeom = geos.offsetCurve ( offset, 0 , GEOSBUF_JOIN_MITRE, 2.0 );
3789
- if ( !offsetGeom )
3790
- offsetGeom = geom;
3791
- }
3792
-
3793
- writePolyline ( offsetGeom->coordinateSequence ().at ( 0 ).at ( 0 ), layer, lineStyleName, penColor, width );
3794
-
3795
- if ( offsetGeom != geom )
3796
- delete offsetGeom;
3797
- }
3781
+ const QgsAbstractGeometryV2 *tempGeom = geom;
3798
3782
3799
- // multiline
3800
- if ( QgsWKBTypes::flatType ( geometryType ) == QgsWKBTypes::MultiLineString )
3783
+ switch ( QgsWKBTypes::flatType ( geometryType ) )
3801
3784
{
3802
- const QgsAbstractGeometryV2 *offsetGeom = geom;
3785
+ case QgsWKBTypes::CircularString:
3786
+ case QgsWKBTypes::CompoundCurve:
3787
+ tempGeom = geom->segmentize ();
3788
+ FALLTHROUGH;
3789
+ case QgsWKBTypes::LineString:
3790
+ if ( !qgsDoubleNear ( offset, 0.0 ) )
3791
+ {
3792
+ QgsGeos geos ( tempGeom );
3793
+ if ( tempGeom != geom )
3794
+ delete tempGeom;
3795
+ tempGeom = geos.offsetCurve ( offset, 0 , GEOSBUF_JOIN_MITRE, 2.0 );
3796
+ if ( !tempGeom )
3797
+ tempGeom = geom;
3798
+ }
3803
3799
3804
- if ( !qgsDoubleNear ( offset, 0.0 ) )
3805
- {
3806
- QgsGeos geos ( geom );
3807
- offsetGeom = geos.offsetCurve ( offset, 0 , GEOSBUF_JOIN_MITRE, 2.0 );
3808
- if ( !offsetGeom )
3809
- offsetGeom = geom;
3810
- }
3800
+ writePolyline ( tempGeom->coordinateSequence ().at ( 0 ).at ( 0 ), layer, lineStyleName, penColor, width );
3811
3801
3812
- const QgsCoordinateSequenceV2 &cs = offsetGeom->coordinateSequence ();
3813
- for ( int i = 0 ; i < cs.size (); i++ )
3814
- {
3815
- writePolyline ( cs.at ( i ).at ( 0 ), layer, lineStyleName, penColor, width );
3816
- }
3802
+ break ;
3817
3803
3818
- if ( offsetGeom != geom )
3819
- delete offsetGeom;
3820
- }
3804
+ case QgsWKBTypes::MultiCurve:
3805
+ tempGeom = geom->segmentize ();
3806
+ FALLTHROUGH;
3807
+ case QgsWKBTypes::MultiLineString:
3808
+ {
3809
+ if ( !qgsDoubleNear ( offset, 0.0 ) )
3810
+ {
3811
+ QgsGeos geos ( tempGeom );
3812
+ if ( tempGeom != geom )
3813
+ delete tempGeom;
3814
+ tempGeom = geos.offsetCurve ( offset, 0 , GEOSBUF_JOIN_MITRE, 2.0 );
3815
+ if ( !tempGeom )
3816
+ tempGeom = geom;
3817
+ }
3821
3818
3822
- // polygon
3823
- if ( QgsWKBTypes::flatType ( geometryType ) == QgsWKBTypes::Polygon )
3824
- {
3825
- const QgsAbstractGeometryV2 *bufferGeom = geom;
3819
+ const QgsCoordinateSequenceV2 &cs = tempGeom->coordinateSequence ();
3820
+ for ( int i = 0 ; i < cs.size (); i++ )
3821
+ {
3822
+ writePolyline ( cs.at ( i ).at ( 0 ), layer, lineStyleName, penColor, width );
3823
+ }
3826
3824
3827
- if ( !qgsDoubleNear ( offset, 0.0 ) )
3828
- {
3829
- QgsGeos geos ( geom );
3830
- bufferGeom = geos.buffer ( offset, 0 , GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
3831
- if ( !bufferGeom )
3832
- bufferGeom = geom;
3825
+ break ;
3833
3826
}
3834
3827
3835
- const QgsCoordinateSequenceV2 &cs = bufferGeom->coordinateSequence ();
3836
- for ( int i = 0 ; i < cs.at ( 0 ).size (); i++ )
3828
+ case QgsWKBTypes::CurvePolygon:
3829
+ tempGeom = geom->segmentize ();
3830
+ FALLTHROUGH;
3831
+ case QgsWKBTypes::Polygon:
3837
3832
{
3838
- writePolyline ( cs.at ( 0 ).at ( i ), layer, lineStyleName, penColor, width );
3839
- }
3833
+ if ( !qgsDoubleNear ( offset, 0.0 ) )
3834
+ {
3835
+ QgsGeos geos ( tempGeom );
3836
+ if ( tempGeom != geom )
3837
+ delete tempGeom;
3838
+ tempGeom = geos.buffer ( offset, 0 , GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
3839
+ if ( !tempGeom )
3840
+ tempGeom = geom;
3841
+ }
3840
3842
3841
- if ( bufferGeom != geom )
3842
- delete bufferGeom;
3843
- }
3843
+ const QgsCoordinateSequenceV2 &cs = tempGeom->coordinateSequence ();
3844
+ for ( int i = 0 ; i < cs.at ( 0 ).size (); i++ )
3845
+ {
3846
+ writePolyline ( cs.at ( 0 ).at ( i ), layer, lineStyleName, penColor, width );
3847
+ }
3844
3848
3845
- // multipolygon or polygon
3846
- if ( QgsWKBTypes::flatType ( geometryType ) == QgsWKBTypes::MultiPolygon )
3847
- {
3848
- const QgsAbstractGeometryV2 *bufferGeom = geom;
3849
+ break ;
3850
+ }
3849
3851
3850
- if ( ! qgsDoubleNear ( offset, 0.0 ) )
3852
+ case QgsWKBTypes::MultiPolygon:
3851
3853
{
3852
- QgsGeos geos ( geom );
3853
- bufferGeom = geos.buffer ( offset, 0 , GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
3854
- if ( !bufferGeom )
3855
- bufferGeom = geom;
3856
- }
3854
+ if ( !qgsDoubleNear ( offset, 0.0 ) )
3855
+ {
3856
+ QgsGeos geos ( tempGeom );
3857
+ if ( tempGeom != geom )
3858
+ delete tempGeom;
3859
+ tempGeom = geos.buffer ( offset, 0 , GEOSBUF_CAP_FLAT, GEOSBUF_JOIN_MITRE, 2.0 );
3860
+ if ( !tempGeom )
3861
+ tempGeom = geom;
3862
+ }
3857
3863
3858
- const QgsCoordinateSequenceV2 &cs = bufferGeom ->coordinateSequence ();
3859
- for ( int i = 0 ; i < cs.size (); i++ )
3860
- for ( int j = 0 ; j < cs.at ( i ).size (); j++ )
3861
- writePolyline ( cs.at ( i ).at ( j ), layer, lineStyleName, penColor, width );
3864
+ const QgsCoordinateSequenceV2 &cs = tempGeom ->coordinateSequence ();
3865
+ for ( int i = 0 ; i < cs.size (); i++ )
3866
+ for ( int j = 0 ; j < cs.at ( i ).size (); j++ )
3867
+ writePolyline ( cs.at ( i ).at ( j ), layer, lineStyleName, penColor, width );
3862
3868
3863
- if ( bufferGeom != geom )
3864
- delete bufferGeom;
3869
+ break ;
3870
+ }
3865
3871
}
3872
+
3873
+ if ( tempGeom != geom )
3874
+ delete tempGeom;
3866
3875
}
3867
3876
3868
3877
if ( brushStyle != Qt::NoBrush )
3869
3878
{
3870
- // polygon
3871
- if ( QgsWKBTypes::flatType ( geometryType ) == QgsWKBTypes::Polygon )
3872
- {
3873
- writePolygon ( geom->coordinateSequence ().at ( 0 ), layer, " SOLID" , brushColor );
3874
- }
3879
+ const QgsAbstractGeometryV2 *tempGeom = geom;
3875
3880
3876
- // multipolygon or polygon
3877
- if ( QgsWKBTypes::flatType ( geometryType ) == QgsWKBTypes::MultiPolygon )
3881
+ switch ( QgsWKBTypes::flatType ( geometryType ) )
3878
3882
{
3879
- const QgsCoordinateSequenceV2 &cs = geom->coordinateSequence ();
3880
- for ( int i = 0 ; i < cs.size (); i++ )
3881
- {
3882
- writePolygon ( cs.at ( i ), layer, " SOLID" , brushColor );
3883
- }
3883
+ case QgsWKBTypes::CurvePolygon:
3884
+ tempGeom = tempGeom->segmentize ();
3885
+ FALLTHROUGH;
3886
+ case QgsWKBTypes::Polygon:
3887
+ writePolygon ( tempGeom->coordinateSequence ().at ( 0 ), layer, " SOLID" , brushColor );
3888
+ break ;
3889
+
3890
+ case QgsWKBTypes::MultiPolygon:
3891
+ const QgsCoordinateSequenceV2 &cs = geom->coordinateSequence ();
3892
+ for ( int i = 0 ; i < cs.size (); i++ )
3893
+ {
3894
+ writePolygon ( cs.at ( i ), layer, " SOLID" , brushColor );
3895
+ }
3884
3896
}
3897
+
3898
+ if ( tempGeom != geom )
3899
+ delete tempGeom;
3885
3900
}
3886
3901
}
3887
3902
0 commit comments