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

Function collectHexagon

kernels/private/density/OGR.cpp:78–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

76}
77
78OGRGeometryH collectHexagon(hexer::HexId const& id, hexer::BaseGrid& grid)
79{
80 OGRGeometryH ring = OGR_G_CreateGeometry(wkbLinearRing);
81
82 for (int i = 0; i <= 5; ++i) {
83 hexer::Segment s(id, i);
84 hexer::Point p = grid.findPoint(s);
85 OGR_G_AddPoint_2D(ring, p.m_x, p.m_y);
86 }
87 hexer::Segment s(id, 0);
88 hexer::Point p = grid.findPoint(s);
89 OGR_G_AddPoint_2D(ring, p.m_x, p.m_y);
90
91 OGRGeometryH polygon = OGR_G_CreateGeometry(wkbPolygon);
92 if( OGR_G_AddGeometryDirectly(polygon, ring ) != OGRERR_NONE )
93 {
94 std::ostringstream oss;
95 oss << "Unable to add ring to polygon in collectHexagon '"
96 << CPLGetLastErrorMsg() << "'";
97 throw pdal::pdal_error(oss.str());
98 }
99
100 return polygon;
101}
102
103} // unnamed namespace
104

Callers 1

writeDensityMethod · 0.85

Calls 2

strMethod · 0.80
findPointMethod · 0.45

Tested by

no test coverage detected