| 25 | using std::string, std::vector; |
| 26 | |
| 27 | void 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 |
no test coverage detected