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

Function BuildLineGraph

libs/routing/routing_tests/restriction_test.cpp:639–659  ·  view source on GitHub ↗

0 Start *--F0--->*<--F1---*---F1---*---F1--->*---F2-->* Finish 0 1 2 3 4 5 Note. F0 and F2 are one segment one-way features. F1 is a 3 segment two-way feature.

Source from the content-addressed store, hash-verified

637// 0 1 2 3 4 5
638// Note. F0 and F2 are one segment one-way features. F1 is a 3 segment two-way feature.
639unique_ptr<SingleVehicleWorldGraph> BuildLineGraph()
640{
641 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
642 loader->AddRoad(0 /* feature id */, true /* one way */, 1.0 /* speed */,
643 RoadGeometry::Points({{0.0, 0.0}, {0.0, 1.0}}));
644 loader->AddRoad(1 /* feature id */, false /* one way */, 1.0 /* speed */,
645 RoadGeometry::Points({{1.0, 0.0}, {2.0, 0.0}, {3.0, 0.0}, {4.0, 0.0}}));
646 loader->AddRoad(2 /* feature id */, true /* one way */, 1.0 /* speed */,
647 RoadGeometry::Points({{4.0, 0.0}, {5.0, 0.0}}));
648
649 vector<Joint> const joints = {
650 MakeJoint({{0 /* feature id */, 0 /* point id */}}), /* joint at point (0, 0) */
651 MakeJoint({{0, 1}, {1, 0}}), /* joint at point (1, 0) */
652 MakeJoint({{1, 3}, {2, 0}}), /* joint at point (4, 0) */
653 MakeJoint({{2, 1}}), /* joint at point (5, 0) */
654 };
655
656 traffic::TrafficCache const trafficCache;
657 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
658 return BuildWorldGraph(std::move(loader), estimator, joints);
659}
660
661// This test checks that despite the fact uturn on F1 is prohibited (moving from F1 to F1 is
662// prohibited)

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