Skip to content

Commit

Permalink
dxf export: link vertices to polyline (fixes #15484)
Browse files Browse the repository at this point in the history
(cherry picked from commit 052d3ef)
  • Loading branch information
jef-n committed Aug 28, 2016
1 parent d477d19 commit 485d7a0
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions src/core/dxf/qgsdxfexport.cpp
Expand Up @@ -451,11 +451,12 @@ void QgsDxfExport::writeGroup( const QColor& color, int exactMatchCode, int rgbC
minDist = dist;
}

if ( minDist == 0 && color.alpha() == 255 && minDistAt != 7 )
if ( minDist == 0 && minDistAt != 7 )
{
// exact full opaque match, not black/white
writeGroup( exactMatchCode, minDistAt );
return;
if ( color.alpha() == 255 )
return;
}

int c = ( color.red() & 0xff ) * 0x10000 + ( color.green() & 0xff ) * 0x100 + ( color.blue() & 0xff );
Expand Down Expand Up @@ -3437,21 +3438,24 @@ void QgsDxfExport::writePolyline( const QgsPointSequence &line, const QString& l
else
{
writeGroup( 0, "POLYLINE" );
writeHandle();
writeGroup( 8, layer );
int plHandle = writeHandle();
writeGroup( 330, mBlockHandle );
writeGroup( 100, "AcDbEntity" );
writeGroup( 100, "AcDb3dPolyline" );
writeGroup( 8, layer );
writeGroup( 6, lineStyleName );
writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) );
writeGroup( color );
writeGroup( 100, "AcDb3dPolyline" );
writeGroup( 0, QgsPointV2( QgsWkbTypes::PointZ ) );
writeGroup( 70, 8 );

for ( int i = 0; i < n; i++ )
{
writeGroup( 0, "VERTEX" );
writeHandle();
writeGroup( 8, layer );
writeGroup( 330, plHandle );
writeGroup( 100, "AcDbEntity" );
writeGroup( 8, layer );
writeGroup( color );
writeGroup( 100, "AcDbVertex" );
writeGroup( 100, "AcDb3dPolylineVertex" );
writeGroup( 0, line[i] );
Expand All @@ -3460,8 +3464,10 @@ void QgsDxfExport::writePolyline( const QgsPointSequence &line, const QString& l

writeGroup( 0, "SEQEND" );
writeHandle();
writeGroup( 8, layer );
writeGroup( 330, plHandle );
writeGroup( 100, "AcDbEntity" );
writeGroup( 8, layer );
writeGroup( color );
}
}

Expand Down

1 comment on commit 485d7a0

@3nids
Copy link
Member

@3nids 3nids commented on 485d7a0 Sep 5, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks a lot @jef-n !

Please sign in to comment.