Polygon pg = GeometryUtil.gf().createPolygon(shell, null);
rest = rest.difference(pg);
} else {
Geometry explodedLines = source.difference(trimExtendTo);
if (explodedLines instanceof MultiLineString) {
MultiLineString multiLines = (MultiLineString) explodedLines;
for (int i = 0, count = multiLines.getNumGeometries(); i < count; i++) {
LineString l = (LineString) multiLines
.getGeometryN(i);
if (i % 2 != 0) {
rest = rest.difference(l);
}
}
}
}
}
if (rest instanceof LineString) {
result.add((LineString) rest);
} else if (rest instanceof MultiLineString) {
MultiLineString ml = (MultiLineString) rest;
for (int i = 0, count = ml.getNumGeometries(); i < count; i++) {
LineString l = (LineString) ml.getGeometryN(i);
result.add(l);
}
}
} else {
// Extend