Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Levchenko <ldo2.msiu@gmail.com>2020-11-20 14:27:42 +0300
committerVladimir Byko-Ianko <bykoianko@gmail.com>2020-11-27 15:22:49 +0300
commit9a2a8f7990cacb5959397b9b9103f0f08866f6e9 (patch)
tree1b88562b9fc7eea7f5eeb061b68d3bf08aac410f /routing
parent1d7139264d05bd11bc085dc9bd332560e1be5cd6 (diff)
Add speed limit
Diffstat (limited to 'routing')
-rw-r--r--routing/edge_estimator.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/routing/edge_estimator.cpp b/routing/edge_estimator.cpp
index 7c553ac7d0..bf44deb7fc 100644
--- a/routing/edge_estimator.cpp
+++ b/routing/edge_estimator.cpp
@@ -146,6 +146,8 @@ double EdgeEstimator::ComputeDefaultLeapWeightSpeed() const
double EdgeEstimator::LoadLeapWeightSpeed(NumMwmId mwmId)
{
+ double leapWeightSpeed = ComputeDefaultLeapWeightSpeed();
+
if (m_dataSourcePtr)
{
MwmSet::MwmHandle handle =
@@ -154,10 +156,13 @@ double EdgeEstimator::LoadLeapWeightSpeed(NumMwmId mwmId)
MYTHROW(RoutingException, ("Mwm", m_numMwmIds->GetFile(mwmId), "cannot be loaded."));
if (handle.GetInfo())
- return handle.GetInfo()->GetRegionData().GetLeapWeightSpeed(m_maxWeightSpeedMpS / 2.0);
+ leapWeightSpeed = handle.GetInfo()->GetRegionData().GetLeapWeightSpeed(leapWeightSpeed);
}
- return ComputeDefaultLeapWeightSpeed();
+ if (leapWeightSpeed > m_maxWeightSpeedMpS)
+ leapWeightSpeed = m_maxWeightSpeedMpS;
+
+ return leapWeightSpeed;
}
double EdgeEstimator::GetLeapWeightSpeed(NumMwmId mwmId)