Skip to content

Commit a20ae46

Browse files
committed
Fix offset in svg marker dxf export
1 parent dfd8e9a commit a20ae46

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2344,11 +2344,6 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
23442344
}
23452345
double offsetX = offset.x();
23462346
double offsetY = offset.y();
2347-
if ( mSizeUnit == QgsSymbolV2::MM )
2348-
{
2349-
offsetX *= mmMapUnitScaleFactor;
2350-
offsetY *= mmMapUnitScaleFactor;
2351-
}
23522347

23532348
QPointF outputOffset( offsetX, offsetY );
23542349

@@ -2362,6 +2357,8 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
23622357
if ( angle )
23632358
outputOffset = _rotatedOffset( outputOffset, angle );
23642359

2360+
outputOffset *= e.mapUnitScaleFactor( e.symbologyScaleDenominator(), mOffsetUnit, e.mapUnits() );
2361+
23652362
QString path = mPath;
23662363
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_NAME ) )
23672364
{
@@ -2375,7 +2372,7 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
23752372
context.setOriginalValueVariable( mOutlineWidth );
23762373
outlineWidth = evaluateDataDefinedProperty( QgsSymbolLayerV2::EXPR_OUTLINE_WIDTH, context, mOutlineWidth ).toDouble();
23772374
}
2378-
outlineWidth = QgsSymbolLayerV2Utils::convertToPainterUnits( context.renderContext(), outlineWidth, mOutlineWidthUnit, mOutlineWidthMapUnitScale );
2375+
outlineWidth *= e.mapUnitScaleFactor( e.symbologyScaleDenominator(), mOutlineWidthUnit, e.mapUnits() );
23792376

23802377
QColor fillColor = mColor;
23812378
if ( hasDataDefinedProperty( QgsSymbolLayerV2::EXPR_FILL ) )
@@ -2419,7 +2416,7 @@ bool QgsSvgMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitScale
24192416
p.rotate( angle );
24202417
p.translate( -r.defaultSize().width() / 2.0, -r.defaultSize().height() / 2.0 );
24212418
}
2422-
pd.setShift( shift );
2419+
pd.setShift( shift + QPointF( outputOffset.x(), -outputOffset.y() ) );
24232420
pd.setOutputSize( QRectF( -halfSize, -halfSize, size, size ) );
24242421
pd.setLayer( layerName );
24252422
r.render( &p );

0 commit comments

Comments
 (0)