QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
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.

Definition at line 40 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 QgsNetworkDistanceStrategy, and QgsNetworkSpeedStrategy.

◆ 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 67 of file qgsnetworkstrategy.h.


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