/** * Helper function for contains and intersects methods. * * @param x rectangle origin X ordinate * @param y rectangle origin Y ordinate * @param w rectangle width * @param h rectangle height */ private void setTestRect(double x, double y, double w, double h) { testRectCS.setXY(0, x, y); testRectCS.setXY(1, x, y + h); testRectCS.setXY(2, x + w, y + h); testRectCS.setXY(3, x + w, y); testRectCS.setXY(4, x, y); testRect.geometryChanged(); }
/** * Builds the bounds of the rectangle used to test inclusion in the * reference {@code PreparedGeometry}. * * @param x origin X ordinate * @param y origin Y ordinate */ private Polygon getTestRect(int x, int y) { CoordinateSequence2D testRectCS = new CoordinateSequence2D(5); testRectCS.setXY(0, x , y ); testRectCS.setXY(1, x , y + tileHeight ); testRectCS.setXY(2, x + tileWidth , y + tileHeight ); testRectCS.setXY(3, x + tileWidth , y ); testRectCS.setXY(4, x , y ); return gf.createPolygon(gf.createLinearRing(testRectCS), null); } }