Skip to content

Commit

Permalink
Fix rotation for svg markers exported to dxf
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Dec 5, 2013
1 parent ef3eee2 commit 3fed0d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/core/dxf/qgsdxfexport.cpp
Expand Up @@ -490,7 +490,7 @@ void QgsDxfExport::writeBlocks()
}
writeGroup( 0, "BLOCK" );
writeGroup( 8, 0 );
QString blockName = QString( "symbolLayer%1" ).arg( mBlockCounter );
QString blockName = QString( "symbolLayer%1" ).arg( mBlockCounter++ );
writeGroup( 2, blockName );
writeGroup( 70, 64 );

Expand Down
11 changes: 8 additions & 3 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -1285,9 +1285,14 @@ void QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale

QPainter p;
p.begin( &pd );
p.rotate( angle );
pd.setShift( shift - QPointF( halfSize, halfSize ) );
pd.setOutputSize( QRectF( 0, 0, size, size ) );
if ( !qgsDoubleNear( angle, 0.0 ) )
{
p.translate( r.defaultSize().width() / 2.0, r.defaultSize().height() / 2.0 );
p.rotate( angle );
p.translate( -r.defaultSize().width() / 2.0, -r.defaultSize().height() / 2.0 );
}
pd.setShift( shift );
pd.setOutputSize( QRectF( -halfSize, -halfSize, size, size ) );
pd.setLayer( layerName );
r.render( &p );
p.end();
Expand Down

0 comments on commit 3fed0d0

Please sign in to comment.