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