Quantum GIS API Documentation
1.8
|
00001 /*************************************************************************** 00002 * Copyright (C) 2010 by Sergey Yakushev * 00003 * yakushevs <at> list.ru * 00004 * * 00005 * * 00006 * This program is free software; you can redistribute it and/or modify * 00007 * it under the terms of the GNU General Public License as published by * 00008 * the Free Software Foundation; either version 2 of the License, or * 00009 * (at your option) any later version. * 00010 ***************************************************************************/ 00011 00017 #include "qgsgraphbuilder.h" 00018 #include "qgsgraph.h" 00019 00020 // Qgis includes 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 }