QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
analysis
network
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 : YakushevS@list.ru
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
16
#include "
qgsgraphbuilder.h
"
17
18
#include "
qgsgraph.h
"
19
20
QgsGraphBuilder::QgsGraphBuilder
(
const
QgsCoordinateReferenceSystem
&crs,
bool
otfEnabled,
double
topologyTolerance
,
const
QString &ellipsoidID )
21
:
QgsGraphBuilderInterface
( crs, otfEnabled,
topologyTolerance
, ellipsoidID )
22
, mGraph( std::make_unique<
QgsGraph
>() )
23
{}
24
25
QgsGraphBuilder::~QgsGraphBuilder
() =
default
;
26
27
int
QgsGraphBuilder::addVertex
(
int
,
const
QgsPointXY
&pt )
28
{
29
return
mGraph->addVertex( pt );
30
}
31
32
void
QgsGraphBuilder::addEdge
(
int
pt1id,
const
QgsPointXY
&,
int
pt2id,
const
QgsPointXY
&,
const
QVector<QVariant> &prop )
33
{
34
mGraph->addEdge( pt1id, pt2id, prop );
35
}
36
37
QgsGraph
QgsGraphBuilder::graph
()
const
38
{
39
return
*mGraph;
40
}
41
42
std::unique_ptr< QgsGraph >
QgsGraphBuilder::takeGraph
()
43
{
44
std::unique_ptr< QgsGraph > res = std::move( mGraph );
45
46
// create a new graph in case this builder is used for additional work
47
mGraph = std::make_unique<QgsGraph>();
48
49
return
res;
50
}
QgsCoordinateReferenceSystem
Represents a coordinate reference system (CRS).
Definition
qgscoordinatereferencesystem.h:216
QgsGraphBuilderInterface::QgsGraphBuilderInterface
QgsGraphBuilderInterface(const QgsCoordinateReferenceSystem &crs, bool ctfEnabled=true, double topologyTolerance=0.0, const QString &ellipsoidID="WGS84")
Default constructor.
Definition
qgsgraphbuilderinterface.cpp:20
QgsGraphBuilderInterface::topologyTolerance
double topologyTolerance() const
Returns topology tolerance.
Definition
qgsgraphbuilderinterface.h:73
QgsGraphBuilder::~QgsGraphBuilder
~QgsGraphBuilder() override
QgsGraphBuilder::QgsGraphBuilder
QgsGraphBuilder(const QgsCoordinateReferenceSystem &crs, bool otfEnabled=true, double topologyTolerance=0.0, const QString &ellipsoidID="WGS84")
Default constructor.
Definition
qgsgraphbuilder.cpp:20
QgsGraphBuilder::addVertex
int addVertex(int id, const QgsPointXY &pt) override
Add vertex to the graph.
Definition
qgsgraphbuilder.cpp:27
QgsGraphBuilder::graph
QgsGraph graph() const
Returns the generated QgsGraph.
Definition
qgsgraphbuilder.cpp:37
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:32
QgsGraphBuilder::takeGraph
std::unique_ptr< QgsGraph > takeGraph()
Takes the generated graph from the builder, resetting the builder back to its initial state ready for...
Definition
qgsgraphbuilder.cpp:42
QgsGraph
Mathematical graph representation.
Definition
qgsgraph.h:131
QgsPointXY
Represents a 2D point.
Definition
qgspointxy.h:62
qgsgraph.h
qgsgraphbuilder.h
Generated on
for QGIS API Documentation by
1.17.0