Skip to content
Permalink
Browse files

address remaining review comments

  • Loading branch information
alexbruy committed Nov 2, 2020
1 parent 3651365 commit 24f2c621a9d7ba979311cf7271b5e57d4ee56e77
@@ -71,7 +71,6 @@ void QgsDxfExportAlgorithm::initAlgorithm( const QVariantMap & )
QVariantMap QgsDxfExportAlgorithm::processAlgorithm( const QVariantMap &parameters, QgsProcessingContext &context, QgsProcessingFeedback *feedback )
{
QgsMapSettings mapSettings;
mapSettings.setDestinationCrs( context.project()->crs() );
mapSettings.setTransformContext( context.transformContext() );

QList<QgsVectorLayer *> mapLayers;
@@ -23,7 +23,6 @@
#include <QToolButton>

#include "qgspanelwidget.h"
#include "qgsprocessingcontext.h"
#include "qgsprocessingparameters.h"
#include "qgsprocessingoutputs.h"
#include "qgsprocessingparameterdxflayers.h"
@@ -40,10 +39,9 @@ QgsProcessingDxfLayerDetailsWidget::QgsProcessingDxfLayerDetailsWidget( const QV

mFieldsComboBox->setAllowEmptyFieldName( true );

QgsProcessingContext context;
context.setProject( project );
mContext.setProject( project );

QgsDxfExport::DxfLayer layer = QgsProcessingParameterDxfLayers::variantMapAsLayer( value.toMap(), context );
QgsDxfExport::DxfLayer layer = QgsProcessingParameterDxfLayers::variantMapAsLayer( value.toMap(), mContext );
mLayer = layer.layer();

if ( !mLayer )
@@ -81,14 +79,13 @@ QgsProcessingDxfLayersPanelWidget::QgsProcessingDxfLayersPanelWidget(
buttonBox()->addButton( configureLayerButton, QDialogButtonBox::ActionRole );

// populate the list: first layers already selected, then layers from project not yet selected
QgsProcessingContext context;
context.setProject( project );
mContext.setProject( project );

QSet<const QgsVectorLayer *> seenVectorLayers;
const QVariantList valueList = value.toList();
for ( const QVariant &v : valueList )
{
QgsDxfExport::DxfLayer layer = QgsProcessingParameterDxfLayers::variantMapAsLayer( v.toMap(), context );
QgsDxfExport::DxfLayer layer = QgsProcessingParameterDxfLayers::variantMapAsLayer( v.toMap(), mContext );
if ( !layer.layer() )
continue; // skip any invalid layers

@@ -155,10 +152,9 @@ void QgsProcessingDxfLayersPanelWidget::configureLayer()

void QgsProcessingDxfLayersPanelWidget::setItemValue( QStandardItem *item, const QVariant &value )
{
QgsProcessingContext context;
context.setProject( mProject );
mContext.setProject( mProject );

QgsDxfExport::DxfLayer layer = QgsProcessingParameterDxfLayers::variantMapAsLayer( value.toMap(), context );
QgsDxfExport::DxfLayer layer = QgsProcessingParameterDxfLayers::variantMapAsLayer( value.toMap(), mContext );

item->setText( titleForLayer( layer ) );
item->setData( value, Qt::UserRole );
@@ -18,6 +18,7 @@

#define SIP_NO_FILE

#include "qgsprocessingcontext.h"
#include "qgsprocessingwidgetwrapper.h"
#include "qgsprocessingmultipleselectiondialog.h"
#include "qgsdxfexport.h"
@@ -40,6 +41,7 @@ class GUI_EXPORT QgsProcessingDxfLayerDetailsWidget : public QgsPanelWidget, pri

private:
QgsVectorLayer *mLayer = nullptr;
QgsProcessingContext mContext;
};


@@ -66,6 +68,7 @@ class GUI_EXPORT QgsProcessingDxfLayersPanelWidget : public QgsProcessingMultipl
QString titleForLayer( const QgsDxfExport::DxfLayer &layer );

QgsProject *mProject = nullptr;
QgsProcessingContext mContext;
};


0 comments on commit 24f2c62

Please sign in to comment.
You can’t perform that action at this time.