/** * Computes the combination of the input geometries * to produce the most appropriate {@link Geometry} or {@link GeometryCollection} * * @return a Geometry which is the combination of the inputs */ public Geometry combine() { List elems = new ArrayList(); for (Iterator i = inputGeoms.iterator(); i.hasNext(); ) { Geometry g = (Geometry) i.next(); extractElements(g, elems); } if (elems.size() == 0) { if (geomFactory != null) { // return an empty GC return geomFactory.createGeometryCollection(); } return null; } // return the "simplest possible" geometry return geomFactory.buildGeometry(elems); }