mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Python bindings. Part 3
This commit is contained in:
parent
032937ff7d
commit
38aa771b7e
@ -10,3 +10,4 @@
|
||||
%Include qgsgraphbuilder.sip
|
||||
%Include qgsgraphdirector.sip
|
||||
%Include qgslinevectorlayerdirector.sip
|
||||
%Include qgsgraphanalyzer.sip
|
||||
|
27
python/analysis/network/qgsgraphanalyzer.sip
Normal file
27
python/analysis/network/qgsgraphanalyzer.sip
Normal file
@ -0,0 +1,27 @@
|
||||
class QgsGraphAnalyzer
|
||||
{
|
||||
%TypeHeaderCode
|
||||
#include <qgsgraphanalyzer.h>
|
||||
%End
|
||||
|
||||
public:
|
||||
/**
|
||||
* solve shortest path problem using dijkstra algorithm
|
||||
* @param source The source graph
|
||||
* @param startVertexIdx index of start vertex
|
||||
* @param criterionNum index of edge property as optimization criterion
|
||||
* @param destPointCost array of vertex indexes. Function calculating shortest path costs for vertices with these indexes
|
||||
* @param cost array of cost paths
|
||||
* @param treeResult return shortest path tree
|
||||
*/
|
||||
// static void shortestpath( const QgsGraph* source, int startVertexIdx, int criterionNum, const QVector<int>& destPointCost, QVector<double>& cost, QgsGraph* treeResult );
|
||||
|
||||
/**
|
||||
* return shortest path tree with root-node in startVertexIdx
|
||||
* @param source The source graph
|
||||
* @param startVertexIdx index of start vertex
|
||||
* @param criterionNum index of edge property as optimization criterion
|
||||
*/
|
||||
static QgsGraph* shortestTree( const QgsGraph* source, int startVertexIdx, int criterionNum );
|
||||
};
|
||||
|
@ -102,3 +102,13 @@ void QgsGraphAnalyzer::shortestpath( const QgsGraph* source, int startPointIdx,
|
||||
cost[i] = result[ destPointCost[i] ].first;
|
||||
}
|
||||
}
|
||||
|
||||
QgsGraph* QgsGraphAnalyzer::shortestTree( const QgsGraph* source, int startVertexIdx, int criterionNum)
|
||||
{
|
||||
QgsGraph *g = new QgsGraph;
|
||||
QVector<int> v;
|
||||
QVector<double> vv;
|
||||
QgsGraphAnalyzer::shortestpath( source, startVertexIdx, criterionNum, v, vv, g );
|
||||
|
||||
return g;
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ class QgsGraph;
|
||||
* The QGis class provides graph analysis functions
|
||||
*/
|
||||
|
||||
class QgsGraphAnalyzer
|
||||
class ANALYSIS_EXPORT QgsGraphAnalyzer
|
||||
{
|
||||
public:
|
||||
/**
|
||||
@ -41,6 +41,13 @@ class QgsGraphAnalyzer
|
||||
* @param treeResult return shortest path tree
|
||||
*/
|
||||
static void shortestpath( const QgsGraph* source, int startVertexIdx, int criterionNum, const QVector<int>& destPointCost, QVector<double>& cost, QgsGraph* treeResult );
|
||||
|
||||
|
||||
/**
|
||||
* return shortest path tree with root-node in startVertexIdx
|
||||
* @param source The source graph
|
||||
* @param startVertexIdx index of start vertex
|
||||
* @param criterionNum index of edge property as optimization criterion
|
||||
*/
|
||||
static QgsGraph* shortestTree( const QgsGraph* source, int startVertexIdx, int criterionNum );
|
||||
};
|
||||
#endif //QGSGRAPHANALYZERH
|
||||
|
Loading…
x
Reference in New Issue
Block a user