QGIS/python/analysis/network/qgsgraphanalyzer.sip.in

83 lines
2.8 KiB
Plaintext
Raw Normal View History

2017-05-01 18:04:05 +03:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/network/qgsgraphanalyzer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/
2017-05-03 09:56:04 +03:00
2011-06-03 15:21:02 +06:00
class QgsGraphAnalyzer
{
2017-05-01 18:04:05 +03:00
%Docstring
2017-12-15 10:36:55 -04:00
This class performs graph analysis, e.g. calculates shortest path between two
points using different strategies with Dijkstra algorithm
2011-06-03 15:21:02 +06:00
%End
2017-05-01 18:04:05 +03:00
%TypeHeaderCode
#include "qgsgraphanalyzer.h"
%End
2011-06-03 15:21:02 +06:00
public:
2017-05-01 18:04:05 +03:00
static SIP_PYLIST dijkstra( const QgsGraph *source, int startVertexIdx, int criterionNum, QVector<int> *resultTree = 0, QVector<double> *resultCost = 0 );
2017-05-01 18:04:05 +03:00
%Docstring
2017-12-15 10:36:55 -04:00
Solve shortest path problem using Dijkstra algorithm
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param source: source graph
:param startVertexIdx: index of the start vertex
:param criterionNum: index of the optimization strategy
:param resultTree: array that represents shortest path tree. resultTree[ vertexIndex ] == inboundingArcIndex if vertex reachable, otherwise resultTree[ vertexIndex ] == -1
:param resultCost: array of the paths costs
2017-05-01 18:04:05 +03:00
%End
%MethodCode
2017-05-02 20:36:31 +03:00
QVector< int > treeResult;
QVector< double > costResult;
QgsGraphAnalyzer::dijkstra( a0, a1, a2, &treeResult, &costResult );
2017-05-02 20:36:31 +03:00
PyObject *l1 = PyList_New( treeResult.size() );
if ( l1 == NULL )
{
return NULL;
}
PyObject *l2 = PyList_New( costResult.size() );
if ( l2 == NULL )
{
return NULL;
}
int i;
for ( i = 0; i < costResult.size(); ++i )
{
PyObject *Int = PyLong_FromLong( treeResult[i] );
PyList_SET_ITEM( l1, i, Int );
PyObject *Float = PyFloat_FromDouble( costResult[i] );
PyList_SET_ITEM( l2, i, Float );
}
2017-05-02 20:36:31 +03:00
sipRes = PyTuple_New( 2 );
PyTuple_SET_ITEM( sipRes, 0, l1 );
PyTuple_SET_ITEM( sipRes, 1, l2 );
%End
2011-06-03 15:21:02 +06:00
static QgsGraph *shortestTree( const QgsGraph *source, int startVertexIdx, int criterionNum );
2017-05-01 18:04:05 +03:00
%Docstring
2017-12-15 10:36:55 -04:00
Returns shortest path tree with root-node in startVertexIdx
2017-12-15 21:36:08 -04:00
2017-12-15 10:36:55 -04:00
:param source: source graph
:param startVertexIdx: index of the start vertex
:param criterionNum: index of the optimization strategy
2017-05-01 18:04:05 +03:00
%End
2011-06-03 15:21:02 +06:00
};
2017-05-01 18:04:05 +03:00
/************************************************************************
* This file has been generated automatically from *
* *
* src/analysis/network/qgsgraphanalyzer.h *
* *
* Do not edit manually ! Edit header and run scripts/sipify.pl again *
************************************************************************/