QGIS API Documentation  3.18.1-Zürich (202f1bf7e5)
Public Member Functions | List of all members
QgsNetworkStrategy Class Referenceabstract

QgsNetworkStrategy defines strategy used for calculation of the edge cost. More...

#include <qgsnetworkstrategy.h>

Inheritance diagram for QgsNetworkStrategy:
Inheritance graph
[legend]

Public Member Functions

 QgsNetworkStrategy ()=default
 Default constructor. More...
 
virtual ~QgsNetworkStrategy ()=default
 
virtual QVariant cost (double distance, const QgsFeature &f) const =0
 Returns edge cost. More...
 
virtual QSet< int > requiredAttributes () const
 Returns a list of the source layer attributes needed for cost calculation. More...
 

Detailed Description

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.

Since
QGIS 3.0

Definition at line 42 of file qgsnetworkstrategy.h.

Constructor & Destructor Documentation

◆ QgsNetworkStrategy()

QgsNetworkStrategy::QgsNetworkStrategy ( )
default

Default constructor.

◆ ~QgsNetworkStrategy()

virtual QgsNetworkStrategy::~QgsNetworkStrategy ( )
virtualdefault

Member Function Documentation

◆ cost()

virtual QVariant QgsNetworkStrategy::cost ( double  distance,
const QgsFeature f 
) const
pure virtual

Returns edge cost.

Implemented in QgsNetworkSpeedStrategy, and QgsNetworkDistanceStrategy.

◆ requiredAttributes()

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

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

This is method called by QgsGraphDirector.

Reimplemented in QgsNetworkSpeedStrategy.

Definition at line 69 of file qgsnetworkstrategy.h.


The documentation for this class was generated from the following file: