Revision 47364 trunk/org.gvsig.desktop/org.gvsig.desktop.compat.cdc/org.gvsig.fmap.geometry/org.gvsig.fmap.geometry.jts/src/main/java/org/gvsig/fmap/geom/jts/AbstractGeometry.java
AbstractGeometry.java | ||
---|---|---|
34 | 34 |
import java.awt.Shape; |
35 | 35 |
import java.awt.geom.AffineTransform; |
36 | 36 |
import java.awt.geom.Rectangle2D; |
37 |
import java.util.logging.Level; |
|
37 | 38 |
import org.apache.commons.codec.binary.Hex; |
38 | 39 |
import org.apache.commons.lang3.StringUtils; |
39 | 40 |
import org.cresques.cts.IProjection; |
... | ... | |
42 | 43 |
import org.gvsig.fmap.geom.GeometryLocator; |
43 | 44 |
import org.gvsig.fmap.geom.GeometryManager; |
44 | 45 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
46 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
|
45 | 47 |
import org.gvsig.fmap.geom.complex.Complex; |
46 | 48 |
import org.gvsig.fmap.geom.exception.CreateGeometryException; |
47 | 49 |
import org.gvsig.fmap.geom.jts.operation.towkb.OGCWKBEncoder; |
... | ... | |
872 | 874 |
|
873 | 875 |
@Override |
874 | 876 |
public Geometry union(Geometry other) throws GeometryOperationNotSupportedException, GeometryOperationException { |
875 |
return JTSUtils.createGeometry(this.getProjection(), getJTS().union(((GeometryJTS) other).getJTS()), this.getGeometryType()); |
|
877 |
try { |
|
878 |
com.vividsolutions.jts.geom.Geometry jts = getJTS(); |
|
879 |
com.vividsolutions.jts.geom.Geometry otherJts = ((GeometryJTS)other).getJTS(); |
|
880 |
|
|
881 |
if(jts.isValid() && otherJts.isValid()){ |
|
882 |
return JTSUtils.createGeometry(this.getProjection(), jts.union(otherJts), this.getGeometryType()); |
|
883 |
} |
|
884 |
MultiPrimitive geom = this.getManager().createMultiPrimitive(geometryType); |
|
885 |
geom.addPrimitives(this); |
|
886 |
geom.addPrimitives(other); |
|
887 |
return geom; |
|
888 |
} catch (CreateGeometryException ex) { |
|
889 |
throw new GeometryOperationException( |
|
890 |
this.getGeometryType().getType(), |
|
891 |
this.getManager().getGeometryOperationCode(Geometry.OPERATIONS.UNION), |
|
892 |
ex); |
|
893 |
} |
|
876 | 894 |
} |
877 | 895 |
|
878 | 896 |
@Override |
Also available in: Unified diff