public void execute(SplitPolygonRequest request, SplitPolygonResponse response) throws Exception {
// convert to most accurate precision model
com.vividsolutions.jts.geom.Geometry jtsGeometry = converter.toInternal(request.getGeometry());
if (!(jtsGeometry instanceof Polygon)) {
throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, "geometry has to be a Polygon");
}
Polygon polygon = (Polygon) converter.toInternal(request.getGeometry());
// Convert to the polygons precision model:
jtsGeometry = converter.toInternal(request.getSplitter());
if (!(jtsGeometry instanceof LineString)) {
throw new GeomajasException(ExceptionCode.UNEXPECTED_PROBLEM, "splitter has to be a LineString");
}
LineString preciseLine = (LineString) jtsGeometry;
int precision = polygon.getPrecisionModel().getMaximumSignificantDigits() - 1;
com.vividsolutions.jts.geom.Geometry bufferedLine = preciseLine.buffer(Math.pow(10.0, -precision));
com.vividsolutions.jts.geom.Geometry diff = polygon.difference(bufferedLine);