MCPcopy Create free account
hub / github.com/PDAL/PDAL / writePolygon

Method writePolygon

filters/private/hexer/Path.cpp:31–48  ·  view source on GitHub ↗

WKT (or GeoJSON) doesn't allow nesting of polygons. You can just have polygons and holes. Islands within the holes need to be described as separate polygons. To that end, we gather the islands from all holes and return them to be processed as separate polygons.

Source from the content-addressed store, hash-verified

29// separate polygons. To that end, we gather the islands from all holes
30// and return them to be processed as separate polygons.
31std::vector<Path *> Path::writePolygon(std::ostream& out) const
32{
33 std::vector<Path *> islands;
34
35 out << "(";
36 writeRing(out);
37 const std::vector<Path *>& paths = subPaths();
38 for (auto& p : paths)
39 {
40 out << ", ";
41 p->writeRing(out);
42 const std::vector<Path *>& subs(p->subPaths());
43 islands.insert(islands.end(), subs.begin(), subs.end());
44 }
45 out << ")";
46
47 return islands;
48}
49
50void Path::toWKT(std::ostream& output) const
51{

Callers 1

toWKTMethod · 0.80

Calls 4

writeRingMethod · 0.80
insertMethod · 0.45
endMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected