@@ -2356,9 +2356,6 @@ QgsSymbolLayer *QgsSvgMarkerSymbolLayer::createFromSld( QDomElement &element )
23562356
23572357bool QgsSvgMarkerSymbolLayer::writeDxf ( QgsDxfExport &e, double mmMapUnitScaleFactor, const QString &layerName, QgsSymbolRenderContext &context, QPointF shift ) const
23582358{
2359- Q_UNUSED ( layerName );
2360- Q_UNUSED ( shift ); // todo...
2361-
23622359 // size
23632360 double size = mSize ;
23642361
@@ -2388,8 +2385,6 @@ bool QgsSvgMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFa
23882385 size *= mmMapUnitScaleFactor;
23892386 }
23902387
2391- double halfSize = size / 2.0 ;
2392-
23932388 // offset, angle
23942389 QPointF offset = mOffset ;
23952390
@@ -2411,7 +2406,7 @@ bool QgsSvgMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFa
24112406 context.setOriginalValueVariable ( mAngle );
24122407 angle = mDataDefinedProperties .valueAsDouble ( QgsSymbolLayer::PropertyAngle, context.renderContext ().expressionContext (), mAngle ) + mLineAngle ;
24132408 }
2414- // angle = -angle; //rotation in Qt is counterclockwise
2409+
24152410 if ( angle )
24162411 outputOffset = _rotatedOffset ( outputOffset, angle );
24172412
@@ -2450,18 +2445,16 @@ bool QgsSvgMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFa
24502445 const QByteArray &svgContent = QgsApplication::svgCache ()->svgContent ( path, size, fillColor, strokeColor, strokeWidth,
24512446 context.renderContext ().scaleFactor (), mFixedAspectRatio );
24522447
2453- // if current entry image is 0: cache image for entry
2454- // checks to see if image will fit into cache
2455- // update stats for memory usage
24562448 QSvgRenderer r ( svgContent );
24572449 if ( !r.isValid () )
2458- {
24592450 return false ;
2460- }
24612451
24622452 QgsDxfPaintDevice pd ( &e );
24632453 pd.setDrawingSize ( QSizeF ( r.defaultSize () ) );
24642454
2455+ QSizeF outSize ( r.defaultSize () );
2456+ outSize.scale ( size, size, Qt::KeepAspectRatio );
2457+
24652458 QPainter p;
24662459 p.begin ( &pd );
24672460 if ( !qgsDoubleNear ( angle, 0.0 ) )
@@ -2471,7 +2464,7 @@ bool QgsSvgMarkerSymbolLayer::writeDxf( QgsDxfExport &e, double mmMapUnitScaleFa
24712464 p.translate ( -r.defaultSize ().width () / 2.0 , -r.defaultSize ().height () / 2.0 );
24722465 }
24732466 pd.setShift ( shift + QPointF ( outputOffset.x (), -outputOffset.y () ) );
2474- pd.setOutputSize ( QRectF ( -halfSize , -halfSize, size, size ) );
2467+ pd.setOutputSize ( QRectF ( -outSize. width () / 2.0 , -outSize. height () / 2.0 , outSize. width (), outSize. height () ) );
24752468 pd.setLayer ( layerName );
24762469 r.render ( &p );
24772470 p.end ();
0 commit comments