| 208 | } |
| 209 | |
| 210 | void DumpBorderToPolyFile(std::string const & targetDir, storage::CountryId const & mwmName, |
| 211 | PolygonsList const & polygons) |
| 212 | { |
| 213 | CHECK(!polygons.empty(), ()); |
| 214 | |
| 215 | std::string const filePath = base::JoinPath(targetDir, mwmName + ".poly"); |
| 216 | std::ofstream poly(filePath); |
| 217 | CHECK(poly.good(), ()); |
| 218 | |
| 219 | // Used to have fixed precicion with 6 digits. And Alaska has 4 digits after comma :) Strange, but as is. |
| 220 | poly << std::setprecision(6) << std::fixed; |
| 221 | |
| 222 | poly << mwmName << std::endl; |
| 223 | size_t polygonId = 1; |
| 224 | for (auto const & points : polygons) |
| 225 | { |
| 226 | poly << polygonId << std::endl; |
| 227 | ++polygonId; |
| 228 | for (auto const & point : points.Data()) |
| 229 | { |
| 230 | ms::LatLon const ll = mercator::ToLatLon(point); |
| 231 | poly << " " << std::scientific << ll.m_lon << " " << ll.m_lat << std::endl; |
| 232 | } |
| 233 | poly << "END" << std::endl; |
| 234 | } |
| 235 | |
| 236 | poly << "END" << std::endl; |
| 237 | poly.close(); |
| 238 | } |
| 239 | |
| 240 | void UnpackBorders(std::string const & baseDir, std::string const & targetDir) |
| 241 | { |