Skip to content
Permalink
Browse files

using only 'vertex/arc' notation

  • Loading branch information
Sergey Yakushevs
Sergey Yakushevs committed Jun 1, 2011
1 parent 79f3911 commit 4616b8e15583f72e52b334b931a861997825c4af
@@ -6,7 +6,7 @@
SET(QGIS_NETWORK_ANALYSIS_SRCS
qgsgraph.cpp
qgsgraphbuilder.cpp
qgsdistanceedgeproperter.cpp
qgsdistancearcproperter.cpp
qgslinevectorlayerdirector.cpp
qgsgraphanalyzer.cpp
)
@@ -57,8 +57,8 @@ SET(QGIS_NETWORK_ANALYSIS_HDRS
qgsgraph.h
qgsgraphbuilderintr.h
qgsgraphbuilder.h
qgsedgeproperter.h
qgsdistanceedgeproperter.h
qgsarcproperter.h
qgsdistancearcproperter.h
qgsgraphdirector.h
qgslinevectorlayerdirector.h
qgsgraphanalyzer.h )
@@ -27,15 +27,15 @@
* \ingroup networkanalysis
* \class QgsEdgeProperter
* \brief QgsEdgeProperter is a strategy pattern.
* You can use it for customize edge property. For example look at QgsDistanceEdgeProperter or src/plugins/roadgraph/speedproperter.h
* You can use it for customize arc property. For example look at QgsDistanceArcProperter or src/plugins/roadgraph/speedproperter.h
*/
class ANALYSIS_EXPORT QgsEdgeProperter
class ANALYSIS_EXPORT QgsArcProperter
{
public:
/**
* default constructor
*/
QgsEdgeProperter()
QgsArcProperter()
{ }

/**
@@ -10,9 +10,9 @@
***************************************************************************/

//QGIS includes
#include "qgsdistanceedgeproperter.h"
#include "qgsdistancearcproperter.h"

QVariant QgsDistanceEdgeProperter::property( double distance, const QgsFeature& f ) const
QVariant QgsDistanceArcProperter::property( double distance, const QgsFeature& f ) const
{
return QVariant( distance );
}
@@ -20,9 +20,9 @@
#include <QVariant>

// QGIS includes
#include <qgsedgeproperter.h>
#include <qgsarcproperter.h>

class ANALYSIS_EXPORT QgsDistanceEdgeProperter : public QgsEdgeProperter
class ANALYSIS_EXPORT QgsDistanceArcProperter : public QgsArcProperter
{
public:
virtual QVariant property( double distance, const QgsFeature& ) const;
@@ -22,7 +22,7 @@

//QGIS includes
#include <qgspoint.h>
#include "qgsedgeproperter.h"
#include "qgsarcproperter.h"

//forward declarations
class QgsGraphBuilderInterface;
@@ -59,7 +59,7 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject
const QVector< QgsPoint >& additionalPoints,
QVector< QgsPoint>& tiedPoints ) const = 0;

void addProperter( QgsEdgeProperter* prop )
void addProperter( QgsArcProperter* prop )
{
mProperterList.push_back( prop );
}
@@ -70,6 +70,6 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject
virtual QString name() const = 0;

protected:
QList<QgsEdgeProperter*> mProperterList;
QList<QgsArcProperter*> mProperterList;
};
#endif //QGSGRAPHDIRECTORH
@@ -220,7 +220,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
tmpAttr.push_back( mDirectionFieldId );
}

QList< QgsEdgeProperter* >::const_iterator it;
QList< QgsArcProperter* >::const_iterator it;
QgsAttributeList::const_iterator it2;

for ( it = mProperterList.begin(); it != mProperterList.end(); ++it )
@@ -317,7 +317,7 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
{
double distance = builder->distanceArea()->measureLine( pt1, pt2 );
QVector< QVariant > prop;
QList< QgsEdgeProperter* >::const_iterator it;
QList< QgsArcProperter* >::const_iterator it;
for ( it = mProperterList.begin(); it != mProperterList.end(); ++it )
{
prop.push_back( (*it)->property( distance, feature ) );
@@ -30,7 +30,7 @@
#include <qgslinevectorlayerdirector.h>
#include <qgsgraphbuilder.h>
#include <qgsgraph.h>
#include <qgsdistanceedgeproperter.h>
#include <qgsdistancearcproperter.h>

// Road grap plugin includes
#include "roadgraphplugin.h"
@@ -281,7 +281,7 @@ const QgsGraphDirector* RoadGraphPlugin::director() const
mSettings->mBothDirectionVal,
mSettings->mDefaultDirection
);
director->addProperter( new QgsDistanceEdgeProperter() );
director->addProperter( new QgsDistanceArcProperter() );
director->addProperter( new RgSpeedProperter( provider->fieldNameIndex( mSettings->mSpeed ),
mSettings->mDefaultSpeed, speedUnit.multipler() ) );
return director;
@@ -14,9 +14,9 @@
#ifndef ROADGRAPH_SPEEDPROPERTER_H
#define ROADGRAPH_SPEEDPROPERTER_H

#include <qgsedgeproperter.h>
#include <qgsarcproperter.h>

class RgSpeedProperter : public QgsEdgeProperter
class RgSpeedProperter : public QgsArcProperter
{
public:
RgSpeedProperter( int attributeId, double defaultValue, double toMetricFactor );

0 comments on commit 4616b8e

Please sign in to comment.
You can’t perform that action at this time.