Skip to content

Commit

Permalink
Dxf option 'export with zero width' in processing
Browse files Browse the repository at this point in the history
  • Loading branch information
mhugent authored and nyalldawson committed May 1, 2024
1 parent 97e9929 commit 19ab774
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/analysis/processing/qgsalgorithmdxfexport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ void QgsDxfExportAlgorithm::initAlgorithm( const QVariantMap & )
addParameter( useTitleParam.release() );
addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "FORCE_2D" ), QObject::tr( "Force 2D output" ), false ) );
addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "MTEXT" ), QObject::tr( "Export labels as MTEXT elements" ), true ) );
addParameter( new QgsProcessingParameterBoolean( QStringLiteral( "EXPORT_LINES_WITH_ZERO_WIDTH" ), QObject::tr( "Export lines with zero width" ) ), false );
addParameter( new QgsProcessingParameterFileDestination( QStringLiteral( "OUTPUT" ), QObject::tr( "DXF" ), QObject::tr( "DXF Files" ) + " (*.dxf *.DXF)" ) );
}

Expand Down Expand Up @@ -116,6 +117,7 @@ QVariantMap QgsDxfExportAlgorithm::processAlgorithm( const QVariantMap &paramete
const bool useLayerTitle = parameterAsBool( parameters, QStringLiteral( "USE_LAYER_TITLE" ), context );
const bool useMText = parameterAsBool( parameters, QStringLiteral( "MTEXT" ), context );
const bool force2D = parameterAsBool( parameters, QStringLiteral( "FORCE_2D" ), context );
const bool exportLinesWithZeroWidth = parameterAsBool( parameters, QStringLiteral( "EXPORT_LINES_WITH_ZERO_WIDTH" ), context );

QgsRectangle extent;
if ( parameters.value( QStringLiteral( "EXTENT" ) ).isValid() )
Expand Down Expand Up @@ -145,6 +147,8 @@ QVariantMap QgsDxfExportAlgorithm::processAlgorithm( const QVariantMap &paramete
flags = flags | QgsDxfExport::FlagNoMText;
if ( selectedFeaturesOnly )
flags = flags | QgsDxfExport::FlagOnlySelectedFeatures;
if ( exportLinesWithZeroWidth )
flags = flags | QgsDxfExport::FlagHairlineWidthExport;
dxfExport.setFlags( flags );

QFile dxfFile( outputFile );
Expand Down

0 comments on commit 19ab774

Please sign in to comment.