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

Method AddRoundaboutToRoad

generator/mini_roundabout_transformer.cpp:149–178  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

147}
148
149bool MiniRoundaboutTransformer::AddRoundaboutToRoad(RoundaboutUnit const & roundaboutOnRoad, PointsT & roundaboutCircle,
150 PointsT & road,
151 std::vector<feature::FeatureBuilder> & newRoads) const
152{
153 auto const roundaboutCenter = roundaboutOnRoad.m_location;
154 auto itPointUpd = GetIterOnRoad(roundaboutCenter, road);
155
156 CHECK(itPointUpd != road.end(), ());
157
158 auto itPointNearRoundabout = itPointUpd;
159 bool const isMiddlePoint = MoveIterAwayFromRoundabout(itPointNearRoundabout, road);
160 m2::PointD const nextPointOnRoad = GetPointAtDistFromTarget(
161 *itPointNearRoundabout /* source */, roundaboutCenter /* target */, m_radiusMercator /* dist */);
162
163 if (isMiddlePoint && !AlmostEqualAbs(nextPointOnRoad, *itPointNearRoundabout, kMwmPointAccuracy))
164 {
165 auto surrogateRoad = CreateSurrogateRoad(roundaboutOnRoad, roundaboutCircle, road, itPointUpd);
166 if (surrogateRoad.size() < 2)
167 return false;
168 auto fbSurrogateRoad = CreateFb(std::move(surrogateRoad), roundaboutOnRoad.m_roadId);
169 for (auto const & t : roundaboutOnRoad.m_roadTypes)
170 fbSurrogateRoad.AddType(t);
171
172 newRoads.push_back(std::move(fbSurrogateRoad));
173 }
174
175 AddPointToCircle(roundaboutCircle, nextPointOnRoad);
176 *itPointUpd = nextPointOnRoad;
177 return true;
178}
179
180void MiniRoundaboutTransformer::AddRoad(feature::FeatureBuilder && road)
181{

Callers

nothing calls this directly

Calls 10

GetIterOnRoadFunction · 0.85
GetPointAtDistFromTargetFunction · 0.85
CreateFbFunction · 0.85
AddPointToCircleFunction · 0.85
AlmostEqualAbsFunction · 0.50
endMethod · 0.45
sizeMethod · 0.45
AddTypeMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected