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

Function BuildLoopGraph

libs/routing/routing_tests/index_graph_test.cpp:596–625  ·  view source on GitHub ↗

Finish 0.0004 ^ | F2 | | 0.0003 6*---------*5 | | | | | | | | | | 0.0002 7* *4 | | | | 0.00015 8* F0 *3 \ / \ / 1 0 0.0001 9*---F0-*---- 2 ^ | F1 | | 0 * Start 0 0.0001 0.0002 F0 is a two-way feature with a loop and F1 and F2 are an one-way one-segment fea

Source from the content-addressed store, hash-verified

594// 0 0.0001 0.0002
595// F0 is a two-way feature with a loop and F1 and F2 are an one-way one-segment features.
596unique_ptr<SingleVehicleWorldGraph> BuildLoopGraph()
597{
598 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
599 loader->AddRoad(0 /* feature id */, false /* one way */, 100.0 /* speed */,
600 RoadGeometry::Points({{0.0002, 0.0001},
601 {0.00015, 0.0001},
602 {0.0001, 0.0001},
603 {0.00015, 0.00015},
604 {0.00015, 0.0002},
605 {0.00015, 0.0003},
606 {0.00005, 0.0003},
607 {0.00005, 0.0002},
608 {0.00005, 0.00015},
609 {0.0001, 0.0001}}));
610 loader->AddRoad(1 /* feature id */, true /* one way */, 100.0 /* speed */,
611 RoadGeometry::Points({{0.0002, 0.0}, {0.0002, 0.0001}}));
612 loader->AddRoad(2 /* feature id */, true /* one way */, 100.0 /* speed */,
613 RoadGeometry::Points({{0.00005, 0.0003}, {0.00005, 0.0004}}));
614
615 vector<Joint> const joints = {
616 MakeJoint({{0 /* feature id */, 2 /* point id */}, {0, 9}}), /* joint at point (0.0002, 0) */
617 MakeJoint({{1, 1}, {0, 0}}), /* joint at point (0.0002, 0.0001) */
618 MakeJoint({{0, 6}, {2, 0}}), /* joint at point (0.00005, 0.0003) */
619 MakeJoint({{2, 1}}), /* joint at point (0.00005, 0.0004) */
620 };
621
622 traffic::TrafficCache const trafficCache;
623 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
624 return BuildWorldGraph(std::move(loader), estimator, joints);
625}
626
627// This test checks that the route from Start to Finish doesn't make an extra loop in F0.
628// If it was so the route time had been much more.

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