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

Function BuildFlagGraph

libs/routing/routing_tests/restriction_test.cpp:369–400  ·  view source on GitHub ↗

2 | F6 |Finish 1 *-F4-*-F5- | | F2 F3 | | 0 *---F1----*---F0---* Start 0 1 2 Note 1. All features are two-way. (It's possible to std::move along any direction of the features.) Note 2. Any feature contains of one segment.

Source from the content-addressed store, hash-verified

367// Note 1. All features are two-way. (It's possible to std::move along any direction of the features.)
368// Note 2. Any feature contains of one segment.
369unique_ptr<SingleVehicleWorldGraph> BuildFlagGraph()
370{
371 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
372 loader->AddRoad(0 /* feature id */, false /* one way */, 1.0 /* speed */,
373 RoadGeometry::Points({{2.0, 0.0}, {1.0, 0.0}}));
374 loader->AddRoad(1 /* feature id */, false /* one way */, 1.0 /* speed */,
375 RoadGeometry::Points({{1.0, 0.0}, {0.0, 0.0}}));
376 loader->AddRoad(2 /* feature id */, false /* one way */, 1.0 /* speed */,
377 RoadGeometry::Points({{0.0, 0.0}, {0.0, 1.0}}));
378 loader->AddRoad(3 /* feature id */, false /* one way */, 1.0 /* speed */,
379 RoadGeometry::Points({{1.0, 0.0}, {1.0, 1.0}}));
380 loader->AddRoad(4 /* feature id */, false /* one way */, 1.0 /* speed */,
381 RoadGeometry::Points({{0.0, 1.0}, {0.5, 1.0}}));
382 loader->AddRoad(5 /* feature id */, false /* one way */, 1.0 /* speed */,
383 RoadGeometry::Points({{0.5, 1.0}, {1.0, 1.0}}));
384 loader->AddRoad(6 /* feature id */, false /* one way */, 1.0 /* speed */,
385 RoadGeometry::Points({{0.5, 1.0}, {0.5, 2.0}}));
386
387 vector<Joint> const joints = {
388 MakeJoint({{1 /* feature id */, 1 /* point id */}, {2, 0}}), /* joint at point (0, 0) */
389 MakeJoint({{2, 1}, {4, 0}}), /* joint at point (0, 1) */
390 MakeJoint({{4, 1}, {5, 0}, {6, 0}}), /* joint at point (0.5, 1) */
391 MakeJoint({{1, 0}, {3, 0}, {0, 1}}), /* joint at point (1, 0) */
392 MakeJoint({{3, 1}, {5, 1}}), /* joint at point (1, 1) */
393 MakeJoint({{6, 1}}), /* joint at point (0.5, 2) */
394 MakeJoint({{0, 0}}), /* joint at point (2, 0) */
395 };
396
397 traffic::TrafficCache const trafficCache;
398 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
399 return BuildWorldGraph(std::move(loader), estimator, joints);
400}
401
402// Route through flag graph without any restrictions.
403UNIT_TEST(FlagGraph)

Callers 2

UNIT_TESTFunction · 0.85
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