Skip to content

Commit

Permalink
Python bindings. part2
Browse files Browse the repository at this point in the history
  • Loading branch information
stopa85milk committed Jun 2, 2011
1 parent 776d7df commit 59a8a8d
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1 deletion.
2 changes: 2 additions & 0 deletions python/analysis/network/networkanalysis.sip
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@
%Include qgsdistancearcproperter.sip
%Include qgsgraphbuilderintr.sip
%Include qgsgraphbuilder.sip
%Include qgsgraphdirector.sip
%Include qgslinevectorlayerdirector.sip
54 changes: 54 additions & 0 deletions python/analysis/network/qgsgraphdirector.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
%ModuleHeaderCode
#include <qgslinevectorlayerdirector.h>
%End

/**
* \ingroup networkanalysis
* \class QgsGraphDirector
* \brief Determine making the graph. QgsGraphBuilder and QgsGraphDirector is a builder patter.
*/
class QgsGraphDirector : QObject
{
%TypeHeaderCode
#include <qgsgraphbuilder.h>
%End

%ConvertToSubClassCode
if ( dynamic_cast< QgsLineVectorLayerDirector* > ( sipCpp ) != NULL )
sipClass = sipClass_QgsLineVectorLayerDirector;
else
sipClass = NULL;
%End


signals:
void buildProgress( int, int ) const;
void buildMessage( QString ) const;

public:
//! Destructor
virtual ~QgsGraphDirector();

/**
* Make a graph using RgGraphBuilder
*
* @param builder The graph builder
*
* @param additionalPoints Vector of points that must be tied to the graph
*
* @param tiedPoints Vector of tied points
*
* @note if tiedPoints[i]==QgsPoint(0.0,0.0) then tied failed.
*/
virtual void makeGraph( QgsGraphBuilderInterface* builder,
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints /Out/ );

void addProperter( QgsArcProperter* prop ) ;

/**
* return Director name
*/
virtual QString name() const = 0;
};

41 changes: 41 additions & 0 deletions python/analysis/network/qgslinevectorlayerdirector.sip
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/**
* \ingroup networkanalysis
* \class QgsLineVectorLayerDirector
* \brief Determine making the graph from vector line layer
*/
class QgsLineVectorLayerDirector : QgsGraphDirector
{
%TypeHeaderCode
#include <qgslinevectorlayerdirector.h>
%End

public:
/**
* @param layerId
* @param directionFieldId feield contain road direction value
* @param directDirectionValue value for one-way road
* @param reverseDirectionValue value for reverse one-way road
* @param bothDirectionValue value for road
* @param defaultDirection 1 - direct direction, 2 - reverse direction, 3 - both direction
*/
QgsLineVectorLayerDirector( const QString& layerId,
int directionFieldId,
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
int defaultDirection
);

//! Destructor
virtual ~QgsLineVectorLayerDirector();

/*
* MANDATORY DIRECTOR PROPERTY DECLARATION
*/
void makeGraph( QgsGraphBuilderInterface *builder,
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints /Out/ ) const;

QString name() const;
};

3 changes: 2 additions & 1 deletion src/analysis/network/qgsgraphdirector.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject
*/
virtual void makeGraph( QgsGraphBuilderInterface* builder,
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints ) const = 0;
QVector< QgsPoint>& tiedPoints ) const
{}

void addProperter( QgsArcProperter* prop )
{
Expand Down

0 comments on commit 59a8a8d

Please sign in to comment.