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

Function BuildTriangularGraph

libs/routing/routing_tests/restriction_test.cpp:70–98  ·  view source on GitHub ↗

Finish 3 ^ | F4 | 2 ^ ↖ | F1 | ↖ 1 | F0 ↖ | F2 | ↖ 0 *<--F3---<--F3---*<--F5--* Start 0 1 2 3 Note. F0, F1 and F2 are one segment features. F3 is a two segments feature.

Source from the content-addressed store, hash-verified

68// 0 1 2 3
69// Note. F0, F1 and F2 are one segment features. F3 is a two segments feature.
70unique_ptr<SingleVehicleWorldGraph> BuildTriangularGraph()
71{
72 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
73 loader->AddRoad(0 /* featureId */, true /* oneWay */, 1.0 /* speed */,
74 RoadGeometry::Points({{0.0, 0.0}, {0.0, 2.0}}));
75 loader->AddRoad(1 /* featureId */, true /* oneWay */, 1.0 /* speed */,
76 RoadGeometry::Points({{1.0, 1.0}, {0.0, 2.0}}));
77 loader->AddRoad(2 /* featureId */, true /* oneWay */, 1.0 /* speed */,
78 RoadGeometry::Points({{2.0, 0.0}, {1.0, 1.0}}));
79 loader->AddRoad(3 /* featureId */, true /* oneWay */, 1.0 /* speed */,
80 RoadGeometry::Points({{2.0, 0.0}, {1.0, 0.0}, {0.0, 0.0}}));
81 loader->AddRoad(4 /* featureId */, true /* oneWay */, 1.0 /* speed */,
82 RoadGeometry::Points({{0.0, 2.0}, {0.0, 3.0}}));
83 loader->AddRoad(5 /* featureId */, true /* oneWay */, 1.0 /* speed */,
84 RoadGeometry::Points({{3.0, 0.0}, {2.0, 0.0}}));
85
86 vector<Joint> const joints = {
87 MakeJoint({{2, 0}, {3, 0}, {5, 1}}), /* joint at point (2, 0) */
88 MakeJoint({{3, 2}, {0, 0}}), /* joint at point (0, 0) */
89 MakeJoint({{2, 1}, {1, 0}}), /* joint at point (1, 1) */
90 MakeJoint({{0, 1}, {1, 1}, {4, 0}}), /* joint at point (0, 2) */
91 MakeJoint({{5, 0}}), /* joint at point (3, 0) */
92 MakeJoint({{4, 1}}) /* joint at point (0, 3) */
93 };
94
95 traffic::TrafficCache const trafficCache;
96 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
97 return BuildWorldGraph(std::move(loader), estimator, joints);
98}
99
100// Route through triangular graph without any restrictions.
101UNIT_CLASS_TEST(RestrictionTest, TriangularGraph)

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