| 558 | } |
| 559 | |
| 560 | void DrawWidget::SubmitRoutingPoint(m2::PointD const & pt, bool pointIsMercator) |
| 561 | { |
| 562 | auto & routingManager = m_framework.GetRoutingManager(); |
| 563 | |
| 564 | // Check if limit of intermediate points is reached. |
| 565 | bool const isIntermediate = m_routePointAddMode == RouteMarkType::Intermediate; |
| 566 | if (isIntermediate && !routingManager.CouldAddIntermediatePoint()) |
| 567 | routingManager.RemoveRoutePoint(RouteMarkType::Intermediate, 0); |
| 568 | |
| 569 | // Insert implicit start point. |
| 570 | if (m_routePointAddMode == RouteMarkType::Finish && routingManager.GetRoutePoints().empty()) |
| 571 | { |
| 572 | RouteMarkData startPoint; |
| 573 | startPoint.m_pointType = RouteMarkType::Start; |
| 574 | startPoint.m_isMyPosition = true; |
| 575 | routingManager.AddRoutePoint(std::move(startPoint)); |
| 576 | } |
| 577 | |
| 578 | RouteMarkData point; |
| 579 | point.m_pointType = m_routePointAddMode; |
| 580 | point.m_isMyPosition = false; |
| 581 | if (!isIntermediate) |
| 582 | point.m_position = GetCoordsFromSettingsIfExists(false /* start */, pt, pointIsMercator); |
| 583 | else |
| 584 | point.m_position = pointIsMercator ? pt : P2G(pt); |
| 585 | |
| 586 | routingManager.AddRoutePoint(std::move(point)); |
| 587 | |
| 588 | if (routingManager.GetRoutePoints().size() >= 2) |
| 589 | { |
| 590 | if (RoutingSettings::UseDebugGuideTrack()) |
| 591 | { |
| 592 | // Like in guides_tests.cpp, GetTestGuides(). |
| 593 | routing::GuidesTracks guides; |
| 594 | guides[10] = {{{mercator::FromLatLon(48.13999, 11.56873), 10}, |
| 595 | {mercator::FromLatLon(48.14096, 11.57246), 10}, |
| 596 | {mercator::FromLatLon(48.14487, 11.57259), 10}}}; |
| 597 | routingManager.RoutingSession().SetGuidesForTests(std::move(guides)); |
| 598 | } |
| 599 | else |
| 600 | routingManager.RoutingSession().SetGuidesForTests({}); |
| 601 | |
| 602 | routingManager.BuildRoute(); |
| 603 | } |
| 604 | } |
| 605 | |
| 606 | void DrawWidget::SubmitBookmark(m2::PointD const & pt) |
| 607 | { |
nothing calls this directly
no test coverage detected