20 mAttributeId = attributeId;
21 mDefaultValue = defaultValue;
22 mToMetricFactor = toMetricFactor;
29 if ( mAttributeId < 0 || mAttributeId >= attrs.count() )
30 return QVariant( distance / ( mDefaultValue * mToMetricFactor ) );
32 double val = distance / ( attrs.at( mAttributeId ).toDouble() * mToMetricFactor );
34 return QVariant( distance / ( mDefaultValue / mToMetricFactor ) );
36 return QVariant( val );
42 l.insert( mAttributeId );
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
QVariant cost(double distance, const QgsFeature &f) const override
Returns edge cost.
QgsNetworkSpeedStrategy(int attributeId, double defaultValue, double toMetricFactor)
Default constructor.
QSet< int > requiredAttributes() const override
Returns a list of the source layer attributes needed for cost calculation.