/** * Compute the polygon corresponding to the cell * * @return Polygon of the cell */ private Polygon getCellPolygon() { final Coordinate[] summits = new Coordinate[5]; double x1 = minX + cellI * deltaX; double y1 = minY + cellJ * deltaY; double x2 = minX + (cellI + 1) * deltaX; double y2 = minY + (cellJ + 1) * deltaY; summits[0] = new Coordinate(x1, y1); summits[1] = new Coordinate(x2, y1); summits[2] = new Coordinate(x2, y2); summits[3] = new Coordinate(x1, y2); summits[4] = new Coordinate(x1, y1); final LinearRing g = GF.createLinearRing(summits); final Polygon gg = GF.createPolygon(g, null); cellI++; return gg; }
/** * Compute the point of the cell * * @return Center point of the cell */ private Point getCellPoint() { double x1 = (minX + cellI * deltaX) + (deltaX / 2d); double y1 = (minY + cellJ * deltaY) + (deltaY / 2d); cellI++; return GF.createPoint(new Coordinate(x1, y1)); }