Skip to content

Commit f81b680

Browse files
committedNov 29, 2019
DXF export preserve dashed line style
We do not (yet) support an option to guarantee stroked parts at corners. So also do not set this flag in the DXF export.
1 parent 23fb486 commit f81b680

File tree

4 files changed

+53
-1
lines changed

4 files changed

+53
-1
lines changed
 

‎python/core/auto_additions/qgsdxfexport.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@
2424
QgsDxfExport.HAlign.Undefined.__doc__ = "Undefined"
2525
QgsDxfExport.HAlign.__doc__ = 'Horizontal alignments.\n\n' + '* ``HLeft``: ' + QgsDxfExport.HAlign.HLeft.__doc__ + '\n' + '* ``HCenter``: ' + QgsDxfExport.HAlign.HCenter.__doc__ + '\n' + '* ``HRight``: ' + QgsDxfExport.HAlign.HRight.__doc__ + '\n' + '* ``HAligned``: ' + QgsDxfExport.HAlign.HAligned.__doc__ + '\n' + '* ``HMiddle``: ' + QgsDxfExport.HAlign.HMiddle.__doc__ + '\n' + '* ``HFit``: ' + QgsDxfExport.HAlign.HFit.__doc__ + '\n' + '* ``Undefined``: ' + QgsDxfExport.HAlign.Undefined.__doc__
2626
# --
27+
# monkey patching scoped based enum
28+
QgsDxfExport.DxfPolylineFlag.Closed.__doc__ = "This is a closed polyline (or a polygon mesh closed in the M direction)"
29+
QgsDxfExport.DxfPolylineFlag.Curve.__doc__ = "Curve-fit vertices have been added"
30+
QgsDxfExport.DxfPolylineFlag.Spline.__doc__ = ""
31+
QgsDxfExport.DxfPolylineFlag.Is3DPolyline.__doc__ = "This is a 3D polyline"
32+
QgsDxfExport.DxfPolylineFlag.Is3DPolygonMesh.__doc__ = "This is a 3D polygon mesh"
33+
QgsDxfExport.DxfPolylineFlag.PolygonMesh.__doc__ = "The polygon mesh is closed in the N direction"
34+
QgsDxfExport.DxfPolylineFlag.PolyfaceMesh.__doc__ = "The polyline is a polyface mesh"
35+
QgsDxfExport.DxfPolylineFlag.ContinuousPattern.__doc__ = "The linetype pattern is generated continuously around the vertices of this polyline"
36+
QgsDxfExport.DxfPolylineFlag.__doc__ = '\n\n' + '* ``Closed``: ' + QgsDxfExport.DxfPolylineFlag.Closed.__doc__ + '\n' + '* ``Curve``: ' + QgsDxfExport.DxfPolylineFlag.Curve.__doc__ + '\n' + '* ``Spline``: ' + QgsDxfExport.DxfPolylineFlag.Spline.__doc__ + '\n' + '* ``Is3DPolyline``: ' + QgsDxfExport.DxfPolylineFlag.Is3DPolyline.__doc__ + '\n' + '* ``Is3DPolygonMesh``: ' + QgsDxfExport.DxfPolylineFlag.Is3DPolygonMesh.__doc__ + '\n' + '* ``PolygonMesh``: ' + QgsDxfExport.DxfPolylineFlag.PolygonMesh.__doc__ + '\n' + '* ``PolyfaceMesh``: ' + QgsDxfExport.DxfPolylineFlag.PolyfaceMesh.__doc__ + '\n' + '* ``ContinuousPattern``: ' + QgsDxfExport.DxfPolylineFlag.ContinuousPattern.__doc__
37+
# --

‎python/core/auto_generated/dxf/qgsdxfexport.sip.in

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414

1515

16+
1617
class QgsDxfExport
1718
{
1819

@@ -91,6 +92,21 @@ unique value.
9192
Undefined
9293
};
9394

95+
enum class DxfPolylineFlag
96+
{
97+
Closed,
98+
Curve,
99+
Spline,
100+
Is3DPolyline,
101+
Is3DPolygonMesh,
102+
PolygonMesh,
103+
PolyfaceMesh,
104+
ContinuousPattern,
105+
};
106+
107+
typedef QFlags<QgsDxfExport::DxfPolylineFlag> DxfPolylineFlags;
108+
109+
94110
QgsDxfExport();
95111
%Docstring
96112
Constructor for QgsDxfExport.

‎src/core/dxf/qgsdxfexport.cpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,17 @@ void QgsDxfExport::writePolyline( const QgsCurve &curve, const QString &layer, c
10971097
writeGroup( color );
10981098

10991099
writeGroup( 90, points.size() );
1100-
writeGroup( 70, ( curve.isClosed() ? 1 : 0 ) | ( curve.hasCurvedSegments() ? 2 : 0 ) );
1100+
QgsDxfExport::DxfPolylineFlags polylineFlags;
1101+
if ( curve.isClosed() )
1102+
polylineFlags.setFlag( QgsDxfExport::DxfPolylineFlag::Closed );
1103+
if ( curve.hasCurvedSegments() )
1104+
polylineFlags.setFlag( QgsDxfExport::DxfPolylineFlag::Curve );
1105+
1106+
// Might need to conditional once this feature is implemented
1107+
// https://github.com/qgis/QGIS/issues/32468
1108+
polylineFlags.setFlag( QgsDxfExport::DxfPolylineFlag::ContinuousPattern );
1109+
1110+
writeGroup( 70, static_cast<int>( polylineFlags ) );
11011111
writeGroup( 43, width );
11021112

11031113
for ( int i = 0; i < points.size(); i++ )

‎src/core/dxf/qgsdxfexport.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ namespace pal // SIP_SKIP
4949
class LabelPosition;
5050
}
5151

52+
5253
/**
5354
* \ingroup core
5455
* \class QgsDxfExport
@@ -142,6 +143,20 @@ class CORE_EXPORT QgsDxfExport
142143
Undefined = 9999 //!< Undefined
143144
};
144145

146+
enum class DxfPolylineFlag : int
147+
{
148+
Closed = 1, //!< This is a closed polyline (or a polygon mesh closed in the M direction)
149+
Curve = 2, //!< Curve-fit vertices have been added
150+
Spline = 4, //! < Spline-fit vertices have been added
151+
Is3DPolyline = 8, //!< This is a 3D polyline
152+
Is3DPolygonMesh = 16, //!< This is a 3D polygon mesh
153+
PolygonMesh = 32, //!< The polygon mesh is closed in the N direction
154+
PolyfaceMesh = 64, //!< The polyline is a polyface mesh
155+
ContinuousPattern = 128, //!< The linetype pattern is generated continuously around the vertices of this polyline
156+
};
157+
158+
Q_DECLARE_FLAGS( DxfPolylineFlags, DxfPolylineFlag )
159+
145160
/**
146161
* Constructor for QgsDxfExport.
147162
*/

0 commit comments

Comments
 (0)
Please sign in to comment.