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

Function GetLastPassedPoint

libs/map/routing_manager.cpp:101–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

99}
100
101RouteMarkData GetLastPassedPoint(BookmarkManager * bmManager, vector<RouteMarkData> const & points)
102{
103 ASSERT_GREATER_OR_EQUAL(points.size(), 2, ());
104 ASSERT(points[0].m_pointType == RouteMarkType::Start, ());
105 RouteMarkData data = points[0];
106
107 for (int i = static_cast<int>(points.size()) - 1; i >= 0; i--)
108 {
109 if (points[i].m_isPassed)
110 {
111 data = points[i];
112 break;
113 }
114 }
115
116 // Last passed point will be considered as start point.
117 data.m_pointType = RouteMarkType::Start;
118 data.m_intermediateIndex = 0;
119 if (data.m_isMyPosition)
120 {
121 data.m_position = bmManager->MyPositionMark().GetPivot();
122 data.m_isMyPosition = false;
123 data.m_replaceWithMyPositionAfterRestart = true;
124 }
125
126 return data;
127}
128
129void SerializeRoutePoint(json_t * node, RouteMarkData const & data)
130{

Callers 1

GetRoutePointsToSaveMethod · 0.85

Calls 3

ASSERTFunction · 0.85
sizeMethod · 0.45
GetPivotMethod · 0.45

Tested by

no test coverage detected