Class: QgsNetworkStrategy¶
Defines strategy used for calculation of the edge cost in networks.
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.
Note
This is an abstract class, with methods which must be implemented by a subclass.
The following methods must be implemented: cost()
Class Hierarchy¶
Subclasses¶
Strategy for calculating edge cost based on its length. |
|
Strategy for calculating edge cost based on travel time. |
- class qgis.analysis.QgsNetworkStrategy[source]¶
Bases:
object- abstract cost(self, distance: float, f: QgsFeature) Any[source]¶
Returns edge cost
- Parameters:
distance (float)
f (QgsFeature)
- Return type:
- virtual requiredAttributes(self) Any¶
Returns a list of the source layer attributes needed for cost calculation. This is method called by
QgsGraphDirector.- Return type: