diff options
-rw-r--r-- | drape_frontend/color_constants.cpp | 10 | ||||
-rw-r--r-- | drape_frontend/route_shape.cpp | 3 | ||||
-rw-r--r-- | routing/car_router.cpp | 13 | ||||
-rw-r--r-- | routing/index_graph_starter.cpp | 36 | ||||
-rw-r--r-- | routing/index_graph_starter.hpp | 3 | ||||
-rw-r--r-- | routing/single_mwm_router.cpp | 2 |
6 files changed, 49 insertions, 18 deletions
diff --git a/drape_frontend/color_constants.cpp b/drape_frontend/color_constants.cpp index 6dbbb0d264..923d5192d7 100644 --- a/drape_frontend/color_constants.cpp +++ b/drape_frontend/color_constants.cpp @@ -29,8 +29,8 @@ unordered_map<int, unordered_map<int, dp::Color>> kColorConstants = { TrafficG1, dp::Color(230, 60, 55, 255) }, { TrafficG2, dp::Color(230, 60, 55, 255) }, { TrafficG3, dp::Color(250, 190, 45, 127) }, - { TrafficG4, dp::Color(250, 190, 45, 127) }, - { TrafficG5, dp::Color(55, 165, 55, 255) }, + { TrafficG4, dp::Color(155, 175, 50, 255) }, + { TrafficG5, dp::Color(50, 155, 75, 255) }, { TrafficTempBlock, dp::Color(75, 75, 75, 255) }, { TrafficUnknown, dp::Color(0, 0, 0, 0) }, { TrafficArrowLight, dp::Color(255, 255, 255, 255) }, @@ -56,9 +56,9 @@ unordered_map<int, unordered_map<int, dp::Color>> kColorConstants = { TrafficG0, dp::Color(70, 15, 0, 255) }, { TrafficG1, dp::Color(105, 20, 0, 255) }, { TrafficG2, dp::Color(105, 20, 0, 255) }, - { TrafficG3, dp::Color(115, 80, 0, 127) }, - { TrafficG4, dp::Color(115, 80, 0, 127) }, - { TrafficG5, dp::Color(25, 75, 25, 255) }, + { TrafficG3, dp::Color(115, 90, 0, 127) }, + { TrafficG4, dp::Color(70, 75, 20, 255) }, + { TrafficG5, dp::Color(25, 75, 20, 255) }, { TrafficTempBlock, dp::Color(40, 40, 40, 255) }, { TrafficUnknown, dp::Color(0, 0, 0, 0) }, { TrafficArrowLight, dp::Color(170, 170, 170, 255) }, diff --git a/drape_frontend/route_shape.cpp b/drape_frontend/route_shape.cpp index 6a3f4464e4..2c53c9c971 100644 --- a/drape_frontend/route_shape.cpp +++ b/drape_frontend/route_shape.cpp @@ -412,7 +412,8 @@ void RouteShape::CacheRoute(ref_ptr<dp::TextureManager> textures, RouteData & ro for (auto const & speedGroup : routeData.m_traffic) { dp::Color const color = df::GetColorConstant(style, TrafficGenerator::GetColorBySpeedGroup(speedGroup)); - float const alpha = (speedGroup == traffic::SpeedGroup::G5 || + float const alpha = (speedGroup == traffic::SpeedGroup::G4 || + speedGroup == traffic::SpeedGroup::G5 || speedGroup == traffic::SpeedGroup::Unknown) ? 0.0f : 1.0f; segmentsColors.push_back(glsl::vec4(color.GetRedF(), color.GetGreenF(), color.GetBlueF(), alpha)); } diff --git a/routing/car_router.cpp b/routing/car_router.cpp index 0e8c013a70..1f4cd434e4 100644 --- a/routing/car_router.cpp +++ b/routing/car_router.cpp @@ -282,7 +282,18 @@ bool CarRouter::FindRouteMSMT(TFeatureGraphNodeVec const & sources, { case NoError: return true; case Cancelled: return false; - default: continue; + case NoCurrentPosition: + LOG(LERROR, ("NoCurrentPosition routing result returned by FindSingleRouteDispatcher()")); + return false; + case InconsistentMWMandRoute: return false; + case RouteFileNotExist: return false; + case StartPointNotFound: continue; + case EndPointNotFound: continue; + case PointsInDifferentMWM: return false; + case RouteNotFound: continue; + case NeedMoreMaps: return false; + case InternalError: return false; + case FileTooOld: return false; } } } diff --git a/routing/index_graph_starter.cpp b/routing/index_graph_starter.cpp index 22b64eb012..31b696f7c3 100644 --- a/routing/index_graph_starter.cpp +++ b/routing/index_graph_starter.cpp @@ -40,20 +40,35 @@ m2::PointD const & IndexGraphStarter::GetPoint(Joint::Id jointId) return m_graph.GetPoint(jointId); } -m2::PointD const & IndexGraphStarter::GetPoint(RoadPoint const & rp) +DirectedEdge const & IndexGraphStarter::FindFakeEdge(uint32_t fakeFeatureId) { - if (!IsFakeFeature(rp.GetFeatureId())) - return m_graph.GetPoint(rp); - + ASSERT(IsFakeFeature(fakeFeatureId), ("Feature", fakeFeatureId, "is not a fake one")); for (DirectedEdge const & e : m_fakeZeroLengthEdges) { ASSERT_EQUAL(GetPoint(e.GetFrom()), GetPoint(e.GetTo()), ()); - if (e.GetFeatureId() == rp.GetFeatureId()) - return GetPoint(e.GetFrom()); + if (e.GetFeatureId() == fakeFeatureId) + return e; } - CHECK(false, - (rp, "is a point of a fake feature but it's not contained in |m_fakeZeroLengthEdges|")); - return m_graph.GetPoint(rp); + CHECK(false, ("Fake feature:", fakeFeatureId, "has to be contained in |m_fakeZeroLengthEdges|")); + return m_fakeZeroLengthEdges.front(); +} + +m2::PointD const & IndexGraphStarter::GetPoint(RoadPoint const & rp) +{ + if (!IsFakeFeature(rp.GetFeatureId())) + return m_graph.GetPoint(rp); + + // Fake edges have zero length so coords of "point from" and "point to" are equal. + return GetPoint(FindFakeEdge(rp.GetFeatureId()).GetFrom()); +} + +RoadGeometry IndexGraphStarter::GetFakeRoadGeometry(uint32_t fakeFeatureId) +{ + DirectedEdge const & e = FindFakeEdge(fakeFeatureId); + ASSERT_EQUAL(GetPoint(e.GetFrom()), GetPoint(e.GetTo()), ()); + // Note. |e| is a zero length edge so speed could be any number which is not equal to zero. + return RoadGeometry(true /* one way */, 1.0 /* speed */, + RoadGeometry::Points({GetPoint(e.GetFrom()), GetPoint(e.GetTo())})); } void IndexGraphStarter::RedressRoute(vector<Joint::Id> const & route, @@ -86,7 +101,8 @@ void IndexGraphStarter::RedressRoute(vector<Joint::Id> const & route, uint32_t const pointFrom = rp0.GetPointId(); uint32_t const pointTo = rp1.GetPointId(); - RoadGeometry const roadGeometry = m_graph.GetRoad(featureId); + RoadGeometry const roadGeometry = IsFakeFeature(featureId) ? GetFakeRoadGeometry(featureId) + : m_graph.GetRoad(featureId); CHECK_NOT_EQUAL(pointFrom, pointTo, ("featureId =", featureId)); uint32_t const step = pointFrom < pointTo ? 1 : -1; diff --git a/routing/index_graph_starter.hpp b/routing/index_graph_starter.hpp index 14a13cd222..33759f569c 100644 --- a/routing/index_graph_starter.hpp +++ b/routing/index_graph_starter.hpp @@ -115,6 +115,9 @@ private: return featureId >= m_graph.GetNextFakeFeatureId(); } + DirectedEdge const & FindFakeEdge(uint32_t fakeFeatureId); + RoadGeometry GetFakeRoadGeometry(uint32_t fakeFeatureId); + void AddZeroLengthOnewayFeature(Joint::Id from, Joint::Id to); void GetFakeEdgesList(Joint::Id jointId, bool isOutgoing, vector<JointEdge> & edges); diff --git a/routing/single_mwm_router.cpp b/routing/single_mwm_router.cpp index 15ee3b486a..2c2259f489 100644 --- a/routing/single_mwm_router.cpp +++ b/routing/single_mwm_router.cpp @@ -216,7 +216,7 @@ bool SingleMwmRouter::BuildRoute(MwmSet::MwmId const & mwmId, vector<Joint::Id> // TODO: Use real altitudes for pedestrian and bicycle routing. for (RoutePoint const & routePoint : routePoints) { - junctions.emplace_back(starter.GetGraph().GetPoint(routePoint.GetRoadPoint()), + junctions.emplace_back(starter.GetPoint(routePoint.GetRoadPoint()), feature::kDefaultAltitudeMeters); } |