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

Function BuildTwoWayGraph

libs/routing/routing_tests/restriction_test.cpp:539–561  ·  view source on GitHub ↗

1 *--F1--> ↗ ↘ F1 F1 ↗ ↘ 0 Start *---F3--->*---F0--->-------F0----->*---F2-->* Finish -1 0 1 2 3 4 Note. F0 is a two segments feature. F1 is a three segment one. F2 and F3 are one segment features.

Source from the content-addressed store, hash-verified

537// Note. F0 is a two segments feature. F1 is a three segment one. F2 and F3 are one segment
538// features.
539unique_ptr<WorldGraph> BuildTwoWayGraph()
540{
541 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
542 loader->AddRoad(0 /* feature id */, true /* oneWay */, 1.0 /* speed */,
543 RoadGeometry::Points({{0.0, 0.0}, {1.0, 0.0}, {3.0, 0}}));
544 loader->AddRoad(1 /* feature id */, true /* oneWay */, 1.0 /* speed */,
545 RoadGeometry::Points({{0.0, 0.0}, {1.0, 1.0}, {2.0, 1.0}, {3.0, 0.0}}));
546 loader->AddRoad(2 /* feature id */, true /* oneWay */, 1.0 /* speed */,
547 RoadGeometry::Points({{3.0, 0.0}, {4.0, 0.0}}));
548 loader->AddRoad(3 /* feature id */, true /* oneWay */, 1.0 /* speed */,
549 RoadGeometry::Points({{-1.0, 0.0}, {0.0, 0.0}}));
550
551 vector<Joint> const joints = {
552 MakeJoint({{0 /* feature id */, 0 /* point id */}, {1, 0}, {3, 1}}), /* joint at point (0, 0) */
553 MakeJoint({{0 /* feature id */, 2 /* point id */}, {1, 3}, {2, 0}}), /* joint at point (3, 0) */
554 MakeJoint({{3 /* feature id */, 0 /* point id */}}), /* joint at point (-1, 0) */
555 MakeJoint({{2 /* feature id */, 1 /* point id */}}), /* joint at point (4, 0) */
556 };
557
558 traffic::TrafficCache const trafficCache;
559 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
560 return BuildWorldGraph(std::move(loader), estimator, joints);
561}
562
563UNIT_TEST(TwoWayGraph)
564{

Callers 1

UNIT_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