private SurfaceBoundaryImpl createBoundary(List<? extends SurfacePatch> patches) {
if (patches.isEmpty())
return null;
SurfacePatch firstPatch = patches.get(0);
if (patches.size() == 1)
return (SurfaceBoundaryImpl) firstPatch.getBoundary();
Surface firstPatchSurface = new SurfaceImpl(firstPatch.getBoundary());
Set<OrientableSurface> surfaceList = new HashSet<OrientableSurface>();
for (int i=1; i<patches.size(); i++) {
SurfacePatch nextPatch = patches.get(i);
surfaceList.add(new SurfaceImpl(nextPatch.getBoundary()));
}
MultiSurface ms = new MultiSurfaceImpl(getCoordinateReferenceSystem(), surfaceList);
TransfiniteSet unionResultSurface = firstPatchSurface.union(ms);
if (! (unionResultSurface instanceof SurfaceImpl))