mirror of
https://github.com/qgis/QGIS.git
synced 2025-10-18 00:06:00 -04:00
rename enum and its values
This commit is contained in:
parent
9dffe64dab
commit
d657c77a8c
@ -16,11 +16,11 @@ class QgsLineVectorLayerDirector : QgsGraphDirector
|
|||||||
* from the end point to the start point) and bidirectional or two-way
|
* from the end point to the start point) and bidirectional or two-way
|
||||||
* (one can move in any direction)
|
* (one can move in any direction)
|
||||||
*/
|
*/
|
||||||
enum RoadDirection
|
enum Direction
|
||||||
{
|
{
|
||||||
RoadDirect, //!< One-way direct
|
DirectionForward, //!< One-way direct
|
||||||
RoadReversed, //!< One-way reversed
|
DirectionBackward, //!< One-way reversed
|
||||||
RoadBidirectional, //!< Two-way
|
DirectionBoth, //!< Two-way
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -37,7 +37,7 @@ class QgsLineVectorLayerDirector : QgsGraphDirector
|
|||||||
const QString& directDirectionValue,
|
const QString& directDirectionValue,
|
||||||
const QString& reverseDirectionValue,
|
const QString& reverseDirectionValue,
|
||||||
const QString& bothDirectionValue,
|
const QString& bothDirectionValue,
|
||||||
const RoadDirection defaultDirection
|
const Direction defaultDirection
|
||||||
);
|
);
|
||||||
|
|
||||||
//! Destructor
|
//! 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();
|
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,
|
int directionFieldId,
|
||||||
const QString& directDirectionValue,
|
const QString& directDirectionValue,
|
||||||
const QString& reverseDirectionValue,
|
const QString& reverseDirectionValue,
|
||||||
const QString& bothDirectionValue,
|
const QString& bothDirectionValue,
|
||||||
const RoadDirection defaultDirection
|
const Direction defaultDirection
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
mVectorLayer = myLayer;
|
mVectorLayer = myLayer;
|
||||||
@ -284,21 +284,21 @@ void QgsLineVectorLayerDirector::makeGraph( QgsGraphBuilderInterface *builder, c
|
|||||||
fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( la ) );
|
fit = vl->getFeatures( QgsFeatureRequest().setSubsetOfAttributes( la ) );
|
||||||
while ( fit.nextFeature( feature ) )
|
while ( fit.nextFeature( feature ) )
|
||||||
{
|
{
|
||||||
RoadDirection directionType = mDefaultDirection;
|
Direction directionType = mDefaultDirection;
|
||||||
|
|
||||||
// What direction have feature?
|
// What direction have feature?
|
||||||
QString str = feature.attribute( mDirectionFieldId ).toString();
|
QString str = feature.attribute( mDirectionFieldId ).toString();
|
||||||
if ( str == mBothDirectionValue )
|
if ( str == mBothDirectionValue )
|
||||||
{
|
{
|
||||||
directionType = RoadDirection::RoadBidirectional;
|
directionType = Direction::DirectionBoth;
|
||||||
}
|
}
|
||||||
else if ( str == mDirectDirectionValue )
|
else if ( str == mDirectDirectionValue )
|
||||||
{
|
{
|
||||||
directionType = RoadDirection::RoadDirect;
|
directionType = Direction::DirectionForward;
|
||||||
}
|
}
|
||||||
else if ( str == mReverseDirectionValue )
|
else if ( str == mReverseDirectionValue )
|
||||||
{
|
{
|
||||||
directionType = RoadDirection::RoadReversed;
|
directionType = Direction::DirectionBackward;
|
||||||
}
|
}
|
||||||
|
|
||||||
// begin features segments and add arc to the Graph;
|
// 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 ) );
|
prop.push_back(( *it )->cost( distance, feature ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( directionType == RoadDirection::RoadDirect ||
|
if ( directionType == Direction::DirectionForward ||
|
||||||
directionType == RoadDirection::RoadBidirectional )
|
directionType == Direction::DirectionBoth )
|
||||||
{
|
{
|
||||||
builder->addEdge( pt1idx, pt1, pt2idx, pt2, prop );
|
builder->addEdge( pt1idx, pt1, pt2idx, pt2, prop );
|
||||||
}
|
}
|
||||||
if ( directionType == RoadDirection::RoadReversed ||
|
if ( directionType == Direction::DirectionBackward ||
|
||||||
directionType == RoadDirection::RoadBidirectional )
|
directionType == Direction::DirectionBoth )
|
||||||
{
|
{
|
||||||
builder->addEdge( pt2idx, pt2, pt1idx, pt1, prop );
|
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
|
* from the end point to the start point) and bidirectional or two-way
|
||||||
* (one can move in any direction)
|
* (one can move in any direction)
|
||||||
*/
|
*/
|
||||||
enum RoadDirection
|
enum Direction
|
||||||
{
|
{
|
||||||
RoadDirect, //!< One-way direct
|
DirectionForward, //!< One-way direct
|
||||||
RoadReversed, //!< One-way reversed
|
DirectionBackward, //!< One-way reversed
|
||||||
RoadBidirectional, //!< Two-way
|
DirectionBoth, //!< Two-way
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -60,7 +60,7 @@ class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector
|
|||||||
const QString& directDirectionValue,
|
const QString& directDirectionValue,
|
||||||
const QString& reverseDirectionValue,
|
const QString& reverseDirectionValue,
|
||||||
const QString& bothDirectionValue,
|
const QString& bothDirectionValue,
|
||||||
const RoadDirection defaultDirection
|
const Direction defaultDirection
|
||||||
);
|
);
|
||||||
|
|
||||||
//! Destructor
|
//! Destructor
|
||||||
@ -77,16 +77,11 @@ class ANALYSIS_EXPORT QgsLineVectorLayerDirector : public QgsGraphDirector
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QgsVectorLayer *mVectorLayer;
|
QgsVectorLayer *mVectorLayer;
|
||||||
|
|
||||||
int mDirectionFieldId;
|
int mDirectionFieldId;
|
||||||
|
|
||||||
QString mDirectDirectionValue;
|
QString mDirectDirectionValue;
|
||||||
|
|
||||||
QString mReverseDirectionValue;
|
QString mReverseDirectionValue;
|
||||||
|
|
||||||
QString mBothDirectionValue;
|
QString mBothDirectionValue;
|
||||||
|
Direction mDefaultDirection;
|
||||||
RoadDirection mDefaultDirection;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // QGSLINEVECTORLAYERDIRECTOR_H
|
#endif // QGSLINEVECTORLAYERDIRECTOR_H
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
#include <qgsnetworkstrategy.h>
|
#include <qgsnetworkstrategy.h>
|
||||||
|
|
||||||
/** \ingroup analysis
|
/** \ingroup analysis
|
||||||
* \class QgsSpeedStrategy
|
* \class QgsNetworkSpeedStrategy
|
||||||
* \note added in QGIS 3.0
|
* \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.
|
* used for finding fastest path between two points.
|
||||||
*/
|
*/
|
||||||
class ANALYSIS_EXPORT QgsNetworkSpeedStrategy : public QgsNetworkStrategy
|
class ANALYSIS_EXPORT QgsNetworkSpeedStrategy : public QgsNetworkStrategy
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
//standard includes
|
//standard includes
|
||||||
|
|
||||||
RgLineVectorLayerSettings::RgLineVectorLayerSettings()
|
RgLineVectorLayerSettings::RgLineVectorLayerSettings()
|
||||||
: mDefaultDirection( QgsLineVectorLayerDirector::RoadDirection::RoadBidirectional )
|
: mDefaultDirection( QgsLineVectorLayerDirector::Direction::DirectionBoth )
|
||||||
, mDefaultSpeed( 40 )
|
, mDefaultSpeed( 40 )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -58,7 +58,7 @@ bool RgLineVectorLayerSettings::test()
|
|||||||
|
|
||||||
void RgLineVectorLayerSettings::read( const QgsProject *project )
|
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" ) );
|
mDirection = project->readEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/directionField" ) );
|
||||||
mFirstPointToLastPointDirectionVal =
|
mFirstPointToLastPointDirectionVal =
|
||||||
project->readEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/FirstPointToLastPointDirectionVal" ) );
|
project->readEntry( QStringLiteral( "roadgraphplugin" ), QStringLiteral( "/FirstPointToLastPointDirectionVal" ) );
|
||||||
@ -105,15 +105,15 @@ void RgLineVectorLayerSettings::setFromGui( QWidget *myGui )
|
|||||||
|
|
||||||
if ( w->mcbDirectionDefault->currentIndex() == 0 )
|
if ( w->mcbDirectionDefault->currentIndex() == 0 )
|
||||||
{
|
{
|
||||||
mDefaultDirection = QgsLineVectorLayerDirector::RoadDirection::RoadBidirectional;
|
mDefaultDirection = QgsLineVectorLayerDirector::Direction::DirectionBoth;
|
||||||
}
|
}
|
||||||
else if ( w->mcbDirectionDefault->currentIndex() == 1 )
|
else if ( w->mcbDirectionDefault->currentIndex() == 1 )
|
||||||
{
|
{
|
||||||
mDefaultDirection = QgsLineVectorLayerDirector::RoadDirection::RoadDirect;
|
mDefaultDirection = QgsLineVectorLayerDirector::Direction::DirectionForward;
|
||||||
}
|
}
|
||||||
else if ( w->mcbDirectionDefault->currentIndex() == 2 )
|
else if ( w->mcbDirectionDefault->currentIndex() == 2 )
|
||||||
{
|
{
|
||||||
mDefaultDirection = QgsLineVectorLayerDirector::RoadDirection::RoadReversed;
|
mDefaultDirection = QgsLineVectorLayerDirector::Direction::DirectionBackward;
|
||||||
}
|
}
|
||||||
|
|
||||||
mSpeed = w->mcbSpeed->currentText();
|
mSpeed = w->mcbSpeed->currentText();
|
||||||
|
@ -95,7 +95,7 @@ class RgLineVectorLayerSettings: public RgSettings
|
|||||||
/**
|
/**
|
||||||
* contained Default direction
|
* contained Default direction
|
||||||
*/
|
*/
|
||||||
QgsLineVectorLayerDirector::RoadDirection mDefaultDirection;
|
QgsLineVectorLayerDirector::Direction mDefaultDirection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* contained speed filed name
|
* contained speed filed name
|
||||||
|
@ -143,13 +143,13 @@ RgLineVectorLayerSettingsWidget::RgLineVectorLayerSettingsWidget( RgLineVectorLa
|
|||||||
|
|
||||||
switch ( s->mDefaultDirection )
|
switch ( s->mDefaultDirection )
|
||||||
{
|
{
|
||||||
case QgsLineVectorLayerDirector::RoadDirection::RoadBidirectional:
|
case QgsLineVectorLayerDirector::Direction::DirectionBoth:
|
||||||
mcbDirectionDefault->setCurrentIndex( 0 );
|
mcbDirectionDefault->setCurrentIndex( 0 );
|
||||||
break;
|
break;
|
||||||
case QgsLineVectorLayerDirector::RoadDirection::RoadDirect:
|
case QgsLineVectorLayerDirector::Direction::DirectionForward:
|
||||||
mcbDirectionDefault->setCurrentIndex( 1 );
|
mcbDirectionDefault->setCurrentIndex( 1 );
|
||||||
break;
|
break;
|
||||||
case QgsLineVectorLayerDirector::RoadDirection::RoadReversed:
|
case QgsLineVectorLayerDirector::Direction::DirectionBackward:
|
||||||
mcbDirectionDefault->setCurrentIndex( 2 );
|
mcbDirectionDefault->setCurrentIndex( 2 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user