Skip to content
Permalink
Browse files
dxf export: fix detection of closed polylines
(backport of 74f10b9)
  • Loading branch information
jef-n committed May 27, 2015
1 parent a9cccd2 commit c165e1f9b636dc027a892e0b1d0f9003617b3f4d
Showing with 9 additions and 8 deletions.
  1. +8 −7 src/core/dxf/qgsdxfexport.cpp
  2. +1 −1 src/core/dxf/qgsdxfexport.h
@@ -3339,7 +3339,7 @@ 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, bool polygon )
double width, bool )
{
writeGroup( 0, "LWPOLYLINE" );
writeHandle();
@@ -3349,16 +3349,17 @@ void QgsDxfExport::writePolyline( const QgsPolyline& line, const QString& layer,
writeGroup( 6, lineStyleName );
writeGroup( color );

writeGroup( 90, line.size() );
bool polygon = line[0] == line[ line.size() - 1 ];
int n = line.size();
if ( polygon )
--n;

writeGroup( 90, n );
writeGroup( 70, polygon ? 1 : 0 );
writeGroup( 43, width );

QgsPolyline::const_iterator lineIt = line.constBegin();
for ( ; lineIt != line.constEnd(); ++lineIt )
{
writeGroup( 0, *lineIt );
}
for ( int i = 0; i < n; i++ )
writeGroup( 0, line[i] );
}

void QgsDxfExport::writePolygon( const QgsPolygon& polygon, const QString& layer, const QString& hatchPattern, QColor color )
@@ -80,7 +80,7 @@ class CORE_EXPORT QgsDxfExport

//! draw dxf primitives
void writePolyline( const QgsPolyline &line, const QString &layer, const QString &lineStyleName, QColor color,
double width = -1, bool polygon = false );
double width = -1, bool unusedPolygonFlag = false );

void writePolygon( const QgsPolygon &polygon, const QString &layer, const QString &hatchPattern, QColor color );

0 comments on commit c165e1f

Please sign in to comment.