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

Function BuildXYGraph

libs/routing/routing_tests/cumulative_restriction_test.cpp:44–73  ·  view source on GitHub ↗

Finish 3 ^ F5 | 2 ↖ ↗ ↖ F2 F3 F4 ↖ ↗ ↖ 1 ↗ ↖ F0 F1 ↗ ↖ 0 0 1 2 3 Start Note. This graph contains of 6 one segment directed features.

Source from the content-addressed store, hash-verified

42// Start
43// Note. This graph contains of 6 one segment directed features.
44unique_ptr<SingleVehicleWorldGraph> BuildXYGraph()
45{
46 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
47 loader->AddRoad(0 /* featureId */, true /* oneWay */, 1.0 /* speed */,
48 RoadGeometry::Points({{0.0, 0.0}, {1.0, 1.0}}));
49 loader->AddRoad(1 /* featureId */, true /* oneWay */, 1.0 /* speed */,
50 RoadGeometry::Points({{2.0, 0.0}, {1.0, 1.0}}));
51 loader->AddRoad(2 /* featureId */, true /* oneWay */, 1.0 /* speed */,
52 RoadGeometry::Points({{1.0, 1.0}, {0.0, 2.0}}));
53 loader->AddRoad(3 /* featureId */, true /* oneWay */, 1.0 /* speed */,
54 RoadGeometry::Points({{1.0, 1.0}, {2.0, 2.0}}));
55 loader->AddRoad(4 /* featureId */, true /* oneWay */, 1.0 /* speed */,
56 RoadGeometry::Points({{3.0, 1.0}, {2.0, 2.0}}));
57 loader->AddRoad(5 /* featureId */, true /* oneWay */, 1.0 /* speed */,
58 RoadGeometry::Points({{2.0, 2.0}, {2.0, 3.0}}));
59
60 vector<Joint> const joints = {
61 MakeJoint({{0 /* feature id */, 0 /* point id */}}), /* joint at point (0, 0) */
62 MakeJoint({{1, 0}}), /* joint at point (2, 0) */
63 MakeJoint({{0, 1}, {1, 1}, {2, 0}, {3, 0}}), /* joint at point (1, 1) */
64 MakeJoint({{2, 1}}), /* joint at point (0, 2) */
65 MakeJoint({{3, 1}, {4, 1}, {5, 0}}), /* joint at point (2, 2) */
66 MakeJoint({{4, 0}}), /* joint at point (3, 1) */
67 MakeJoint({{5, 1}}), /* joint at point (2, 3) */
68 };
69
70 traffic::TrafficCache const trafficCache;
71 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
72 return BuildWorldGraph(std::move(loader), estimator, joints);
73}
74
75using Algorithm = AStarAlgorithm<Segment, SegmentEdge, RouteWeight>;
76

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