00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00017 #include "qgsgraphbuilder.h"
00018 #include "qgsgraph.h"
00019
00020
00021 #include <qgsfeature.h>
00022 #include <qgsgeometry.h>
00023
00024 QgsGraphBuilder::QgsGraphBuilder( const QgsCoordinateReferenceSystem& crs, bool otfEnabled, double topologyTolerance, const QString& ellipsoidID ) :
00025 QgsGraphBuilderInterface( crs, otfEnabled, topologyTolerance, ellipsoidID )
00026 {
00027 mGraph = new QgsGraph();
00028 }
00029
00030 QgsGraphBuilder::~QgsGraphBuilder()
00031 {
00032 if ( mGraph != NULL )
00033 delete mGraph;
00034 }
00035
00036 void QgsGraphBuilder::addVertex( int, const QgsPoint& pt )
00037 {
00038 mGraph->addVertex( pt );
00039 }
00040
00041 void QgsGraphBuilder::addArc( int pt1id, const QgsPoint&, int pt2id, const QgsPoint&, const QVector< QVariant >& prop )
00042 {
00043 mGraph->addArc( pt1id, pt2id, prop );
00044 }
00045
00046 QgsGraph* QgsGraphBuilder::graph()
00047 {
00048 QgsGraph* res = mGraph;
00049 mGraph = NULL;
00050 return res;
00051 }