protected SpatialRelation relate(Geometry oGeom) { //see http://docs.geotools.org/latest/userguide/library/jts/dim9.html#preparedgeometry if (oGeom instanceof org.locationtech.jts.geom.Point) { if (preparedGeometry != null) return preparedGeometry.disjoint(oGeom) ? SpatialRelation.DISJOINT : SpatialRelation.CONTAINS; return geom.disjoint(oGeom) ? SpatialRelation.DISJOINT : SpatialRelation.CONTAINS; } if (preparedGeometry == null) return intersectionMatrixToSpatialRelation(geom.relate(oGeom)); else if (preparedGeometry.covers(oGeom)) return SpatialRelation.CONTAINS; else if (preparedGeometry.coveredBy(oGeom)) return SpatialRelation.WITHIN; else if (preparedGeometry.intersects(oGeom)) return SpatialRelation.INTERSECTS; return SpatialRelation.DISJOINT; }
@Override public boolean compare( final Geometry dataGeometry, final PreparedGeometry constraintGeometry) { return constraintGeometry.disjoint(dataGeometry); }
/** * Gets the data for the requested tile. If the tile is either completely within or outside of the reference {@code PreparedGeometry} a cached * constant {@code Raster} with 1 or 0 values is returned. Otherwise tile pixels are checked for inclusion and set individually. * * @param minX origin X ordinate * @param minY origin Y ordinate * * @return the requested tile */ protected Raster getTileRaster(int minX, int minY) { // check relationship between geometry and the tile we're computing Polygon testRect = getTestRect(minX, minY); try { // RasterOp need to be thread safe synchronized (geom) { if (geom.contains(testRect)) { return getSolidTile(); } else if (geom.disjoint(testRect)) { return getBlankTile(); } } } catch (TopologyException tpe) { // In case a Topology Exception have been raised, // use the standard rasterization instead of leveraging // on the shared tiles } return drawGeometry(minX, minY); }
if (geom.contains(testRect)) { return getSolidTile(); } else if (geom.disjoint(testRect)) { return getBlankTile();
/** * Gets the data for the requested tile. If the tile is either completely within or outside of the reference {@code PreparedGeometry} a cached * constant {@code Raster} with 1 or 0 values is returned. Otherwise tile pixels are checked for inclusion and set individually. * * @param minX origin X ordinate * @param minY origin Y ordinate * * @return the requested tile */ protected Raster getTileRaster(int minX, int minY) { // check relationship between geometry and the tile we're computing Polygon testRect = getTestRect(minX, minY); try { // RasterOp need to be thread safe synchronized (geom) { if (geom.contains(testRect)) { return getSolidTile(); } else if (geom.disjoint(testRect)) { return getBlankTile(); } } } catch (TopologyException tpe) { // In case a Topology Exception have been raised, // use the standard rasterization instead of leveraging // on the shared tiles } return drawGeometry(minX, minY); }