Skip to content
Permalink
Browse files

rename enum and its values

  • Loading branch information
alexbruy committed Nov 21, 2016
1 parent 9dffe64 commit d657c77a8ce457ea567146dfc9767114dc44e322
@@ -16,11 +16,11 @@ class QgsLineVectorLayerDirector : QgsGraphDirector
* from the end point to the start point) and bidirectional or two-way
* (one can move in any direction)
*/
enum RoadDirection
enum Direction
{
RoadDirect, //!< One-way direct
RoadReversed, //!< One-way reversed
RoadBidirectional, //!< Two-way
DirectionForward, //!< One-way direct
DirectionBackward, //!< One-way reversed
DirectionBoth, //!< Two-way
};

/**
@@ -37,7 +37,7 @@ class QgsLineVectorLayerDirector : QgsGraphDirector
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
const RoadDirection defaultDirection
const Direction defaultDirection
);

//! Destructor
@@ -102,12 +102,12 @@ bool TiePointInfoCompare( const TiePointInfo& a, const TiePointInfo& b )
return a.mFirstPoint.x() == b.mFirstPoint.x() ? a.mFirstPoint.y() < b.mFirstPoint.y() : a.mFirstPoint.x() < b.mFirstPoint.x();
}

QgsLineVectorLayerDirector::QgsLineVectorLayerDirector(QgsVectorLayer *myLayer,
QgsLineVectorLayerDirector::QgsLineVectorLayerDirector( QgsVectorLayer *myLayer,
int directionFieldId,
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
const RoadDirection defaultDirection
const Direction defaultDirection
)
{
mVectorLayer = myLayer;
@@ -284,21 +284,21 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( la ) );
while ( fit.nextFeature( feature ) )
{
RoadDirection directionType = mDefaultDirection;
Direction directionType = mDefaultDirection;

// What direction have feature?
QString str = feature.attribute( mDirectionFieldId ).toString();
if ( str == mBothDirectionValue )
{
directionType = RoadDirection::RoadBidirectional;
directionType = Direction::DirectionBoth;
}
else if ( str == mDirectDirectionValue )
{
directionType = RoadDirection::RoadDirect;
directionType = Direction::DirectionForward;
}
else if ( str == mReverseDirectionValue )
{
directionType = RoadDirection::RoadReversed;
directionType = Direction::DirectionBackward;
}

// begin features segments and add arc to the Graph;
@@ -372,13 +372,13 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
prop.push_back(( *it )->cost( distance, feature ) );
}

if ( directionType == RoadDirection::RoadDirect ||
directionType == RoadDirection::RoadBidirectional )
if ( directionType == Direction::DirectionForward ||
directionType == Direction::DirectionBoth )
{
builder->addEdge( pt1idx, pt1, pt2idx, pt2, prop );
}
if ( directionType == RoadDirection::RoadReversed ||
directionType == RoadDirection::RoadBidirectional )
if ( directionType == Direction::DirectionBackward ||
directionType == Direction::DirectionBoth )
{
builder->addEdge( pt2idx, pt2, pt1idx, pt1, prop );
}
@@ -38,11 +38,11 @@ class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector
* from the end point to the start point) and bidirectional or two-way
* (one can move in any direction)
*/
enum RoadDirection
enum Direction
{
RoadDirect, //!< One-way direct
RoadReversed, //!< One-way reversed
RoadBidirectional, //!< Two-way
DirectionForward, //!< One-way direct
DirectionBackward, //!< One-way reversed
DirectionBoth, //!< Two-way
};

