Skip to content

Commit

Permalink
getID() fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ibell13 committed Oct 11, 2024
1 parent 122d192 commit a0030f4
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 8 deletions.
2 changes: 1 addition & 1 deletion filters/private/hexer/BaseGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ class PDAL_DLL BaseGrid
// returns a single point from a segment to be used as the vertex of a hexagon
virtual Point findPoint(Segment& s) = 0;
virtual bool sampling() const = 0;
virtual uint64_t getID(int& n, const HexId& ij) = 0;
virtual uint64_t getID(HexId ij) = 0;
virtual double height() = 0;

virtual H3Index ij2h3(HexId ij)
Expand Down
2 changes: 1 addition & 1 deletion filters/private/hexer/H3grid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PDAL_DLL H3Grid : public BaseGrid
}
bool sampling() const
{ return m_res < 0; }
uint64_t getID(int& n, const HexId& ij)
uint64_t getID(HexId ij)
{ return ij2h3(ij); }

// test function: used when inserting pre-defined grids in tests,
Expand Down
4 changes: 2 additions & 2 deletions filters/private/hexer/HexGrid.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class PDAL_DLL HexGrid : public BaseGrid
{ return m_height; }
bool sampling() const
{ return m_width < 0; }
uint64_t getID(int& n, const HexId& ij)
{ return n; }
uint64_t getID(HexId ij)
{ return (((uint64_t)ij.i << 32) | (uint64_t)ij.j); }
Point findPoint(Segment& s);

private:
Expand Down
6 changes: 2 additions & 4 deletions kernels/private/density/OGR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -208,16 +208,15 @@ void OGR::writeBoundary(hexer::BaseGrid& grid)

void OGR::writeDensity(hexer::BaseGrid& grid)
{
int counter(0);
for (auto& [coord, count] : grid.getHexes()) {
if (grid.isDense(coord))
{
OGRGeometryH polygon = collectHexagon(coord, grid);
OGRFeatureH hFeature;

hFeature = OGR_F_Create(OGR_L_GetLayerDefn(m_layer));
OGR_F_SetFieldInteger( hFeature, OGR_F_GetFieldIndex(hFeature, "ID"),
grid.getID(counter, coord));
OGR_F_SetFieldInteger64( hFeature, OGR_F_GetFieldIndex(hFeature, "ID"),
grid.getID(coord));
OGR_F_SetFieldInteger( hFeature, OGR_F_GetFieldIndex(hFeature, "COUNT"),
count);

Expand All @@ -232,7 +231,6 @@ void OGR::writeDensity(hexer::BaseGrid& grid)
throw pdal::pdal_error(oss.str());
}
OGR_F_Destroy( hFeature );
counter++;
}
}
}
Expand Down

0 comments on commit a0030f4

Please sign in to comment.