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.
This commit is contained in:
Matthias Kuhn 2019-11-29 17:56:19 +01:00
parent 23fb486965
commit f81b680aa1
4 changed files with 53 additions and 1 deletions

View File

@ -24,3 +24,14 @@ QgsDxfExport.HAlign.HFit.__doc__ = "Fit into point = (5) (if VAlign==0)"
QgsDxfExport.HAlign.Undefined.__doc__ = "Undefined"
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__
# --
# monkey patching scoped based enum
QgsDxfExport.DxfPolylineFlag.Closed.__doc__ = "This is a closed polyline (or a polygon mesh closed in the M direction)"
QgsDxfExport.DxfPolylineFlag.Curve.__doc__ = "Curve-fit vertices have been added"
QgsDxfExport.DxfPolylineFlag.Spline.__doc__ = ""
QgsDxfExport.DxfPolylineFlag.Is3DPolyline.__doc__ = "This is a 3D polyline"
QgsDxfExport.DxfPolylineFlag.Is3DPolygonMesh.__doc__ = "This is a 3D polygon mesh"
QgsDxfExport.DxfPolylineFlag.PolygonMesh.__doc__ = "The polygon mesh is closed in the N direction"
QgsDxfExport.DxfPolylineFlag.PolyfaceMesh.__doc__ = "The polyline is a polyface mesh"
QgsDxfExport.DxfPolylineFlag.ContinuousPattern.__doc__ = "The linetype pattern is generated continuously around the vertices of this polyline"
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__
# --

View File

@ -13,6 +13,7 @@
class QgsDxfExport
{
@ -91,6 +92,21 @@ unique value.
Undefined
};
enum class DxfPolylineFlag
{
Closed,
Curve,
Spline,
Is3DPolyline,
Is3DPolygonMesh,
PolygonMesh,
PolyfaceMesh,
ContinuousPattern,
};
typedef QFlags<QgsDxfExport::DxfPolylineFlag> DxfPolylineFlags;
QgsDxfExport();
%Docstring
Constructor for QgsDxfExport.

View File

@ -1097,7 +1097,17 @@ void QgsDxfExport::writePolyline( const QgsCurve &curve, const QString &layer, c
writeGroup( color );
writeGroup( 90, points.size() );
writeGroup( 70, ( curve.isClosed() ? 1 : 0 ) | ( curve.hasCurvedSegments() ? 2 : 0 ) );
QgsDxfExport::DxfPolylineFlags polylineFlags;
if ( curve.isClosed() )
polylineFlags.setFlag( QgsDxfExport::DxfPolylineFlag::Closed );
if ( curve.hasCurvedSegments() )
polylineFlags.setFlag( QgsDxfExport::DxfPolylineFlag::Curve );
// Might need to conditional once this feature is implemented
// https://github.com/qgis/QGIS/issues/32468
polylineFlags.setFlag( QgsDxfExport::DxfPolylineFlag::ContinuousPattern );
writeGroup( 70, static_cast<int>( polylineFlags ) );
writeGroup( 43, width );
for ( int i = 0; i < points.size(); i++ )

View File

@ -49,6 +49,7 @@ namespace pal // SIP_SKIP
class LabelPosition;
}
/**
* \ingroup core
* \class QgsDxfExport
@ -142,6 +143,20 @@ class CORE_EXPORT QgsDxfExport
Undefined = 9999 //!< Undefined
};
enum class DxfPolylineFlag : int
{
Closed = 1, //!< This is a closed polyline (or a polygon mesh closed in the M direction)
Curve = 2, //!< Curve-fit vertices have been added
Spline = 4, //! < Spline-fit vertices have been added
Is3DPolyline = 8, //!< This is a 3D polyline
Is3DPolygonMesh = 16, //!< This is a 3D polygon mesh
PolygonMesh = 32, //!< The polygon mesh is closed in the N direction
PolyfaceMesh = 64, //!< The polyline is a polyface mesh
ContinuousPattern = 128, //!< The linetype pattern is generated continuously around the vertices of this polyline
};
Q_DECLARE_FLAGS( DxfPolylineFlags, DxfPolylineFlag )
/**
* Constructor for QgsDxfExport.
*/