| 60 | explicit PackedBordersGenerator(std::string const & baseDir) : m_writer(baseDir + PACKED_POLYGONS_FILE) {} |
| 61 | |
| 62 | void operator()(std::string name, PolygonsList && borders) |
| 63 | { |
| 64 | // use index in vector as tag |
| 65 | auto w = m_writer.GetWriter(strings::to_string(m_polys.size())); |
| 66 | serial::GeometryCodingParams cp; |
| 67 | |
| 68 | // calc rect |
| 69 | m2::RectD rect; |
| 70 | for (m2::RegionD const & border : borders) |
| 71 | rect.Add(border.GetRect()); |
| 72 | |
| 73 | // store polygon info |
| 74 | m_polys.push_back(storage::CountryDef(name, rect)); |
| 75 | |
| 76 | // write polygons as paths |
| 77 | WriteVarUint(w, borders.size()); |
| 78 | for (m2::RegionD const & border : borders) |
| 79 | { |
| 80 | std::vector<m2::PointD> const & in = border.Data(); |
| 81 | std::vector<m2::PointD> out; |
| 82 | |
| 83 | /// @todo Choose scale level for simplification. |
| 84 | SimplifyDefault(in.begin(), in.end(), math::Pow2(scales::GetEpsilonForSimplify(10)), out); |
| 85 | |
| 86 | serial::SaveOuterPath(out, cp, *w); |
| 87 | } |
| 88 | } |
| 89 | |
| 90 | void WritePolygonsInfo() |
| 91 | { |
nothing calls this directly
no test coverage detected