/**
@@ -60,7 +60,7 @@ class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector
const QString& directDirectionValue,
const QString& reverseDirectionValue,
const QString& bothDirectionValue,
const RoadDirection defaultDirection
const Direction defaultDirection
);

//! Destructor
@@ -77,16 +77,11 @@ class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector

private:
QgsVectorLayer *mVectorLayer;

int mDirectionFieldId;

QString mDirectDirectionValue;

QString mReverseDirectionValue;

QString mBothDirectionValue;

RoadDirection mDefaultDirection;
Direction mDefaultDirection;
};

#endif // QGSLINEVECTORLAYERDIRECTOR_H
@@ -19,9 +19,9 @@
#include <qgsnetworkstrategy.h>

/** \ingroup analysis
* \class QgsSpeedStrategy
* \class QgsNetworkSpeedStrategy
* \note added in QGIS 3.0
* \brief Strategy for caclucating edge cost based on travel time. Should be
* \brief Strategy for calcucating edge cost based on travel time. Should be
* used for finding fastest path between two points.
*/
class ANALYSIS_EXPORT QgsNetworkSpeedStrategy : public QgsNetworkStrategy
@@ -29,7 +29,7 @@
//standard includes

RgLineVectorLayerSettings::RgLineVectorLayerSettings()
: mDefaultDirection( QgsLineVectorLayerDirector::RoadDirection::RoadBidirectional )
: mDefaultDirection( QgsLineVectorLayerDirector::Direction::DirectionBoth )
, mDefaultSpeed( 40 )
{
}
@@ -58,7 +58,7 @@ bool RgLineVectorLayerSettings::test()

void RgLineVectorLayerSettings::read( const QgsProject *project )
{
mDefaultDirection = static_cast<QgsLineVectorLayerDirector::RoadDirection> ( project->readNumEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/defaultDirection" ) ) );
mDefaultDirection = static_cast<QgsLineVectorLayerDirector::Direction>( project->readNumEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/defaultDirection" ) ) );
mDirection = project->readEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/directionField" ) );
mFirstPointToLastPointDirectionVal =
project->readEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/FirstPointToLastPointDirectionVal" ) );
@@ -105,15 +105,15 @@ void RgLineVectorLayerSettings::setFromGui( QWidget *myGui )

if ( w->mcbDirectionDefault->currentIndex() == 0 )
{
mDefaultDirection = QgsLineVectorLayerDirector::RoadDirection::RoadBidirectional;
mDefaultDirection = QgsLineVectorLayerDirector::Direction::DirectionBoth;
}
else if ( w->mcbDirectionDefault->currentIndex() == 1 )
{
mDefaultDirection = QgsLineVectorLayerDirector::RoadDirection::RoadDirect;
mDefaultDirection = QgsLineVectorLayerDirector::Direction::DirectionForward;
}
else if ( w->mcbDirectionDefault->currentIndex() == 2 )
{
mDefaultDirection = QgsLineVectorLayerDirector::RoadDirection::RoadReversed;
mDefaultDirection = QgsLineVectorLayerDirector::Direction::DirectionBackward;
}

mSpeed = w->mcbSpeed->currentText();
@@ -95,7 +95,7 @@ class RgLineVectorLayerSettings: public RgSettings
/**
* contained Default direction
*/
QgsLineVectorLayerDirector::RoadDirection mDefaultDirection;
QgsLineVectorLayerDirector::Direction mDefaultDirection;

/**
* contained speed filed name
@@ -143,13 +143,13 @@ RgLineVectorLayerSettingsWidget::RgLineVectorLayerSettingsWidget( RgLineVectorLa

switch ( s->mDefaultDirection )
{
case QgsLineVectorLayerDirector::RoadDirection::RoadBidirectional:
case QgsLineVectorLayerDirector::Direction::DirectionBoth:
mcbDirectionDefault->setCurrentIndex( 0 );
break;
case QgsLineVectorLayerDirector::RoadDirection::RoadDirect:
case QgsLineVectorLayerDirector::Direction::DirectionForward:
mcbDirectionDefault->setCurrentIndex( 1 );
break;
case QgsLineVectorLayerDirector::RoadDirection::RoadReversed:
case QgsLineVectorLayerDirector::Direction::DirectionBackward:
mcbDirectionDefault->setCurrentIndex( 2 );
break;
}

0 comments on commit d657c77

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