Class: QgsGraphDirector

Determine making the graph. QgsGraphBuilder and QgsGraphDirector implemented using “builder” design patter.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: name()

Class Hierarchy

Inheritance diagram of qgis.analysis.QgsGraphDirector

Base classes

QObject

Subclasses

QgsVectorLayerDirector

Determines creating a graph from a vector line layer.

Abstract Methods

name

Returns director name

Methods

addStrategy

Add optimization strategy

Virtual Methods

In PyQGIS, only methods marked as virtual can be safely overridden in a Python subclass of QgsGraphDirector. See the FAQ for more details.

makeGraph

Make a graph using QgsGraphBuilder

class qgis.analysis.QgsGraphDirector[source]

Bases: QObject

addStrategy(self, prop: QgsNetworkStrategy | None)[source]

Add optimization strategy

Parameters:

prop (Optional[QgsNetworkStrategy])

virtual makeGraph(self, builder: QgsGraphBuilderInterface | None, additionalPoints: Iterable[QgsPointXY], feedback: QgsFeedback | None = None) List[QgsPointXY][source]

Make a graph using QgsGraphBuilder

Parameters:
  • builder (Optional[QgsGraphBuilderInterface]) – the graph builder

  • additionalPoints (Iterable[QgsPointXY]) – list of points that should be snapped to the graph

  • feedback (Optional[QgsFeedback] = None) – feedback object for reporting progress

Note

if snappedPoints[i] == QgsPointXY(0.0,0.0) then snapping failed.

Return type:

List[QgsPointXY]

Returns:

list of snapped points

abstract name(self) str[source]

Returns director name

Return type:

str