QGIS API Documentation  2.8.2-Wien
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
qgsgraphbuilder.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * Copyright (C) 2010 by Sergey Yakushev *
3  * yakushevs <at> list.ru *
4  * *
5  * *
6  * This program is free software; you can redistribute it and/or modify *
7  * it under the terms of the GNU General Public License as published by *
8  * the Free Software Foundation; either version 2 of the License, or *
9  * (at your option) any later version. *
10  ***************************************************************************/
11 
17 #include "qgsgraphbuilder.h"
18 #include "qgsgraph.h"
19 
20 // Qgis includes
21 #include <qgsfeature.h>
22 #include <qgsgeometry.h>
23 
24 QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool otfEnabled, double topologyTolerance, const QString& ellipsoidID ) :
25  QgsGraphBuilderInterface( crs, otfEnabled, topologyTolerance, ellipsoidID )
26 {
27  mGraph = new QgsGraph();
28 }
29 
31 {
32  if ( mGraph != NULL )
33  delete mGraph;
34 }
35 
36 void QgsGraphBuilder::addVertex( int, const QgsPoint& pt )
37 {
38  mGraph->addVertex( pt );
39 }
40 
41 void QgsGraphBuilder::addArc( int pt1id, const QgsPoint&, int pt2id, const QgsPoint&, const QVector< QVariant >& prop )
42 {
43  mGraph->addArc( pt1id, pt2id, prop );
44 }
45 
47 {
48  QgsGraph* res = mGraph;
49  mGraph = NULL;
50  return res;
51 }