From e8587c3d4f6bf8367fa7084964dd572e257f1384 Mon Sep 17 00:00:00 2001 From: "Juergen E. Fischer" Date: Wed, 20 May 2015 23:35:31 +0200 Subject: [PATCH] dxf export: more ellipse marker fixes (essentially like in simple marker) --- src/core/dxf/qgsdxfexport.cpp | 6 ++++ .../symbology-ng/qgsellipsesymbollayerv2.cpp | 30 ++++++++++++++++--- 2 files changed, 32 insertions(+), 4 deletions(-) diff --git a/src/core/dxf/qgsdxfexport.cpp b/src/core/dxf/qgsdxfexport.cpp index faed256021d1..81ae3a26019b 100644 --- a/src/core/dxf/qgsdxfexport.cpp +++ b/src/core/dxf/qgsdxfexport.cpp @@ -3340,6 +3340,12 @@ void QgsDxfExport::writePoint( const QgsPoint& pt, const QString& layer, QColor void QgsDxfExport::writePolyline( const QgsPolyline& line, const QString& layer, const QString& lineStyleName, QColor color, double width ) { + if ( line.size() == 0 ) + { + QgsDebugMsg( QString( "writePolyline: empty line layer=%1 lineStyleName=%2" ).arg( layer ).arg( lineStyleName ) ); + return; + } + writeGroup( 0, "LWPOLYLINE" ); writeHandle(); writeGroup( 8, layer ); diff --git a/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp b/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp index 234c45455057..f22362ac14bf 100644 --- a/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp +++ b/src/core/symbology-ng/qgsellipsesymbollayerv2.cpp @@ -679,7 +679,10 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa } //close ellipse with first point line.push_back( line.at( 0 ) ); - e.writePolyline( line, layerName, "CONTINUOUS", oc, outlineWidth ); + if ( mBrush.style() != Qt::NoBrush ) + e.writePolygon( QgsPolygon() << line, layerName, "SOLID", fc ); + if ( mPen.style() != Qt::NoPen ) + e.writePolyline( line, layerName, "CONTINUOUS", oc, outlineWidth ); } } else if ( symbolName == "rectangle" ) @@ -688,10 +691,19 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa QPointF pt2( t.map( QPointF( halfWidth, -halfHeight ) ) ); QPointF pt3( t.map( QPointF( -halfWidth, halfHeight ) ) ); QPointF pt4( t.map( QPointF( halfWidth, halfHeight ) ) ); - e.writeSolid( layerName, fc, pt1, pt2, pt3, pt4 ); + if ( mBrush.style() != Qt::NoBrush ) + e.writeSolid( layerName, fc, pt1, pt2, pt3, pt4 ); + QgsPolyline line( 5 ); + line[0] = pt1; + line[1] = pt2; + line[2] = pt3; + line[3] = pt4; + line[4] = pt1; + if ( mPen.style() != Qt::NoPen ) + e.writePolyline( line, layerName, "CONTINUOUS", oc, outlineWidth ); return true; } - else if ( symbolName == "cross" ) + else if ( symbolName == "cross" && mPen.style() != Qt::NoPen ) { QgsPolyline line1( 2 ); QPointF pt1( t.map( QPointF( -halfWidth, 0 ) ) ); @@ -713,7 +725,17 @@ bool QgsEllipseSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScaleFa QPointF pt2( t.map( QPointF( halfWidth, -halfHeight ) ) ); QPointF pt3( t.map( QPointF( 0, halfHeight ) ) ); QPointF pt4( t.map( QPointF( 0, halfHeight ) ) ); - e.writeSolid( layerName, fc, pt1, pt2, pt3, pt4 ); + if ( mBrush.style() != Qt::NoBrush ) + e.writeSolid( layerName, fc, pt1, pt2, pt3, pt4 ); + if ( mPen.style() != Qt::NoPen ) + { + QgsPolyline line( 4 ); + line[0] = pt1; + line[1] = pt2; + line[2] = pt3; + line[3] = pt4; + e.writePolyline( line, layerName, "CONTINUOUS", oc, outlineWidth ); + } return true; }