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

Function BuildTwoSquaresGraph

libs/routing/routing_tests/restriction_test.cpp:258–302  ·  view source on GitHub ↗

Finish 3 ^ | F11 | 2 *<---F5----*<---F6--- ^ ↖ ^ ↖ ^ | F7 | F8 | | ↖ F1 ↖ F2 | ↖ | ↖ | 1 F0 | ^ ↖ ^ | F1 F9 F2 | | ↖ | 0 *<----F4---*<---F3----*<--F10---* Start 0 1 2 3 Note. F1 and F2 are two segments features. The others are one segment ones.

Source from the content-addressed store, hash-verified

256// 0 1 2 3
257// Note. F1 and F2 are two segments features. The others are one segment ones.
258unique_ptr<SingleVehicleWorldGraph> BuildTwoSquaresGraph()
259{
260 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
261 loader->AddRoad(0 /* feature id */, true /* oneWay */, 1.0 /* speed */,
262 RoadGeometry::Points({{0.0, 0.0}, {0.0, 2.0}}));
263 loader->AddRoad(1 /* feature id */, true /* oneWay */, 1.0 /* speed */,
264 RoadGeometry::Points({{1.0, 0.0}, {1.0, 1.0}, {1.0, 2.0}}));
265 loader->AddRoad(2 /* feature id */, true /* oneWay */, 1.0 /* speed */,
266 RoadGeometry::Points({{2.0, 0.0}, {2.0, 1.0}, {2.0, 2.0}}));
267 loader->AddRoad(3 /* feature id */, true /* oneWay */, 1.0 /* speed */,
268 RoadGeometry::Points({{2.0, 0.0}, {1.0, 0.0}}));
269 loader->AddRoad(4 /* feature id */, true /* oneWay */, 1.0 /* speed */,
270 RoadGeometry::Points({{1.0, 0.0}, {0.0, 0.0}}));
271 loader->AddRoad(5 /* feature id */, true /* oneWay */, 1.0 /* speed */,
272 RoadGeometry::Points({{1.0, 2.0}, {0.0, 2.0}}));
273 loader->AddRoad(6 /* feature id */, true /* oneWay */, 1.0 /* speed */,
274 RoadGeometry::Points({{2.0, 2.0}, {1.0, 2.0}}));
275 loader->AddRoad(7 /* feature id */, true /* oneWay */, 1.0 /* speed */,
276 RoadGeometry::Points({{1.0, 1.0}, {0.0, 2.0}}));
277 loader->AddRoad(8 /* feature id */, true /* oneWay */, 1.0 /* speed */,
278 RoadGeometry::Points({{2.0, 1.0}, {1.0, 2.0}}));
279 loader->AddRoad(9 /* feature id */, true /* oneWay */, 1.0 /* speed */,
280 RoadGeometry::Points({{2.0, 0.0}, {1.0, 1.0}}));
281 loader->AddRoad(10 /* feature id */, true /* oneWay */, 1.0 /* speed */,
282 RoadGeometry::Points({{3.0, 0.0}, {2.0, 0.0}}));
283 loader->AddRoad(11 /* feature id */, true /* oneWay */, 1.0 /* speed */,
284 RoadGeometry::Points({{0.0, 2.0}, {0.0, 3.0}}));
285
286 vector<Joint> const joints = {
287 MakeJoint({{4 /* featureId */, 1 /* pointId */}, {0, 0}}), /* joint at point (0, 0) */
288 MakeJoint({{0, 1}, {5, 1}, {7, 1}, {11, 0}}), /* joint at point (0, 2) */
289 MakeJoint({{4, 0}, {1, 0}, {3, 1}}), /* joint at point (1, 0) */
290 MakeJoint({{5, 0}, {1, 2}, {6, 1}, {8, 1}}), /* joint at point (1, 2) */
291 MakeJoint({{3, 0}, {2, 0}, {9, 0}, {10, 1}}), /* joint at point (2, 0) */
292 MakeJoint({{2, 2}, {6, 0}}), /* joint at point (2, 2) */
293 MakeJoint({{1, 1}, {9, 1}, {7, 0}}), /* joint at point (1, 1) */
294 MakeJoint({{2, 1}, {8, 0}}), /* joint at point (2, 1) */
295 MakeJoint({{10, 0}}), /* joint at point (3, 0) */
296 MakeJoint({{11, 1}}), /* joint at point (0, 3) */
297 };
298
299 traffic::TrafficCache const trafficCache;
300 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
301 return BuildWorldGraph(std::move(loader), estimator, joints);
302}
303
304UNIT_CLASS_TEST(RestrictionTest, TwoSquaresGraph)
305{

Callers 1

UNIT_CLASS_TESTFunction · 0.85

Calls 5

PointsFunction · 0.85
MakeJointFunction · 0.85
CreateEstimatorForCarFunction · 0.85
BuildWorldGraphFunction · 0.85
AddRoadMethod · 0.45

Tested by

no test coverage detected