Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
rename QgsStrategy to QgsNetworkStrategy to avoid possible future
confusion when we will have other stuff with strategies. Also rename corresponding subclasses
- Loading branch information
Showing
with
116 additions
and 116 deletions.
- +3 −3 python/analysis/analysis.sip
- +1 −1 python/analysis/network/qgsgraphdirector.sip
- +2 −2 python/analysis/network/{qgsdistancestrategy.sip → qgsnetworkdistancestrategy.sip}
- +13 −0 python/analysis/network/qgsnetworkspeedstrategy.sip
- +50 −0 python/analysis/network/qgsnetworkstrategy.sip
- +0 −13 python/analysis/network/qgsspeedstrategy.sip
- +0 −50 python/analysis/network/qgsstrategy.sip
- +5 −5 src/analysis/CMakeLists.txt
- +3 −3 src/analysis/network/qgsgraphdirector.h
- +2 −2 src/analysis/network/qgslinevectorlayerdirector.cpp
- +2 −2 src/analysis/network/{qgsdistancestrategy.cpp → qgsnetworkdistancestrategy.cpp}
- +8 −8 src/analysis/network/{qgsdistancestrategy.h → qgsnetworkdistancestrategy.h}
- +4 −4 src/analysis/network/{qgsspeedstrategy.cpp → qgsnetworkspeedstrategy.cpp}
- +7 −7 src/analysis/network/{qgsspeedstrategy.h → qgsnetworkspeedstrategy.h}
- +12 −12 src/analysis/network/{qgsstrategy.h → qgsnetworkstrategy.h}
- +4 −4 src/plugins/roadgraph/roadgraphplugin.cpp
@@ -0,0 +1,13 @@ | ||
class QgsNetworkSpeedStrategy : QgsNetworkStrategy | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsnetworkspeedstrategy.h> | ||
%End | ||
|
||
public: | ||
QgsNetworkSpeedStrategy( int attributeId, double defaultValue, double toMetricFactor ); | ||
|
||
QVariant cost( double distance, const QgsFeature& f ) const; | ||
|
||
QgsAttributeList requiredAttributes() const; | ||
}; |
@@ -0,0 +1,50 @@ | ||
%ModuleHeaderCode | ||
#include <qgsnetworkspeedstrategy.h> | ||
#include <qgsnetworkdistancestrategy.h> | ||
%End | ||
|
||
/** | ||
* \ingroup analysis | ||
* \class QgsNetworkStrategy | ||
* \brief QgsNetworkStrategy defines strategy used for calculation of the edge cost. For example it can | ||
* take into account travel distance, amount of time or money. Currently there are two strategies | ||
* implemented in the analysis library: QgsNetworkDistanceStrategy and QgsNetworkSpeedStrategy. | ||
* QgsNetworkStrategy implemented using "strategy" design pattern. | ||
*/ | ||
class QgsNetworkStrategy | ||
{ | ||
%TypeHeaderCode | ||
#include <qgsnetworkstrategy.h> | ||
%End | ||
|
||
%ConvertToSubClassCode | ||
if ( dynamic_cast< QgsNetworkDistanceStrategy* > ( sipCpp ) != NULL ) | ||
sipType = sipType_QgsNetworkDistanceStrategy; | ||
else if ( dynamic_cast< QgsNetworkSpeedStrategy* > ( sipCpp ) != NULL ) | ||
sipType = sipType_QgsNetworkSpeedStrategy; | ||
else | ||
sipType = NULL; | ||
%End | ||
|
||
|
||
public: | ||
|
||
/** | ||
* Default constructor | ||
*/ | ||
QgsNetworkStrategy(); | ||
|
||
virtual ~QgsNetworkStrategy(); | ||
|
||
/** | ||
* Returns list of the source layer attributes needed for cost calculation. | ||
* This method called by QgsGraphDirector. | ||
* \return list of required attributes | ||
*/ | ||
virtual QgsAttributeList requiredAttributes() const; | ||
|
||
/** | ||
* Returns edge cost | ||
*/ | ||
virtual QVariant cost( double distance, const QgsFeature &f ) const = 0; | ||
}; |
Oops, something went wrong.