Skip to content

Commit

Permalink
using only 'vertex/arc' notation
Browse files Browse the repository at this point in the history
  • Loading branch information
stopa85milk committed Jun 1, 2011
1 parent 79f3911 commit 4616b8e
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions src/analysis/network/CMakeLists.txt
Expand Up @@ -6,7 +6,7 @@
SET(QGIS_NETWORK_ANALYSIS_SRCS
qgsgraph.cpp
qgsgraphbuilder.cpp
qgsdistanceedgeproperter.cpp
qgsdistancearcproperter.cpp
qgslinevectorlayerdirector.cpp
qgsgraphanalyzer.cpp
)
Expand Down Expand Up @@ -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 )
Expand Down
Expand Up @@ -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()
{ }

/**
Expand Down
Expand Up @@ -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 );
}
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/analysis/network/qgsgraphdirector.h
Expand Up @@ -22,7 +22,7 @@

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

//forward declarations
class QgsGraphBuilderInterface;
Expand Down Expand Up @@ -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 );
}
Expand All @@ -70,6 +70,6 @@ class ANALYSIS_EXPORT QgsGraphDirector : public QObject
virtual QString name() const = 0;

protected:
QList<QgsEdgeProperter*> mProperterList;
QList<QgsArcProperter*> mProperterList;
};
#endif //QGSGRAPHDIRECTORH
4 changes: 2 additions & 2 deletions src/analysis/network/qgslinevectorlayerdirector.cpp
Expand Up @@ -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 )
Expand Down Expand Up @@ -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 ) );
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/roadgraph/roadgraphplugin.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/roadgraph/speedproperter.h
Expand Up @@ -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 );
Expand Down

0 comments on commit 4616b8e

Please sign in to comment.