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

Function BuildCubeGraph

libs/routing/routing_tests/cumulative_restriction_test.cpp:243–271  ·  view source on GitHub ↗

2 ↗ ↘ F4 F5 ↗ ↘ 1 ↖ ↑ F2 F3 ↖ ↓ <-- Finish 0 * *--F1---> ^ F0 | -1 0 1 2 3 Start Note. This graph contains of 9 one segment directed features.

Source from the content-addressed store, hash-verified

241// Start
242// Note. This graph contains of 9 one segment directed features.
243unique_ptr<SingleVehicleWorldGraph> BuildCubeGraph()
244{
245 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
246 loader->AddRoad(0 /* featureId */, true /* oneWay */, 1.0 /* speed */,
247 RoadGeometry::Points({{2.0, -1.0}, {2.0, 0.0}}));
248 loader->AddRoad(1 /* featureId */, true /* oneWay */, 1.0 /* speed */,
249 RoadGeometry::Points({{2.0, 0.0}, {3.0, 0.0}}));
250 loader->AddRoad(2 /* featureId */, true /* oneWay */, 1.0 /* speed */,
251 RoadGeometry::Points({{2.0, 0.0}, {1.0, 1.0}}));
252 loader->AddRoad(3 /* featureId */, false /* oneWay */, 1.0 /* speed */,
253 RoadGeometry::Points({{3.0, 1.0}, {3.0, 0.0}}));
254 loader->AddRoad(4 /* featureId */, true /* oneWay */, 1.0 /* speed */,
255 RoadGeometry::Points({{1.0, 1.0}, {2.0, 2.0}}));
256 loader->AddRoad(5 /* featureId */, true /* oneWay */, 1.0 /* speed */,
257 RoadGeometry::Points({{2.0, 2.0}, {3.0, 1.0}}));
258
259 vector<Joint> const joints = {
260 MakeJoint({{0 /* feature id */, 0 /* point id */}}), /* joint at point (2, -1) */
261 MakeJoint({{0, 1}, {1, 0}, {2, 0}}), /* joint at point (2, 0) */
262 MakeJoint({{2, 1}, {4, 0}}), /* joint at point (1, 1) */
263 MakeJoint({{4, 1}, {5, 0}}), /* joint at point (2, 2) */
264 MakeJoint({{5, 1}, {3, 0}}), /* joint at point (3, 1) */
265 MakeJoint({{1, 1}, {3, 1}}), /* joint at point (3, 0) */
266 };
267
268 traffic::TrafficCache const trafficCache;
269 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
270 return BuildWorldGraph(std::move(loader), estimator, joints);
271}
272
273// Route through XY graph without any restrictions.
274UNIT_CLASS_TEST(RestrictionTest, XXGraph)

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