Class: QgsNetworkStrategy¶
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.
Class Hierarchy¶
Subclasses¶
Strategy for calculating edge cost based on its length. Should be used for finding shortest path between two points. |
|
Strategy for calculating edge cost based on travel time. Should be used for finding fastest path between two points. |
Methods
Returns edge cost |
|
Returns a list of the source layer attributes needed for cost calculation. |
- class qgis.analysis.QgsNetworkStrategy[source]¶
Bases:
object
- cost(self, distance: float, f: QgsFeature) Any [source]¶
Returns edge cost
- Parameters:
distance (float)
f (QgsFeature)
- Return type:
Any
- requiredAttributes(self) Any ¶
Returns a list of the source layer attributes needed for cost calculation. This is method called by
QgsGraphDirector
.- Return type:
Any