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

Function BuildTwoCubeGraph

generator/generator_tests/restriction_collector_test.cpp:49–94  ·  view source on GitHub ↗

2 ↗ ↘ F5 F4 ↗ ↘ Finish 1 * *<- F3 ->*-> F8 -> *-> F10 -> ↖ ↑ ↗ F6 F2 F9 Start ↖ ↑ ↗ 0 *-> F7 ->*-> F0 ->*-> F1 -> -1 0 1 2 3 4

Source from the content-addressed store, hash-verified

47// -1 0 1 2 3 4
48//
49std::unique_ptr<IndexGraph> BuildTwoCubeGraph()
50{
51 classificator::Load();
52 std::unique_ptr<TestGeometryLoader> loader = std::make_unique<TestGeometryLoader>();
53 loader->AddRoad(0 /* feature id */, true /* one way */, 1.0 /* speed */,
54 RoadGeometry::Points({{0.0, 0.0}, {1.0, 0.0}}));
55 loader->AddRoad(1 /* feature id */, true /* one way */, 1.0 /* speed */,
56 RoadGeometry::Points({{1.0, 0.0}, {2.0, 0.0}}));
57 loader->AddRoad(2 /* feature id */, true /* one way */, 1.0 /* speed */,
58 RoadGeometry::Points({{2.0, 0.0}, {2.0, 1.0}}));
59 loader->AddRoad(3 /* feature id */, false /* one way */, 1.0 /* speed */,
60 RoadGeometry::Points({{1.0, 1.0}, {2.0, 1.0}}));
61 loader->AddRoad(4 /* feature id */, true /* one way */, 1.0 /* speed */,
62 RoadGeometry::Points({{0.0, 2.0}, {1.0, 1.0}}));
63 loader->AddRoad(5 /* feature id */, true /* one way */, 1.0 /* speed */,
64 RoadGeometry::Points({{-1.0, 1.0}, {0.0, 2.0}}));
65 loader->AddRoad(6 /* feature id */, true /* one way */, 1.0 /* speed */,
66 RoadGeometry::Points({{0.0, 0.0}, {-1.0, 1.0}}));
67 loader->AddRoad(7 /* feature id */, true /* one way */, 1.0 /* speed */,
68 RoadGeometry::Points({{-1.0, 0.0}, {0.0, 0.0}}));
69 loader->AddRoad(8 /* feature id */, true /* one way */, 1.0 /* speed */,
70 RoadGeometry::Points({{2.0, 1.0}, {3.0, 1.0}}));
71 loader->AddRoad(9 /* feature id */, true /* one way */, 1.0 /* speed */,
72 RoadGeometry::Points({{2.0, 0.0}, {3.0, 1.0}}));
73 loader->AddRoad(10 /* feature id */, true /* one way */, 1.0 /* speed */,
74 RoadGeometry::Points({{3.0, 1.0}, {4.0, 1.0}}));
75
76 std::vector<Joint> const joints = {
77 // {{/* feature id */, /* point id */}, ... }
78 MakeJoint({{7, 0}}), /* joint at point (-1, 0) */
79 MakeJoint({{0, 0}, {6, 0}, {7, 1}}), /* joint at point (0, 0) */
80 MakeJoint({{0, 1}, {1, 0}}), /* joint at point (1, 0) */
81 MakeJoint({{1, 1}, {2, 0}, {9, 0}}), /* joint at point (2, 0) */
82 MakeJoint({{2, 1}, {3, 1}, {8, 0}}), /* joint at point (2, 1) */
83 MakeJoint({{3, 0}, {4, 1}}), /* joint at point (1, 1) */
84 MakeJoint({{5, 1}, {4, 0}}), /* joint at point (0, 2) */
85 MakeJoint({{6, 1}, {5, 0}}), /* joint at point (-1, 1) */
86 MakeJoint({{8, 1}, {9, 1}, {10, 0}}), /* joint at point (3, 1) */
87 MakeJoint({{10, 1}}) /* joint at point (4, 1) */
88 };
89
90 traffic::TrafficCache const trafficCache;
91 std::shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
92
93 return BuildIndexGraph(std::move(loader), estimator, joints);
94}
95
96std::string const kosmIdsToFeatureIdsContentForTwoCubeGraph =
97 R"(0, 0

Callers 3

ValidCaseMethod · 0.70

Calls 6

PointsFunction · 0.85
MakeJointFunction · 0.85
CreateEstimatorForCarFunction · 0.85
LoadFunction · 0.50
BuildIndexGraphFunction · 0.50
AddRoadMethod · 0.45

Tested by

no test coverage detected