Skip to content
Permalink
Browse files

[processing] use hours as cost units for service area algorithms (fix #…

  • Loading branch information
alexbruy committed Apr 27, 2020
1 parent 74aa54b commit cfcaaefb23d92bf9899acca9b0b4886e62b860c8
@@ -39,7 +39,11 @@ QStringList QgsServiceAreaFromLayerAlgorithm::tags() const

QString QgsServiceAreaFromLayerAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a new vector with all the edges or parts of edges of a network line layer that can be reached within a distance or a time, starting from features of a point layer. The distance and the time (both referred to as \"travel cost\") must be specified respectively in the network layer units or in seconds." );
return QObject::tr( "This algorithm creates a new vector with all the edges or parts of "
"edges of a network line layer that can be reached within a distance "
"or a time, starting from features of a point layer. The distance and "
"the time (both referred to as \"travel cost\") must be specified "
"respectively in the network layer units or in hours." );
}

QgsServiceAreaFromLayerAlgorithm *QgsServiceAreaFromLayerAlgorithm::createInstance() const
@@ -79,6 +83,10 @@ QVariantMap QgsServiceAreaFromLayerAlgorithm::processAlgorithm( const QVariantMa

double travelCost = parameterAsDouble( parameters, QStringLiteral( "TRAVEL_COST" ), context );

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

bool includeBounds = true; // default to true to maintain 3.0 API
if ( parameters.contains( QStringLiteral( "INCLUDE_BOUNDS" ) ) )
{
@@ -39,7 +39,11 @@ QStringList QgsServiceAreaFromPointAlgorithm::tags() const

QString QgsServiceAreaFromPointAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a new vector with all the edges or parts of edges of a network line layer that can be reached within a distance or a time, starting from a point feature. The distance and the time (both referred to as \"travel cost\") must be specified respectively in the network layer units or in seconds." );
return QObject::tr( "This algorithm creates a new vector with all the edges or parts of edges "
"of a network line layer that can be reached within a distance or a time, "
"starting from a point feature. The distance and the time (both referred to "
"as \"travel cost\") must be specified respectively in the network layer "
"units or in hours." );
}

QgsServiceAreaFromPointAlgorithm *QgsServiceAreaFromPointAlgorithm::createInstance() const
@@ -76,6 +80,10 @@ QVariantMap QgsServiceAreaFromPointAlgorithm::processAlgorithm( const QVariantMa
QgsPointXY startPoint = parameterAsPoint( parameters, QStringLiteral( "START_POINT" ), context, mNetwork->sourceCrs() );
double travelCost = parameterAsDouble( parameters, QStringLiteral( "TRAVEL_COST" ), context );

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

bool includeBounds = true; // default to true to maintain 3.0 API
if ( parameters.contains( QStringLiteral( "INCLUDE_BOUNDS" ) ) )
{

0 comments on commit cfcaaef

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