final EditCommandFactory editCommandFactory;
editCommandFactory = AppGISAdapter.getEditCommandFactory();
final FeatureIterator<SimpleFeature> iterator = featuresToTrim.features();
final List<UndoableMapCommand> undoableCommands = new ArrayList<UndoableMapCommand>();
final TrimGeometryStrategy trimOp = new TrimGeometryStrategy(trimmingLine);
String fidNotTrimmed = ""; //$NON-NLS-1$
try {
SimpleFeature feature;
Geometry original;
Geometry trimmed;
UndoableMapCommand command;
while (iterator.hasNext()) {
feature = iterator.next();
original = (Geometry) feature.getDefaultGeometry();
if (checkTrimPossible(original)) {
trimmed = trimOp.trim(original);
command = editCommandFactory.createSetGeomteryCommand(feature,selectedLayer, trimmed);
undoableCommands.add(command);
} else {
fidNotTrimmed += feature.getID() + " "; //$NON-NLS-1$
}