Skip to content

Commit 35beddf

Browse files
committed
Export more simple markers to dxf
1 parent c55c412 commit 35beddf

File tree

1 file changed

+63
-1
lines changed

1 file changed

+63
-1
lines changed

src/core/symbology-ng/qgsmarkersymbollayerv2.cpp

+63-1
Original file line numberDiff line numberDiff line change
@@ -757,13 +757,25 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
757757
break;
758758
}
759759
}
760-
761760
if ( mSizeUnit == QgsSymbolV2::MM )
762761
{
763762
size *= mmMapUnitScaleFactor;
764763
}
765764
double halfSize = size / 2.0;
766765

766+
//outlineWidth
767+
double outlineWidth = mOutlineWidth;
768+
QgsExpression* outlineWidthExpression = expression( "outline_width" );
769+
if ( outlineWidthExpression )
770+
{
771+
outlineWidth = outlineWidthExpression->evaluate( const_cast<QgsFeature*>( context->feature() ) ).toDouble();
772+
}
773+
if ( mSizeUnit == QgsSymbolV2::MM )
774+
{
775+
outlineWidth *= mmMapUnitScaleFactor;
776+
}
777+
778+
//color
767779
QColor c = mPen.color();
768780
if ( mPen.style() == Qt::NoPen )
769781
{
@@ -833,6 +845,56 @@ bool QgsSimpleMarkerSymbolLayerV2::writeDxf( QgsDxfExport& e, double mmMapUnitSc
833845
QPointF pt4 = t.map( QPointF( halfSize, 0 ) );
834846
e.writeSolid( layerName, colorIndex, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ) );
835847
}
848+
else if ( mName == "triangle" )
849+
{
850+
QPointF pt1 = t.map( QPointF( -halfSize, -halfSize ) );
851+
QPointF pt2 = t.map( QPointF( halfSize, -halfSize ) );
852+
QPointF pt3 = t.map( QPointF( 0, halfSize ) );
853+
e.writeSolid( layerName, colorIndex, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt3.x(), pt3.y() ) );
854+
}
855+
/*else if( mName == "equilateral_triangle" )
856+
{
857+
858+
}*/
859+
else if ( mName == "line" )
860+
{
861+
QPointF pt1 = t.map( QPointF( 0, halfSize ) );
862+
QPointF pt2 = t.map( QPointF( 0, -halfSize ) );
863+
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
864+
}
865+
else if ( mName == "coss" )
866+
{
867+
QPointF pt1 = t.map( QPointF( -halfSize, 0 ) );
868+
QPointF pt2 = t.map( QPointF( halfSize, 0 ) );
869+
QPointF pt3 = t.map( QPointF( 0, -halfSize ) );
870+
QPointF pt4 = t.map( QPointF( 0, halfSize ) );
871+
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
872+
e.writeLine( QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
873+
}
874+
else if ( mName == "x" || mName == "cross2" )
875+
{
876+
QPointF pt1 = t.map( QPointF( -halfSize, -halfSize ) );
877+
QPointF pt2 = t.map( QPointF( halfSize, halfSize ) );
878+
QPointF pt3 = t.map( QPointF( -halfSize, halfSize ) );
879+
QPointF pt4 = t.map( QPointF( halfSize, -halfSize ) );
880+
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
881+
e.writeLine( QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt4.x(), pt4.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
882+
}
883+
else if ( mName == "arrowhead" )
884+
{
885+
QPointF pt1 = t.map( QPointF( -halfSize, halfSize ) );
886+
QPointF pt2 = t.map( QPointF( 0, 0 ) );
887+
QPointF pt3 = t.map( QPointF( -halfSize, -halfSize ) );
888+
e.writeLine( QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
889+
e.writeLine( QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt2.x(), pt2.y() ), layerName, "CONTINUOUS", colorIndex, outlineWidth );
890+
}
891+
else if ( mName == "filled_arrowhead" )
892+
{
893+
QPointF pt1 = t.map( QPointF( -halfSize, halfSize ) );
894+
QPointF pt2 = t.map( QPointF( 0, 0 ) );
895+
QPointF pt3 = t.map( QPointF( -halfSize, -halfSize ) );
896+
e.writeSolid( layerName, colorIndex, QgsPoint( pt1.x(), pt1.y() ), QgsPoint( pt2.x(), pt2.y() ), QgsPoint( pt3.x(), pt3.y() ), QgsPoint( pt3.x(), pt3.y() ) );
897+
}
836898
else
837899
{
838900
return false;

0 commit comments

Comments
 (0)