Skip to content

Commit 59a8a8d

Browse files
committed
Python bindings. part2
1 parent 776d7df commit 59a8a8d

File tree

4 files changed

+99
-1
lines changed

4 files changed

+99
-1
lines changed

python/analysis/network/networkanalysis.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
%Include qgsdistancearcproperter.sip
99
%Include qgsgraphbuilderintr.sip
1010
%Include qgsgraphbuilder.sip
11+
%Include qgsgraphdirector.sip
12+
%Include qgslinevectorlayerdirector.sip
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
%ModuleHeaderCode
2+
#include <qgslinevectorlayerdirector.h>
3+
%End
4+
5+
/**
6+
* \ingroup networkanalysis
7+
* \class QgsGraphDirector
8+
* \brief Determine making the graph. QgsGraphBuilder and QgsGraphDirector is a builder patter.
9+
*/
10+
class QgsGraphDirector : QObject
11+
{
12+
%TypeHeaderCode
13+
#include <qgsgraphbuilder.h>
14+
%End
15+
16+
%ConvertToSubClassCode
17+
if ( dynamic_cast< QgsLineVectorLayerDirector* > ( sipCpp ) != NULL )
18+
sipClass = sipClass_QgsLineVectorLayerDirector;
19+
else
20+
sipClass = NULL;
21+
%End
22+
23+
24+
signals:
25+
void buildProgress( int, int ) const;
26+
void buildMessage( QString ) const;
27+
28+
public:
29+
//! Destructor
30+
virtual ~QgsGraphDirector();
31+
32+
/**
33+
* Make a graph using RgGraphBuilder
34+
*
35+
* @param builder The graph builder
36+
*
37+
* @param additionalPoints Vector of points that must be tied to the graph
38+
*
39+
* @param tiedPoints Vector of tied points
40+
*
41+
* @note if tiedPoints[i]==QgsPoint(0.0,0.0) then tied failed.
42+
*/
43+
virtual void makeGraph( QgsGraphBuilderInterface* builder,
44+
const QVector< QgsPoint >& additionalPoints,
45+
QVector< QgsPoint>& tiedPoints /Out/ );
46+
47+
void addProperter( QgsArcProperter* prop ) ;
48+
49+
/**
50+
* return Director name
51+
*/
52+
virtual QString name() const = 0;
53+
};
54+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* \ingroup networkanalysis
3+
* \class QgsLineVectorLayerDirector
4+
* \brief Determine making the graph from vector line layer
5+
*/
6+
class QgsLineVectorLayerDirector : QgsGraphDirector
7+
{
8+
%TypeHeaderCode
9+
#include <qgslinevectorlayerdirector.h>
10+
%End
11+
12+
public:
13+
/**
14+
* @param layerId
15+
* @param directionFieldId feield contain road direction value
16+
* @param directDirectionValue value for one-way road
17+
* @param reverseDirectionValue value for reverse one-way road
18+
* @param bothDirectionValue value for road
19+
* @param defaultDirection 1 - direct direction, 2 - reverse direction, 3 - both direction
20+
*/
21+
QgsLineVectorLayerDirector( const QString& layerId,
22+
int directionFieldId,
23+
const QString& directDirectionValue,
24+
const QString& reverseDirectionValue,
25+
const QString& bothDirectionValue,
26+
int defaultDirection
27+
);
28+
29+
//! Destructor
30+
virtual ~QgsLineVectorLayerDirector();
31+
32+
/*
33+
* MANDATORY DIRECTOR PROPERTY DECLARATION
34+
*/
35+
void makeGraph( QgsGraphBuilderInterface *builder,
36+
const QVector< QgsPoint >& additionalPoints,
37+
QVector< QgsPoint>& tiedPoints /Out/ ) const;
38+
39+
QString name() const;
40+
};
41+

src/analysis/network/qgsgraphdirector.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject
5757
*/
5858
virtual void makeGraph( QgsGraphBuilderInterface* builder,
5959
const QVector< QgsPoint >& additionalPoints,
60-
QVector< QgsPoint>& tiedPoints ) const = 0;
60+
QVector< QgsPoint>& tiedPoints ) const
61+
{}
6162

6263
void addProperter( QgsArcProperter* prop )
6364
{

0 commit comments

Comments
 (0)