Revision 2786 org.gvsig.vectorediting/trunk/org.gvsig.vectorediting/org.gvsig.vectorediting.lib/org.gvsig.vectorediting.lib.prov/org.gvsig.vectorediting.lib.prov.split/src/main/java/org/gvsig/vectorediting/lib/prov/split/SplitEditingProvider.java
SplitEditingProvider.java | ||
---|---|---|
38 | 38 |
import org.gvsig.fmap.geom.GeometryException; |
39 | 39 |
import org.gvsig.fmap.geom.GeometryLocator; |
40 | 40 |
import org.gvsig.fmap.geom.GeometryManager; |
41 |
import org.gvsig.fmap.geom.aggregate.Aggregate; |
|
41 | 42 |
import org.gvsig.fmap.geom.aggregate.MultiCurve; |
42 | 43 |
import org.gvsig.fmap.geom.aggregate.MultiPrimitive; |
44 |
import org.gvsig.fmap.geom.complex.Complex; |
|
43 | 45 |
import org.gvsig.fmap.geom.operation.GeometryOperationException; |
44 | 46 |
import org.gvsig.fmap.geom.operation.GeometryOperationNotSupportedException; |
45 | 47 |
import org.gvsig.fmap.geom.primitive.Curve; |
... | ... | |
212 | 214 |
Geometry geometry = feature.getDefaultGeometry(); |
213 | 215 |
|
214 | 216 |
Geometry intersection = geometry.intersection(curve); |
215 |
|
|
216 |
if (intersection == null |
|
217 |
|| (!intersection.getGeometryType().isTypeOf(POINT) |
|
218 |
&& !intersection.getGeometryType().isTypeOf(MULTIPOINT) |
|
219 |
&& !intersection.getGeometryType().isTypeOf(CURVE) |
|
220 |
&& !intersection.getGeometryType().isTypeOf(MULTICURVE))) { |
|
221 |
throw new VectorEditingException(); |
|
217 |
|
|
218 |
if (intersection instanceof Complex) { |
|
219 |
intersection = ((Complex) intersection).createAggregate( |
|
220 |
Geometry.TYPES.MULTIPOLYGON, |
|
221 |
(Geometry t) -> t.getGeometryType().getType() == Geometry.TYPES.MULTIPOLYGON || t.getGeometryType().getType() == Geometry.TYPES.POLYGON |
|
222 |
); |
|
223 |
if( ((Aggregate) intersection).getPrimitivesNumber() == 0){ |
|
224 |
throw new VectorEditingException(); |
|
225 |
} |
|
226 |
} else { |
|
227 |
if (intersection == null |
|
228 |
|| (!intersection.getGeometryType().isTypeOf(POINT) |
|
229 |
&& !intersection.getGeometryType().isTypeOf(MULTIPOINT) |
|
230 |
&& !intersection.getGeometryType().isTypeOf(CURVE) |
|
231 |
&& !intersection.getGeometryType().isTypeOf(MULTICURVE))) { |
|
232 |
throw new VectorEditingException(); |
|
233 |
} |
|
222 | 234 |
} |
223 | 235 |
}); |
224 | 236 |
return true; |
Also available in: Unified diff