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

Method writeBoundary

kernels/private/density/OGR.cpp:173–207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

171}
172
173void OGR::writeBoundary(hexer::BaseGrid& grid)
174{
175 OGRGeometryH multi = OGR_G_CreateGeometry(wkbMultiPolygon);
176
177 for (const hexer::Path *path : grid.rootPaths())
178 {
179 OGRGeometryH polygon = OGR_G_CreateGeometry(wkbPolygon);
180 collectPath(*path, polygon);
181
182 if( OGR_G_AddGeometryDirectly(multi, polygon) != OGRERR_NONE )
183 {
184 std::ostringstream oss;
185 oss << "Unable to add polygon to multipolygon with error '"
186 << CPLGetLastErrorMsg() << "'";
187 throw pdal::pdal_error(oss.str());
188 }
189 }
190
191 OGRFeatureH hFeature;
192
193 hFeature = OGR_F_Create(OGR_L_GetLayerDefn(m_layer));
194 OGR_F_SetFieldInteger( hFeature, OGR_F_GetFieldIndex(hFeature, "ID"), 0);
195
196 OGR_F_SetGeometry(hFeature, multi);
197 OGR_G_DestroyGeometry(multi);
198
199 if( OGR_L_CreateFeature( m_layer, hFeature ) != OGRERR_NONE )
200 {
201 std::ostringstream oss;
202 oss << "Unable to create feature for multipolygon with error '"
203 << CPLGetLastErrorMsg() << "'";
204 throw pdal::pdal_error(oss.str());
205 }
206 OGR_F_Destroy( hFeature );
207}
208
209void OGR::writeDensity(hexer::BaseGrid& grid)
210{

Callers 1

doneMethod · 0.80

Calls 2

collectPathFunction · 0.85
strMethod · 0.80

Tested by

no test coverage detected