QgsNetworkStrategy class

QgsNetworkStrategy defines strategy used for calculation of the edge cost.

For example it can take into account travel distance, amount of time or money. Currently there are two strategies implemented in the analysis library: QgsNetworkDistanceStrategy and QgsNetworkSpeedStrategy. QgsNetworkStrategy implemented using "strategy" design pattern.

Derived classes

class QgsNetworkDistanceStrategy
Strategy for calculating edge cost based on its length.
class QgsNetworkSpeedStrategy
Strategy for calculating edge cost based on travel time.

Constructors, destructors, conversion operators

QgsNetworkStrategy() defaulted
Default constructor.

Public functions

auto cost(double distance, const QgsFeature& f) const -> QVariant pure virtual
Returns edge cost.
auto requiredAttributes() const -> QSet<int> virtual
Returns a list of the source layer attributes needed for cost calculation.

Function documentation

QSet<int> QgsNetworkStrategy::requiredAttributes() const virtual

Returns a list of the source layer attributes needed for cost calculation.

This is method called by QgsGraphDirector.