Skip to content
Permalink
Browse files

Correctly resolve project layers to CRS values in widget

  • Loading branch information
nyalldawson committed Dec 20, 2019
1 parent c59af52 commit b11cb7cce799429045ad43dc8d77fb3218094cf0
Showing with 24 additions and 4 deletions.
  1. +24 −4 src/gui/processing/qgsprocessingwidgetwrapperimpl.cpp
@@ -3020,16 +3020,36 @@ QString QgsProcessingCoordinateOperationWidgetWrapper::modelerExpressionFormatSt

void QgsProcessingCoordinateOperationWidgetWrapper::setSourceCrsParameterValue( const QVariant &value )
{
QgsProcessingContext c;
mSourceCrs = QgsProcessingUtils::variantToCrs( value, c );
QgsProcessingContext *context = nullptr;
std::unique_ptr< QgsProcessingContext > tmpContext;
if ( mProcessingContextGenerator )
context = mProcessingContextGenerator->processingContext();

if ( !context )
{
tmpContext = qgis::make_unique< QgsProcessingContext >();
context = tmpContext.get();
}

mSourceCrs = QgsProcessingUtils::variantToCrs( value, *context );
if ( mOperationWidget )
mOperationWidget->setSourceCrs( mSourceCrs );
}

void QgsProcessingCoordinateOperationWidgetWrapper::setDestinationCrsParameterValue( const QVariant &value )
{
QgsProcessingContext c;
mDestCrs = QgsProcessingUtils::variantToCrs( value, c );
QgsProcessingContext *context = nullptr;
std::unique_ptr< QgsProcessingContext > tmpContext;
if ( mProcessingContextGenerator )
context = mProcessingContextGenerator->processingContext();

if ( !context )
{
tmpContext = qgis::make_unique< QgsProcessingContext >();
context = tmpContext.get();
}

mDestCrs = QgsProcessingUtils::variantToCrs( value, *context );
if ( mOperationWidget )
mOperationWidget->setDestinationCrs( mDestCrs );
}

0 comments on commit b11cb7c

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