Skip to content

Commit

Permalink
Fix dxf export when CRS is not canvas CRS and not limiting to canvas …
Browse files Browse the repository at this point in the history
…extent

(cherry-picked from 0b47ea8)
  • Loading branch information
nyalldawson committed Oct 11, 2017
1 parent c665a9f commit da858ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/core/dxf/qgsdxfexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,10 @@ int QgsDxfExport::writeToFile( QIODevice* d, const QString& encoding )
mTextStream.setDevice( d );
mTextStream.setCodec( encoding.toLocal8Bit() );

if ( mCrs >= 0 )
mMapSettings.setDestinationCrs( QgsCRSCache::instance()->crsBySrsId( mCrs ) );
mMapSettings.setCrsTransformEnabled( mCrs >= 0 );

if ( mExtent.isEmpty() )
{
Q_FOREACH ( QString id, mMapSettings.layers() )
Expand Down Expand Up @@ -553,9 +557,6 @@ int QgsDxfExport::writeToFile( QIODevice* d, const QString& encoding )
mFactor = 1000 * dpi / mSymbologyScaleDenominator / 25.4 * QgsUnitTypes::fromUnitToUnitFactor( mMapUnits, QGis::Meters );
mMapSettings.setOutputSize( QSize( mExtent.width() * mFactor, mExtent.height() * mFactor ) );
mMapSettings.setOutputDpi( dpi );
if ( mCrs >= 0 )
mMapSettings.setDestinationCrs( QgsCRSCache::instance()->crsBySrsId( mCrs ) );
mMapSettings.setCrsTransformEnabled( mCrs >= 0 );

writeHeader( dxfEncoding( encoding ) );
writeTables();
Expand Down

0 comments on commit da858ee

Please sign in to comment.