@Override public ROI subtract(ROI roi) { final Geometry geom = getGeometry(roi); if (geom != null) { return new ROIGeometry(theGeom.getGeometry().difference(geom)); } throw new UnsupportedOperationException(UNSUPPORTED_ROI_TYPE); }
/** * Returns a new instance which is the exclusive OR of this ROI and {@code roi}. * This is only possible if {@code roi} is an instance of ROIGeometry * or {@link ROIShape}. * * @param roi the ROI to add * @return the union as a new instance * @throws UnsupportedOperationException if {@code roi} is not an instance * of ROIGeometry or {@link ROIShape} */ @Override public ROI exclusiveOr(ROI roi) { final Geometry geom = getGeometry(roi); if (geom != null) { return new ROIGeometry(theGeom.getGeometry().symDifference(geom)); } throw new UnsupportedOperationException(UNSUPPORTED_ROI_TYPE); }
/** * Returns a new instance which is the union of this ROI and {@code roi}. * This is only possible if {@code roi} is an instance of ROIGeometry * or {@link ROIShape}. * * @param roi the ROI to add * @return the union as a new instance * @throws UnsupportedOperationException if {@code roi} is not an instance * of ROIGeometry or {@link ROIShape} */ @Override public ROI add(ROI roi) { final Geometry geom = getGeometry(roi); if (geom != null) { Geometry union = geom.union(theGeom.getGeometry()); // Geometry fixed = PRECISE_FACTORY.createGeometry(union); // Coordinate[] coords = fixed.getCoordinates(); // for (Coordinate coord : coords) { // Coordinate cc1 = coord; // PRECISION.makePrecise(cc1); // } // union = fixed; return new ROIGeometry(union); } throw new UnsupportedOperationException(UNSUPPORTED_ROI_TYPE); }
/** * Returns a new instance which is the intersection of this ROI and {@code roi}. * This is only possible if {@code roi} is an instance of ROIGeometry * or {@link ROIShape}. * * @param roi the ROI to intersect with * @return the intersection as a new instance * @throws UnsupportedOperationException if {@code roi} is not an instance * of ROIGeometry or {@link ROIShape} */ @Override public ROI intersect(ROI roi) { final Geometry geom = getGeometry(roi); if (geom != null) { Geometry intersect = geom.intersection(theGeom.getGeometry()); // Geometry fixed = PRECISE_FACTORY.createGeometry(intersect); // Coordinate[] coords = fixed.getCoordinates(); // for (Coordinate coord : coords) { // Coordinate cc1 = coord; // PRECISION.makePrecise(cc1); // } // intersect = fixed; return new ROIGeometry(intersect); } throw new UnsupportedOperationException(UNSUPPORTED_ROI_TYPE); }