forked from organicmaps/organicmaps
[routing] Using maxspeed only in car model.
This commit is contained in:
parent
2cf9833de7
commit
d99a98e498
3 changed files with 16 additions and 11 deletions
|
@ -4,6 +4,7 @@
|
|||
|
||||
#include "indexer/classificator.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
@ -231,6 +232,19 @@ CarModel::CarModel(VehicleModel::LimitsInitList const & roadLimits)
|
|||
InitAdditionalRoadTypes();
|
||||
}
|
||||
|
||||
SpeedKMpH CarModel::GetSpeed(FeatureType & f, SpeedParams const & speedParams) const
|
||||
{
|
||||
if (!speedParams.m_maxspeed.IsValid())
|
||||
return VehicleModel::GetSpeed(f, speedParams);
|
||||
|
||||
// Note. It's the first rough attempt using maxspeed tag value for speed calculation.
|
||||
// It's used as a feature speed if it's valid and less then some value.
|
||||
// @TODO maxspeed tag value should be used more sophisticated.
|
||||
uint16_t const maxspeedBasedspeedKmPH = speedParams.m_maxspeed.GetSpeedKmPH(speedParams.m_forward);
|
||||
auto const speedKmPH = min(static_cast<double>(maxspeedBasedspeedKmPH), GetMaxWeightSpeed());
|
||||
return {speedKmPH /* weight */, speedKmPH /* eta */};
|
||||
}
|
||||
|
||||
double CarModel::GetOffroadSpeed() const { return kSpeedOffroadKMpH; }
|
||||
|
||||
void CarModel::InitAdditionalRoadTypes()
|
||||
|
|
|
@ -12,6 +12,7 @@ public:
|
|||
CarModel(VehicleModel::LimitsInitList const & roadLimits);
|
||||
|
||||
// VehicleModelInterface overrides
|
||||
SpeedKMpH GetSpeed(FeatureType & f, SpeedParams const & speedParams) const override;
|
||||
double GetOffroadSpeed() const override;
|
||||
|
||||
static CarModel const & AllLimitsInstance();
|
||||
|
|
|
@ -95,18 +95,8 @@ VehicleModel::SpeedKMpH VehicleModel::GetSpeed(FeatureType & f, SpeedParams cons
|
|||
// @TODO(bykoianko) Consider using speed on feature |f| instead of using max speed below.
|
||||
if (restriction == RoadAvailability::Available)
|
||||
return speedParams.m_inCity ? m_modelMaxSpeed.m_inCity : m_modelMaxSpeed.m_outCity;
|
||||
|
||||
if (restriction != RoadAvailability::NotAvailable && HasRoadType(types))
|
||||
{
|
||||
uint16_t const speedKmPH = speedParams.m_maxspeed.GetSpeedKmPH(speedParams.m_forward);
|
||||
// Note. It's the first rough attept using maxspeed tag value for speed calculation.
|
||||
// It's used as a feature speed if it's valid and less then some value.
|
||||
// @TODO maxspeed tag value should be used more sophisticated.
|
||||
if (!speedParams.m_maxspeed.IsValid() || speedKmPH > 200)
|
||||
return GetMinTypeSpeed(types, speedParams.m_inCity);
|
||||
|
||||
return {static_cast<double>(speedKmPH), static_cast<double>(speedKmPH)};
|
||||
}
|
||||
return GetMinTypeSpeed(types, speedParams.m_inCity);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue