Package org.locationtech.jtstest.geomop
Class OverlayValidatedGeometryOperation
- java.lang.Object
-
- org.locationtech.jtstest.geomop.OverlayValidatedGeometryOperation
-
- All Implemented Interfaces:
GeometryOperation
public class OverlayValidatedGeometryOperation extends Object implements GeometryOperation
AGeometryOperation
which validates the result of overlay operations. If an invalid result is found, an exception is thrown (this is the most convenient and noticeable way of flagging the problem when using the TestRunner). All other Geometry methods are executed normally.In order to eliminate the need to specify the precise result of an overlay, this class forces the final return value to be GEOMETRYCOLLECTION EMPTY.
This class can be used via the -geomop command-line option or by the <geometryOperation> XML test file setting.
- Author:
- Martin Davis
-
-
Constructor Summary
Constructors Constructor Description OverlayValidatedGeometryOperation()
OverlayValidatedGeometryOperation(GeometryMethodOperation chainOp)
Creates a new operation which chains to the givenGeometryMethodOperation
for non-intercepted methods.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static double
areaDiff(Geometry g0, Geometry g1)
Class
getReturnType(String opName)
Gets the class of the return type of the given operation.Result
invoke(String opName, Geometry geometry, Object[] args)
Invokes the named operationstatic Geometry
invokeGeometryOverlayMethod(int opCode, Geometry g0, Geometry g1)
Result
invokeValidatedOverlayOp(int opCode, Geometry g0, Object[] args)
Invokes an overlay op, optionally using snapping, and optionally validating the result.static int
overlayOpCode(String methodName)
-
-
-
Constructor Detail
-
OverlayValidatedGeometryOperation
public OverlayValidatedGeometryOperation()
-
OverlayValidatedGeometryOperation
public OverlayValidatedGeometryOperation(GeometryMethodOperation chainOp)
Creates a new operation which chains to the givenGeometryMethodOperation
for non-intercepted methods.- Parameters:
chainOp
- the operation to chain to
-
-
Method Detail
-
overlayOpCode
public static int overlayOpCode(String methodName)
-
getReturnType
public Class getReturnType(String opName)
Description copied from interface:GeometryOperation
Gets the class of the return type of the given operation.- Specified by:
getReturnType
in interfaceGeometryOperation
- Parameters:
opName
- the name of the operation- Returns:
- the class of the return type of the specified operation
-
invoke
public Result invoke(String opName, Geometry geometry, Object[] args) throws Exception
Invokes the named operation- Specified by:
invoke
in interfaceGeometryOperation
- Parameters:
opName
-geometry
-args
-- Returns:
- the result
- Throws:
Exception
- See Also:
GeometryOperation.invoke(java.lang.String, org.locationtech.jts.geom.Geometry, java.lang.Object[])
-
invokeValidatedOverlayOp
public Result invokeValidatedOverlayOp(int opCode, Geometry g0, Object[] args) throws Exception
Invokes an overlay op, optionally using snapping, and optionally validating the result.- Parameters:
opCode
-g0
-args
-- Returns:
- the result
- Throws:
Exception
-
-