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

Function BuildTwoCubeGraph

generator/generator_tests/restriction_test.cpp:200–257  ·  view source on GitHub ↗

2 ↗ ↘ F5 F4 ↗ ↘ Finish 1 * *<- F3 ->*-> F8 -> *-> F10 -> ↖ ↑ ↗ F6 F2 F9 Start ↘ ↑ ↗ 0 *-> F7 ->*-> F0 ->*-> F1 -> -1 0 1 2 3 4

Source from the content-addressed store, hash-verified

198// -1 0 1 2 3 4
199//
200std::pair<unique_ptr<IndexGraph>, string> BuildTwoCubeGraph()
201{
202 classificator::Load();
203 auto loader = std::make_unique<TestGeometryLoader>();
204 loader->AddRoad(0 /* feature id */, true /* one way */, 1.0 /* speed */,
205 RoadGeometry::Points({{0.0, 0.0}, {1.0, 0.0}}));
206 loader->AddRoad(1 /* feature id */, true /* one way */, 1.0 /* speed */,
207 RoadGeometry::Points({{1.0, 0.0}, {2.0, 0.0}}));
208 loader->AddRoad(2 /* feature id */, true /* one way */, 1.0 /* speed */,
209 RoadGeometry::Points({{2.0, 0.0}, {2.0, 1.0}}));
210 loader->AddRoad(3 /* feature id */, false /* one way */, 1.0 /* speed */,
211 RoadGeometry::Points({{1.0, 1.0}, {2.0, 1.0}}));
212 loader->AddRoad(4 /* feature id */, true /* one way */, 1.0 /* speed */,
213 RoadGeometry::Points({{0.0, 2.0}, {1.0, 1.0}}));
214 loader->AddRoad(5 /* feature id */, true /* one way */, 1.0 /* speed */,
215 RoadGeometry::Points({{-1.0, 1.0}, {0.0, 2.0}}));
216 loader->AddRoad(6 /* feature id */, false /* one way */, 1.0 /* speed */,
217 RoadGeometry::Points({{0.0, 0.0}, {-1.0, 1.0}}));
218 loader->AddRoad(7 /* feature id */, true /* one way */, 1.0 /* speed */,
219 RoadGeometry::Points({{-1.0, 0.0}, {0.0, 0.0}}));
220 loader->AddRoad(8 /* feature id */, true /* one way */, 1.0 /* speed */,
221 RoadGeometry::Points({{2.0, 1.0}, {3.0, 1.0}}));
222 loader->AddRoad(9 /* feature id */, true /* one way */, 1.0 /* speed */,
223 RoadGeometry::Points({{2.0, 0.0}, {3.0, 1.0}}));
224 loader->AddRoad(10 /* feature id */, true /* one way */, 1.0 /* speed */,
225 RoadGeometry::Points({{3.0, 1.0}, {4.0, 1.0}}));
226
227 vector<Joint> const joints = {
228 // {{/* feature id */, /* point id */}, ... }
229 MakeJoint({{7, 0}}), /* joint at point (-1, 0) */
230 MakeJoint({{0, 0}, {6, 0}, {7, 1}}), /* joint at point (0, 0) */
231 MakeJoint({{0, 1}, {1, 0}}), /* joint at point (1, 0) */
232 MakeJoint({{1, 1}, {2, 0}, {9, 0}}), /* joint at point (2, 0) */
233 MakeJoint({{2, 1}, {3, 1}, {8, 0}}), /* joint at point (2, 1) */
234 MakeJoint({{3, 0}, {4, 1}}), /* joint at point (1, 1) */
235 MakeJoint({{5, 1}, {4, 0}}), /* joint at point (0, 2) */
236 MakeJoint({{6, 1}, {5, 0}}), /* joint at point (-1, 1) */
237 MakeJoint({{8, 1}, {9, 1}, {10, 0}}), /* joint at point (3, 1) */
238 MakeJoint({{10, 1}}) /* joint at point (4, 1) */
239 };
240
241 traffic::TrafficCache const trafficCache;
242 std::shared_ptr<EdgeEstimator> estimator = CreateEstimatorForCar(trafficCache);
243
244 string const osmIdsToFeatureIdsContent = R"(0, 0
245 1, 1
246 2, 2
247 3, 3
248 4, 4
249 5, 5
250 6, 6
251 7, 7
252 8, 8
253 9, 9
254 10, 10)";
255
256 return {BuildIndexGraph(std::move(loader), estimator, joints), osmIdsToFeatureIdsContent};
257}

Callers 1

UNIT_TESTFunction · 0.70

Calls 6

PointsFunction · 0.85
MakeJointFunction · 0.85
CreateEstimatorForCarFunction · 0.85
LoadFunction · 0.50
BuildIndexGraphFunction · 0.50
AddRoadMethod · 0.45

Tested by

no test coverage detected