MCPcopy Create free account
hub / github.com/comaps/comaps / SubmitRoutingPoint

Method SubmitRoutingPoint

qt/draw_widget.cpp:560–604  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

558}
559
560void 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
606void DrawWidget::SubmitBookmark(m2::PointD const & pt)
607{

Callers

nothing calls this directly

Calls 10

SetGuidesForTestsMethod · 0.80
RoutingSessionMethod · 0.80
FromLatLonFunction · 0.50
RemoveRoutePointMethod · 0.45
emptyMethod · 0.45
GetRoutePointsMethod · 0.45
AddRoutePointMethod · 0.45
sizeMethod · 0.45
BuildRouteMethod · 0.45

Tested by

no test coverage detected