MCPcopy Create free account
hub / github.com/comaps/comaps / operator()

Method operator()

generator/borders.cpp:62–88  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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 {

Callers

nothing calls this directly

Calls 15

to_stringFunction · 0.85
CountryDefClass · 0.85
WriteVarUintFunction · 0.85
SimplifyDefaultFunction · 0.85
Pow2Function · 0.85
GetEpsilonForSimplifyFunction · 0.85
SaveOuterPathFunction · 0.85
GetWriterMethod · 0.80
sizeMethod · 0.45
AddMethod · 0.45
GetRectMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected