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

Function BuildCrossGraph

libs/routing/routing_tests/world_graph_builder.cpp:39–67  ·  view source on GitHub ↗

Finish ^ | F7 | ^ | F6 | Start * -- F0 --> * -- F1 --> * <-- F2 --> * <-- F3 --> | ^ | | F4 F5 | | ⌄ |

Source from the content-addressed store, hash-verified

37// ⌄ |
38// *
39std::unique_ptr<SingleVehicleWorldGraph> BuildCrossGraph()
40{
41 std::unique_ptr<TestGeometryLoader> loader = std::make_unique<TestGeometryLoader>();
42 loader->AddRoad(0 /* featureId */, true /* oneWay */, 1.0 /* speed */,
43 RoadGeometry::Points({{-1.0, 0.0}, {0.0, 0.0}}));
44 loader->AddRoad(1 /* featureId */, true /* oneWay */, 1.0 /* speed */,
45 RoadGeometry::Points({{0.0, 0.0}, {1.0, 0.0}}));
46 loader->AddRoad(2 /* featureId */, false /* oneWay */, 1.0 /* speed */,
47 RoadGeometry::Points({{1.0, 0.0}, {1.9999, 0.0}}));
48 loader->AddRoad(3 /* featureId */, false /* oneWay */, 1.0 /* speed */,
49 RoadGeometry::Points({{1.9999, 0.0}, {3.0, 0.0}}));
50 loader->AddRoad(4 /* featureId */, true /* oneWay */, 1.0 /* speed */,
51 RoadGeometry::Points({{1.0, 0.0}, {1.0, -1.0}}));
52 loader->AddRoad(5 /* featureId */, true /* oneWay */, 1.0 /* speed */,
53 RoadGeometry::Points({{1.0, -1.0}, {1.0, 0.0}}));
54 loader->AddRoad(6 /* featureId */, true /* oneWay */, 1.0 /* speed */,
55 RoadGeometry::Points({{1.0, 0.0}, {1.0, 1.0}}));
56 loader->AddRoad(7 /* featureId */, true /* oneWay */, 1.0 /* speed */,
57 RoadGeometry::Points({{1.0, 1.0}, {1.0, 2.0}}));
58
59 std::vector<Joint> const joints = {MakeJoint({{0, 1}, {1, 0}}), MakeJoint({{1, 1}, {2, 0}, {4, 0}, {5, 1}, {6, 0}}),
60 MakeJoint({{2, 1}, {3, 0}}), MakeJoint({{4, 1}, {5, 0}}),
61 MakeJoint({{6, 1}, {7, 0}})};
62
63 traffic::TrafficCache const trafficCache;
64 std::shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
65
66 return BuildWorldGraph(std::move(loader), estimator, joints);
67}
68
69//
70// 2 * -- F2 --> * -- F2 --> * -- F2 --> * -- F5 --> *

Callers 2

UNIT_CLASS_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 2

UNIT_CLASS_TESTFunction · 0.68
UNIT_CLASS_TESTFunction · 0.68