| 76 | } |
| 77 | |
| 78 | OGRGeometryH 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 |
no test coverage detected