Skip to content

Commit

Permalink
Remove references to holes in rasterization process
Browse files Browse the repository at this point in the history
  • Loading branch information
inigo-cobian committed Nov 10, 2024
1 parent bd026b5 commit bd5beff
Showing 1 changed file with 5 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ public Collection<Coordinate> getCoordinates(IShape shape) {

Geometry geometry = ((Shape) shape).getJTSGeometry();
Color valueColor = new Color(255, 255, 255);
Color holeColor = new Color(0, 0, 0);

draw(geometry, valueColor, holeColor);
draw(geometry, valueColor);

int[] xy = new int[2];
for (int x = 0; x < this.raster.getWidth(); x++) {
Expand Down Expand Up @@ -166,22 +165,20 @@ public void add(IShape shape, Function<IShape, T> encoder) {
Geometry geometry = ((Shape) shape).getJTSGeometry();

int rgbVal = floatBitsToInt(encodeToFloat(value));
int holeVal = floatBitsToInt(Float.NaN);
Color valueColor = new Color(rgbVal, true);
Color holeColor = new Color(holeVal, true);

draw(geometry, valueColor, holeColor);
draw(geometry, valueColor);
}

private void draw(Geometry geometry, Color valueColor, Color holeColor) {
private void draw(Geometry geometry, Color valueColor) {

Geometries geomType = Geometries.get(geometry);
if (geomType == Geometries.MULTIPOLYGON || geomType == Geometries.MULTILINESTRING
|| geomType == Geometries.MULTIPOINT || geomType == Geometries.GEOMETRYCOLLECTION) {
final int numGeom = geometry.getNumGeometries();
for (int i = 0; i < numGeom; i++) {
Geometry geomN = geometry.getGeometryN(i);
draw(geomN, valueColor, holeColor);
draw(geomN, valueColor);
}
} else /* if (geometry.intersects(((Grid) extent).getShape().getJTSGeometry())) */ {

Expand All @@ -192,7 +189,7 @@ private void draw(Geometry geometry, Color valueColor, Color holeColor) {
boolean hasHoles = poly.getNumInteriorRing() > 0;
if (hasHoles) {
Geometry triangles = PolygonTriangulator.triangulate(poly);
draw(triangles, valueColor, holeColor);
draw(triangles, valueColor);
} else {
drawGeometry(poly, valueColor);
}
Expand Down

0 comments on commit bd5beff

Please sign in to comment.