Skip to content

Commit

Permalink
Dxf export: fix offset and offset rotation for simple marker
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent committed Mar 27, 2018
1 parent 2235bf5 commit c53968f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/core/symbology-ng/qgsmarkersymbollayerv2.cpp
Expand Up @@ -1335,6 +1335,8 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
double offsetX = 0;
double offsetY = 0;
markerOffset( context, offsetX, offsetY );
offsetX *= context.renderContext().mapToPixel().mapUnitsPerPixel();
offsetY *= context.renderContext().mapToPixel().mapUnitsPerPixel();

QPointF off( offsetX, offsetY );

Expand All @@ -1359,14 +1361,13 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
}
}

angle = -angle; //rotation in Qt is counterclockwise
if ( angle )
off = _rotatedOffset( off, angle );

off *= e.mapUnitScaleFactor( e.symbologyScaleDenominator(), mSizeUnit, e.mapUnits() );

QTransform t;
t.translate( shift.x() + offsetX, shift.y() - offsetY );
t.translate( shift.x() + off.x(), shift.y() - off.y() );

if ( !qgsDoubleNear( angle, 0.0 ) )
t.rotate( angle );
Expand Down

0 comments on commit c53968f

Please sign in to comment.