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

Function BuildTwowayCornerGraph

libs/routing/routing_tests/restriction_test.cpp:179–204  ·  view source on GitHub ↗

Finish 3 | F4 | 2 | ╲ F0 F2 | ╲ 1 | ╲ F0 F2 | ╲ 0 *---F1--*--F1--*--F3---* Start 0 1 2 3 Note. All features are two setments and two-way.

Source from the content-addressed store, hash-verified

177// 0 1 2 3
178// Note. All features are two setments and two-way.
179unique_ptr<SingleVehicleWorldGraph> BuildTwowayCornerGraph()
180{
181 unique_ptr<TestGeometryLoader> loader = make_unique<TestGeometryLoader>();
182 loader->AddRoad(0 /* feature id */, false /* oneWay */, 1.0 /* speed */,
183 RoadGeometry::Points({{0.0, 0.0}, {0.0, 1.0}, {0.0, 2.0}}));
184 loader->AddRoad(1 /* feature id */, false /* oneWay */, 1.0 /* speed */,
185 RoadGeometry::Points({{2.0, 0.0}, {1.0, 0.0}, {0.0, 0.0}}));
186 loader->AddRoad(2 /* feature id */, false /* oneWay */, 1.0 /* speed */,
187 RoadGeometry::Points({{2.0, 0.0}, {1.0, 1.0}, {0.0, 2.0}}));
188 loader->AddRoad(3 /* feature id */, false /* oneWay */, 1.0 /* speed */,
189 RoadGeometry::Points({{3.0, 0.0}, {2.0, 0.0}}));
190 loader->AddRoad(4 /* feature id */, false /* oneWay */, 1.0 /* speed */,
191 RoadGeometry::Points({{0.0, 2.0}, {0.0, 3.0}}));
192
193 vector<Joint> const joints = {
194 MakeJoint({{1 /* feature id */, 2 /* point id */}, {0, 0}})
195 /* joint at point (0, 0) */,
196 MakeJoint({{1, 0}, {2, 0}, {3, 1}}), /* joint at point (2, 0) */
197 MakeJoint({{2, 2}, {0, 2}, {4, 0}}), /* joint at point (0, 2) */
198 MakeJoint({{4, 1}}), /* joint at point (0, 3) */
199 MakeJoint({{3, 0}}), /* joint at point (3, 0) */
200 };
201 traffic::TrafficCache const trafficCache;
202 shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
203 return BuildWorldGraph(std::move(loader), estimator, joints);
204}
205
206UNIT_CLASS_TEST(RestrictionTest, TwowayCornerGraph)
207{

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