QGIS API Documentation  3.14.0-Pi (9f7028fd23)
qgsgraphbuilder.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgsgraphbuilder.cpp
3  --------------------------------------
4  Date : 2010-10-25
5  Copyright : (C) 2010 by Yakushev Sergey
6  Email : [email protected]
7 ****************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15 
21 #include "qgsgraphbuilder.h"
22 #include "qgsgraph.h"
23 
24 #include "qgsgeometry.h"
25 
26 QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem &crs, bool otfEnabled, double topologyTolerance, const QString &ellipsoidID )
27  : QgsGraphBuilderInterface( crs, otfEnabled, topologyTolerance, ellipsoidID )
28 {
29  mGraph = new QgsGraph();
30 }
31 
33 {
34  delete mGraph;
35 }
36 
37 void QgsGraphBuilder::addVertex( int, const QgsPointXY &pt )
38 {
39  mGraph->addVertex( pt );
40 }
41 
42 void QgsGraphBuilder::addEdge( int pt1id, const QgsPointXY &, int pt2id, const QgsPointXY &, const QVector< QVariant > &prop )
43 {
44  mGraph->addEdge( pt1id, pt2id, prop );
45 }
46 
48 {
49  QgsGraph *res = mGraph;
50  mGraph = nullptr;
51  return res;
52 }
qgsgraph.h
QgsGraph
Mathematical graph representation.
Definition: qgsgraph.h:141
qgsgraphbuilder.h
QgsGraph::addVertex
int addVertex(const QgsPointXY &pt)
Add a vertex to the graph.
Definition: qgsgraph.cpp:23
crs
const QgsCoordinateReferenceSystem & crs
Definition: qgswfsgetfeature.cpp:105
QgsGraphBuilder::QgsGraphBuilder
QgsGraphBuilder(const QgsCoordinateReferenceSystem &crs, bool otfEnabled=true, double topologyTolerance=0.0, const QString &ellipsoidID="WGS84")
Default constructor.
Definition: qgsgraphbuilder.cpp:26
QgsGraphBuilder::addEdge
void addEdge(int pt1id, const QgsPointXY &pt1, int pt2id, const QgsPointXY &pt2, const QVector< QVariant > &prop) override
Add edge to the graph.
Definition: qgsgraphbuilder.cpp:42
QgsGraphBuilderInterface
Determine interface for creating a graph. Contains the settings of the graph. QgsGraphBuilder and Qgs...
Definition: qgsgraphbuilderinterface.h:40
QgsGraphBuilder::graph
QgsGraph * graph()
Returns generated QgsGraph.
Definition: qgsgraphbuilder.cpp:47
QgsGraphBuilder::~QgsGraphBuilder
~QgsGraphBuilder() override
Definition: qgsgraphbuilder.cpp:32
QgsCoordinateReferenceSystem
Definition: qgscoordinatereferencesystem.h:206
QgsPointXY
Definition: qgspointxy.h:43
qgsgeometry.h
QgsGraphBuilder::addVertex
void addVertex(int id, const QgsPointXY &pt) override
Add vertex to the graph.
Definition: qgsgraphbuilder.cpp:37
QgsGraph::addEdge
int addEdge(int fromVertexIdx, int toVertexIdx, const QVector< QVariant > &strategies)
Add an edge to the graph, going from the fromVertexIdx to toVertexIdx.
Definition: qgsgraph.cpp:29