Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
dxf export: fix detection of closed polylines
(backport of 74f10b9)
  • Loading branch information
jef-n committed May 27, 2015
1 parent a9cccd2 commit c165e1f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
15 changes: 8 additions & 7 deletions src/core/dxf/qgsdxfexport.cpp
Expand Up @@ -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();
Expand All @@ -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 )
Expand Down
2 changes: 1 addition & 1 deletion src/core/dxf/qgsdxfexport.h
Expand Up @@ -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 );

Expand Down

0 comments on commit c165e1f

Please sign in to comment.