}
private Filter createTrimmingLineFilter(ILayer selectedLayer, LineString trimmingLineInLayerCrs)
throws OperationNotFoundException, TransformException {
Filter filter = selectedLayer.getFilter();
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
Intersects intersectsFilter;
try {
SimpleFeatureType schema = selectedLayer.getSchema();
String typeName = schema.getGeometryDescriptor().getLocalName();
intersectsFilter = ff.intersects(ff.property(typeName), ff.literal(trimmingLineInLayerCrs));
} catch (IllegalFilterException e) {
throw (RuntimeException) new RuntimeException().initCause(e);
}
if (Filter.EXCLUDE.equals(filter)) {
filter = intersectsFilter;
} else {
filter = ff.and(filter, intersectsFilter);
}
return filter;
}