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

Method GetLastPointsForJoint

libs/routing/index_graph.cpp:112–147  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112void IndexGraph::GetLastPointsForJoint(SegmentListT const & children, bool isOutgoing, PointIdListT & lastPoints) const
113{
114 ASSERT(lastPoints.empty(), ());
115
116 lastPoints.reserve(children.size());
117 for (auto const & child : children)
118 {
119 uint32_t const startPointId = child.GetPointId(!isOutgoing /* front */);
120 uint32_t const pointsNumber = GetRoadGeometry(child.GetFeatureId()).GetPointsCount();
121 CHECK_LESS(startPointId, pointsNumber, (child));
122
123 uint32_t endPointId;
124 // child.IsForward() == isOutgoing
125 // This is the direction, indicating the end of the road,
126 // where we should go for building JointSegment.
127 // You can retrieve such result if bust possible options of |child.IsForward()| and |isOutgoing|.
128 bool forward = child.IsForward() == isOutgoing;
129 if (IsRoad(child.GetFeatureId()))
130 {
131 endPointId = GetRoad(child.GetFeatureId()).FindNeighbor(startPointId, forward, pointsNumber).second;
132 }
133 else
134 {
135 // child.GetFeatureId() can be not road in this case:
136 // -->--> { -->-->--> } -->
137 // Where { ... } - borders of mwm
138 // Here one feature, which enter from mwm A to mwm B and then exit from B to A.
139 // And in mwm B no other feature cross this one, those feature is in geometry
140 // and absent in roadIndex.
141 // In this case we just return endPointNumber.
142 endPointId = forward ? pointsNumber - 1 : 0;
143 }
144
145 lastPoints.push_back(endPointId);
146 }
147}
148
149void IndexGraph::GetEdgeList(astar::VertexData<JointSegment, RouteWeight> const & parentVertexData,
150 Segment const & parent, bool isOutgoing, JointEdgeListT & edges,

Callers 1

Calls 11

ASSERTFunction · 0.85
IsRoadFunction · 0.85
FindNeighborMethod · 0.80
emptyMethod · 0.45
reserveMethod · 0.45
sizeMethod · 0.45
GetPointIdMethod · 0.45
GetPointsCountMethod · 0.45
GetFeatureIdMethod · 0.45
IsForwardMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected