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

Function BuildPosterGraph

libs/routing/routing_tests/restriction_test.cpp:460–491  ·  view source on GitHub ↗

1 *-F4-*-F5-*---F6---* Finish | | F2 F3 | | 0 *---F1----*---F0---* Start 0 1 2 Note 1. All features except for F7 are two-way. Note 2. Any feature contains of one segment.

Source from the content-addressed store, hash-verified

458// Note 1. All features except for F7 are two-way.
459// Note 2. Any feature contains of one segment.
460unique_ptr<SingleVehicleWorldGraph> BuildPosterGraph()
461{
462 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
463 loader->AddRoad(0 /* feature id */, false /* one way */, 1.0 /* speed */,
464 RoadGeometry::Points({{2.0, 0.0}, {1.0, 0.0}}));
465 loader->AddRoad(1 /* feature id */, false /* one way */, 1.0 /* speed */,
466 RoadGeometry::Points({{1.0, 0.0}, {0.0, 0.0}}));
467 loader->AddRoad(2 /* feature id */, false /* one way */, 1.0 /* speed */,
468 RoadGeometry::Points({{0.0, 0.0}, {0.0, 1.0}}));
469 loader->AddRoad(3 /* feature id */, false /* one way */, 1.0 /* speed */,
470 RoadGeometry::Points({{1.0, 0.0}, {1.0, 1.0}}));
471 loader->AddRoad(4 /* feature id */, false /* one way */, 1.0 /* speed */,
472 RoadGeometry::Points({{0.0, 1.0}, {0.5, 1.0}}));
473 loader->AddRoad(5 /* feature id */, false /* one way */, 1.0 /* speed */,
474 RoadGeometry::Points({{0.5, 1.0}, {1.0, 1.0}}));
475 loader->AddRoad(6 /* feature id */, false /* one way */, 1.0 /* speed */,
476 RoadGeometry::Points({{1.0, 1.0}, {2.0, 1.0}}));
477
478 vector<Joint> const joints = {
479 MakeJoint({{1 /* feature id */, 1 /* point id */}, {2, 0}}), /* joint at point (0, 0) */
480 MakeJoint({{2, 1}, {4, 0}}), /* joint at point (0, 1) */
481 MakeJoint({{4, 1}, {5, 0}}), /* joint at point (0.5, 1) */
482 MakeJoint({{1, 0}, {3, 0}, {0, 1}}), /* joint at point (1, 0) */
483 MakeJoint({{3, 1}, {5, 1}, {6, 0}}), /* joint at point (1, 1) */
484 MakeJoint({{0, 0}}), /* joint at point (2, 0) */
485 MakeJoint({{6, 1}}), /* joint at point (2, 1) */
486 };
487
488 traffic::TrafficCache const trafficCache;
489 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
490 return BuildWorldGraph(std::move(loader), estimator, joints);
491}
492
493// Route through poster graph without any restrictions.
494UNIT_TEST(PosterGraph)

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