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

Function LoadCitiesBoundariesGeometry

generator/city_roads_generator.cpp:27–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25using std::string, std::vector;
26
27void LoadCitiesBoundariesGeometry(string const & boundariesPath, CitiesBoundariesChecker::CitiesBoundaries & result)
28{
29 if (!Platform::IsFileExistsByFullPath(boundariesPath))
30 {
31 LOG(LWARNING, ("No city boundaries file:", boundariesPath));
32 return;
33 }
34
35 generator::PlaceBoundariesHolder holder;
36 holder.Deserialize(boundariesPath);
37
38 size_t points = 0, areas = 0;
39 holder.ForEachLocality([&](generator::PlaceBoundariesHolder::Locality & loc)
40 {
41 CHECK(loc.TestValid(), ());
42
43 if (loc.IsPoint() || !loc.IsHonestCity())
44 {
45 ++points;
46 double const radiusM = ftypes::GetRadiusByPopulationForRouting(loc.GetPopulation(), loc.GetPlace());
47 result.emplace_back(
48 ms::CreateCircleGeometryOnEarth(mercator::ToLatLon(loc.m_center), radiusM, 30.0 /* angleStepDegree */));
49 }
50 else
51 {
52 ++areas;
53 for (auto & poly : loc.m_boundary)
54 result.emplace_back(std::move(poly));
55 }
56 });
57
58 LOG(LINFO, ("Read", points, "point places and", areas, "area places from:", boundariesPath));
59}
60
61/// \brief Fills |cityRoadFeatureIds| with road feature ids if more then
62/// |kInCityPointsRatio| * <feature point number> points of the feature belongs to a city or a town

Callers 1

CalcRoadFeatureIdsFunction · 0.85

Calls 11

ForEachLocalityMethod · 0.80
IsHonestCityMethod · 0.80
GetPlaceMethod · 0.80
ToLatLonFunction · 0.70
DeserializeMethod · 0.45
TestValidMethod · 0.45
IsPointMethod · 0.45
GetPopulationMethod · 0.45
emplace_backMethod · 0.45

Tested by

no test coverage detected