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:
authorLev Dragunov <l.dragunov@corp.mail.ru>2015-08-06 16:51:10 +0300
committerAlex Zolotarev <alex@maps.me>2015-09-23 02:59:37 +0300
commiteb1eae4123b07e25d4bb77183071a9ca3baa9b98 (patch)
treed6df136c0ae2b63b0cf66b5da38c3158b888a535 /routing
parentf75de085735199aa078d3b8f562adeef5a021c39 (diff)
Routing settings keep pedestrian flag.
Diffstat (limited to 'routing')
-rw-r--r--routing/route.cpp19
-rw-r--r--routing/route.hpp1
-rw-r--r--routing/routing_settings.hpp8
3 files changed, 18 insertions, 10 deletions
diff --git a/routing/route.cpp b/routing/route.cpp
index 458b8555ff..f072164273 100644
--- a/routing/route.cpp
+++ b/routing/route.cpp
@@ -182,7 +182,8 @@ bool Route::MoveIterator(location::GpsInfo const & info) const
m2::RectD const rect = MercatorBounds::MetresToXY(
info.m_longitude, info.m_latitude,
max(m_routingSettings.m_matchingThresholdM, info.m_horizontalAccuracy));
- m_pedestrianFollower.FindProjection(rect, predictDistance);
+ if (m_routingSettings.m_keepPedestrianInfo)
+ m_pedestrianFollower.FindProjection(rect, predictDistance);
IterT const res = FindProjection(rect, predictDistance);
if (res.IsValid())
{
@@ -286,13 +287,15 @@ double Route::GetDistanceOnPolyline(IterT const & it1, IterT const & it2) const
void Route::Update()
{
- vector<m2::PointD> points;
- auto distf = m2::DistanceToLineSquare<m2::PointD>();
- // TODO (ldargunov) Rewrite dist f to distance in meters and avoid 0.00000 constants.
- SimplifyNearOptimal(20, m_poly.Begin(), m_poly.End(), 0.00000001, distf,
- MakeBackInsertFunctor(points));
- m_pedestrianFollower = RouteFollower(points.begin(), points.end());
-
+ if (m_routingSettings.m_keepPedestrianInfo)
+ {
+ vector<m2::PointD> points;
+ auto distf = m2::DistanceToLineSquare<m2::PointD>();
+ // TODO (ldargunov) Rewrite dist f to distance in meters and avoid 0.00000 constants.
+ SimplifyNearOptimal(20, m_poly.Begin(), m_poly.End(), 0.00000001, distf,
+ MakeBackInsertFunctor(points));
+ m_pedestrianFollower = RouteFollower(points.begin(), points.end());
+ }
size_t n = m_poly.GetSize();
ASSERT_GREATER(n, 1, ());
--n;
diff --git a/routing/route.hpp b/routing/route.hpp
index b7279b941b..157fec8412 100644
--- a/routing/route.hpp
+++ b/routing/route.hpp
@@ -128,6 +128,7 @@ private:
private:
friend string DebugPrint(Route const & r);
+ //TODO (ldragunov) Rewrite routing session to use RouteFollower for base road geometry
mutable RouteFollower m_pedestrianFollower;
string m_router;
diff --git a/routing/routing_settings.hpp b/routing/routing_settings.hpp
index e74f6d1dff..21c7b195b4 100644
--- a/routing/routing_settings.hpp
+++ b/routing/routing_settings.hpp
@@ -24,17 +24,21 @@ struct RoutingSettings
/// m_matchingThresholdM to the route than the current position is moved to
/// the closest point to the route.
double m_matchingThresholdM;
+
+ /// \brief m_keepPedestrianInfo flag for keeping in memory additional information for pedestrian
+ /// routing.
+ bool m_keepPedestrianInfo;
};
inline RoutingSettings GetPedestrianRoutingSettings()
{
return RoutingSettings({ false /* m_matchRoute */, false /* m_soundDirection */,
- 20. /* m_matchingThresholdM */ });
+ 20. /* m_matchingThresholdM */, true /* m_keepPedestrianInfo */ });
}
inline RoutingSettings GetCarRoutingSettings()
{
return RoutingSettings({ true /* m_matchRoute */, true /* m_soundDirection */,
- 50. /* m_matchingThresholdM */ });
+ 50. /* m_matchingThresholdM */, false /* m_keepPedestrianInfo */ });
}
} // namespace routing