Skip to content
Permalink
Browse files

address review comments

  • Loading branch information
alexbruy committed Apr 29, 2020
1 parent 9a53837 commit 744d2d6b6d12c67f2c2864b06af6763e24e07d0b
@@ -86,12 +86,12 @@ QVariantMap QgsServiceAreaFromLayerAlgorithm::processAlgorithm( const QVariantMa
if ( !startPoints )
throw QgsProcessingException( invalidSourceError( parameters, QStringLiteral( "START_POINTS" ) ) );

double travelCost = parameterAsDouble( parameters, QStringLiteral( "TRAVEL_COST" ), context );
if ( !travelCost )
travelCost = parameterAsDouble( parameters, QStringLiteral( "TRAVEL_COST2" ), context );
// use older deprecated travel cost style if specified, to maintain old api
const bool useOldTravelCost = parameters.value( QStringLiteral( "TRAVEL_COST" ) ).isValid();
double travelCost = parameterAsDouble( parameters, useOldTravelCost ? QStringLiteral( "TRAVEL_COST" ) : QStringLiteral( "TRAVEL_COST2" ), context );

int strategy = parameterAsInt( parameters, QStringLiteral( "STRATEGY" ), context );
if ( strategy )
if ( strategy && !useOldTravelCost )
travelCost *= mMultiplier;

bool includeBounds = true; // default to true to maintain 3.0 API
@@ -83,12 +83,13 @@ QVariantMap QgsServiceAreaFromPointAlgorithm::processAlgorithm( const QVariantMa
loadCommonParams( parameters, context, feedback );

QgsPointXY startPoint = parameterAsPoint( parameters, QStringLiteral( "START_POINT" ), context, mNetwork->sourceCrs() );
double travelCost = parameterAsDouble( parameters, QStringLiteral( "TRAVEL_COST" ), context );
if ( !travelCost )
travelCost = parameterAsDouble( parameters, QStringLiteral( "TRAVEL_COST2" ), context );

// use older deprecated travel cost style if specified, to maintain old api
const bool useOldTravelCost = parameters.value( QStringLiteral( "TRAVEL_COST" ) ).isValid();
double travelCost = parameterAsDouble( parameters, useOldTravelCost ? QStringLiteral( "TRAVEL_COST" ) : QStringLiteral( "TRAVEL_COST2" ), context );

int strategy = parameterAsInt( parameters, QStringLiteral( "STRATEGY" ), context );
if ( strategy )
if ( strategy && !useOldTravelCost )
travelCost *= mMultiplier;

bool includeBounds = true; // default to true to maintain 3.0 API

0 comments on commit 744d2d6

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