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

Function BuildNonPassThroughGraph

libs/routing/routing_tests/restriction_test.cpp:733–765  ·  view source on GitHub ↗

@todo By VNG: no-pass-through behaviour was changed. @see IndexGraphStarter::CheckLength ---F4--- | | F3 F5 | | 0 Start *---F0---*---F1---*---F2---* Finish 0 1 2 3

Source from the content-addressed store, hash-verified

731// 0 Start *---F0---*---F1---*---F2---* Finish
732// 0 1 2 3
733unique_ptr<SingleVehicleWorldGraph> BuildNonPassThroughGraph(bool passThroughStart, bool passThroughShortWay,
734 bool passThroughLongWay)
735{
736 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
737 loader->AddRoad(0 /* feature id */, false /* one way */, 1.0 /* speed */,
738 RoadGeometry::Points({{0.0, 0.0}, {1.0, 0.0}}));
739 loader->SetPassThroughAllowed(0 /* feature id */, passThroughStart);
740 loader->AddRoad(1 /* feature id */, false /* one way */, 1.0 /* speed */,
741 RoadGeometry::Points({{1.0, 0.0}, {2.0, 0.0}}));
742 loader->SetPassThroughAllowed(1 /* feature id */, passThroughShortWay);
743 loader->AddRoad(2 /* feature id */, false /* one way */, 1.0 /* speed */,
744 RoadGeometry::Points({{2.0, 0.0}, {3.0, 0.0}}));
745 loader->AddRoad(3 /* feature id */, false /* one way */, 1.0 /* speed */,
746 RoadGeometry::Points({{1.0, 0.0}, {1.0, 1.0}}));
747 loader->AddRoad(4 /* feature id */, false /* one way */, 1.0 /* speed */,
748 RoadGeometry::Points({{1.0, 1.0}, {2.0, 1.0}}));
749 loader->SetPassThroughAllowed(4 /* feature id */, passThroughLongWay);
750 loader->AddRoad(5 /* feature id */, false /* one way */, 1.0 /* speed */,
751 RoadGeometry::Points({{2.0, 1.0}, {2.0, 0.0}}));
752
753 vector<Joint> const joints = {
754 MakeJoint({{0 /* feature id */, 0 /* point id */}}), /* joint at point (0, 0) */
755 MakeJoint({{0, 1}, {1, 0}, {3, 0}}), /* joint at point (1, 0) */
756 MakeJoint({{1, 1}, {2, 0}, {5, 1}}), /* joint at point (2, 0) */
757 MakeJoint({{3, 1}, {4, 0}}), /* joint at point (1, 1) */
758 MakeJoint({{4, 1}, {5, 0}}), /* joint at point (2, 1) */
759 MakeJoint({{2, 1}}), /* joint at point (3, 0) */
760 };
761
762 traffic::TrafficCache const trafficCache;
763 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
764 return BuildWorldGraph(std::move(loader), estimator, joints);
765}
766
767UNIT_CLASS_TEST(RestrictionTest, NonPassThroughStart)
768{

Callers 1

UNIT_CLASS_TESTFunction · 0.85

Calls 6

PointsFunction · 0.85
MakeJointFunction · 0.85
CreateEstimatorForCarFunction · 0.85
BuildWorldGraphFunction · 0.85
SetPassThroughAllowedMethod · 0.80
AddRoadMethod · 0.45

Tested by

no test coverage detected