Skip to content

Commit b73ac0f

Browse files
committedApr 12, 2018
Support more QgsMapUnitScale properties in dxf export
1 parent 505822f commit b73ac0f

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed
 

‎src/core/symbology-ng/qgslinesymbollayerv2.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,12 +622,13 @@ double QgsSimpleLineSymbolLayerV2::dxfWidth( const QgsDxfExport& e, QgsSymbolV2R
622622
context.setOriginalValueVariable( mWidth );
623623
width = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_WIDTH, context, mWidth ).toDouble();
624624
}
625-
else if ( context.renderHints() & QgsSymbolV2::DataDefinedSizeScale )
625+
626+
width *= e.mapUnitScaleFactor( e.symbologyScaleDenominator(), widthUnit(), e.mapUnits(), context.renderContext().mapToPixel().mapUnitsPerPixel() );
627+
if ( mWidthUnit == QgsSymbolV2::MapUnit )
626628
{
627-
width = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), mWidth, mWidthUnit, mWidthMapUnitScale );
629+
e.clipValueToMapUnitScale( width, mWidthMapUnitScale, context.renderContext().scaleFactor() );
628630
}
629-
630-
return width * e.mapUnitScaleFactor( e.symbologyScaleDenominator(), widthUnit(), e.mapUnits(), context.renderContext().mapToPixel().mapUnitsPerPixel() );
631+
return width;
631632
}
632633

633634
QColor QgsSimpleLineSymbolLayerV2::dxfColor( QgsSymbolV2RenderContext& context ) const

‎src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1316,6 +1316,10 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
13161316
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
13171317
}
13181318
outlineWidth *= e.mapUnitScaleFactor( e.symbologyScaleDenominator(), mOutlineWidthUnit, e.mapUnits(), context.renderContext().mapToPixel().mapUnitsPerPixel() );
1319+
if ( mOutlineWidthUnit == QgsSymbolV2::MapUnit )
1320+
{
1321+
e.clipValueToMapUnitScale( outlineWidth, mOutlineWidthMapUnitScale, context.renderContext().scaleFactor() );
1322+
}
13191323

13201324
//color
13211325
QColor pc = mPen.color();

0 commit comments

Comments
 (0)
Please sign in to comment.