Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Apr 30, 2020
1 parent 9a53837 commit 744d2d6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/analysis/processing/qgsalgorithmserviceareafromlayer.cpp
Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions src/analysis/processing/qgsalgorithmserviceareafrompoint.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 744d2d6

Please sign in to comment.