Skip to content

Commit 211399c

Browse files
committedJun 6, 2014
Fix dxf label export
1 parent 0a491b5 commit 211399c

File tree

3 files changed

+13
-7
lines changed

3 files changed

+13
-7
lines changed
 

‎src/core/dxf/qgsdxfexport.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,8 @@ void QgsDxfExport::writeEntities()
585585

586586
bool labelLayer = ( labelEngine.prepareLayer( vl, attributes, ctx ) != 0 );
587587

588-
if ( mSymbologyExport == QgsDxfExport::SymbolLayerSymbology && renderer->usingSymbolLevels() )
588+
if ( mSymbologyExport == QgsDxfExport::SymbolLayerSymbology && ( renderer->capabilities() & QgsFeatureRendererV2::SymbolLevels ) &&
589+
renderer->usingSymbolLevels() )
589590
{
590591
writeEntitiesSymbolLevels( vl );
591592
renderer->stopRender( ctx );
@@ -652,7 +653,6 @@ void QgsDxfExport::writeEntities()
652653
}
653654

654655
labelEngine.drawLabeling( ctx );
655-
656656
endSection();
657657
}
658658

‎src/core/dxf/qgsdxfpallabeling.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,15 +29,19 @@ using namespace pal;
2929
QgsDxfPalLabeling::QgsDxfPalLabeling( QgsDxfExport* dxf, const QgsRectangle& bbox, double scale, QGis::UnitType mapUnits )
3030
: QgsPalLabeling()
3131
, mDxfExport( dxf )
32+
, mImage( 0 )
33+
, mPainter( 0 )
3234
{
33-
QgsMapSettings settings;
34-
settings.setExtent( bbox );
35+
mSettings = new QgsMapSettings;
36+
mSettings->setMapUnits( mapUnits );
37+
mSettings->setExtent( bbox );
3538

3639
int dpi = 96;
3740
double factor = 1000 * dpi / scale / 25.4 * QGis::fromUnitToUnitFactor( mapUnits, QGis::Meters );
38-
settings.setOutputSize( QSize( bbox.width() * factor, bbox.height() * factor ) );
39-
settings.setOutputDpi( dpi );
40-
init( settings );
41+
mSettings->setOutputSize( QSize( bbox.width() * factor, bbox.height() * factor ) );
42+
mSettings->setOutputDpi( dpi );
43+
mSettings->setCrsTransformEnabled( false );
44+
init( *mSettings );
4145

4246
mImage = new QImage( 10, 10, QImage::Format_ARGB32_Premultiplied );
4347
mImage->setDotsPerMeterX( 96 / 25.4 * 1000 );
@@ -54,6 +58,7 @@ QgsDxfPalLabeling::~QgsDxfPalLabeling()
5458
{
5559
delete mPainter;
5660
delete mImage;
61+
delete mSettings;
5762
}
5863

5964
void QgsDxfPalLabeling::drawLabel( pal::LabelPosition* label, QgsRenderContext& context, QgsPalLayerSettings& tmpLyr, DrawLabelType drawType, double dpiRatio )

‎src/core/dxf/qgsdxfpallabeling.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class CORE_EXPORT QgsDxfPalLabeling: public QgsPalLabeling
4040
//only used for render context
4141
QImage* mImage;
4242
QPainter* mPainter;
43+
QgsMapSettings* mSettings;
4344
};
4445

4546
#endif // QGSDXFPALLABELING_H

0 commit comments

Comments
 (0)
Please sign in to comment.