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

Function DumpBorderToPolyFile

generator/borders.cpp:210–238  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

208}
209
210void 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
240void UnpackBorders(std::string const & baseDir, std::string const & targetDir)
241{

Callers 4

DumpPolyFilesMethod · 0.85
UnpackBordersFunction · 0.85
MakeFakeBordersFileFunction · 0.85

Calls 5

JoinPathFunction · 0.85
ToLatLonFunction · 0.70
emptyMethod · 0.45
DataMethod · 0.45
closeMethod · 0.45

Tested by 1

MakeFakeBordersFileFunction · 0.68