Class: QgsGraphBuilderInterface

Interface for creating a graph.

Contains the settings of the graph.

QgsGraphBuilder and QgsGraphDirector both use a “builder” design pattern

Class Hierarchy

Inheritance diagram of qgis.analysis.QgsGraphBuilderInterface

Subclasses

QgsGraphBuilder

Used for making the QgsGraph object.

class qgis.analysis.QgsGraphBuilderInterface[source]

Bases: object

__init__(crs: QgsCoordinateReferenceSystem, ctfEnabled: bool = True, topologyTolerance: float = 0, ellipsoidID: str | None = '')

Default constructor

Parameters:
  • crs (QgsCoordinateReferenceSystem) – Coordinate reference system for new graph vertex

  • ctfEnabled (bool = True) – enable coordinate transform from source graph CRS to CRS graph

  • topologyTolerance (float = 0) – sqrt distance between source point as one graph vertex

  • ellipsoidID (Optional[str] = '') – ellipsoid for edge measurement

__init__(a0: QgsGraphBuilderInterface)
Parameters:

a0 (QgsGraphBuilderInterface)

virtual addEdge(self, pt1id: int, pt1: QgsPointXY, pt2id: int, pt2: QgsPointXY, strategies: Iterable[Any])[source]

Add edge to the graph

Parameters:
  • pt1id (int) – first vertex identificator

  • pt1 (QgsPointXY) – first vertex coordinates

  • pt2id (int) – second vertex identificator

  • pt2 (QgsPointXY) – second vertex coordinates

  • strategies (Iterable[Any]) – optimization strategies

Note

pt1id, pt1 and pt2id, pt2 is a redundant interface. You can use vertex coordinates or their identificators.

virtual addVertex(self, id: int, pt: QgsPointXY)[source]

Add vertex to the graph

Parameters:
  • id (int) – vertex identifier

  • pt (QgsPointXY) – vertex coordinates

Note

id and pt are redundant. You can use pt or id to identify the vertex

coordinateTransformationEnabled(self) bool[source]

Returns coordinate transformation enabled

Return type:

bool

destinationCrs(self) QgsCoordinateReferenceSystem[source]

Returns destinaltion CRS

Return type:

QgsCoordinateReferenceSystem

distanceArea(self) QgsDistanceArea | None[source]

Returns measurement tool

Return type:

Optional[QgsDistanceArea]

topologyTolerance(self) float[source]

Returns topology tolerance

Return type:

float