Package org.locationtech.jtstest.geomop
Class OverlayValidatedGeometryOperation
- java.lang.Object
-
- org.locationtech.jtstest.geomop.OverlayValidatedGeometryOperation
-
- All Implemented Interfaces:
GeometryOperation
public class OverlayValidatedGeometryOperation extends java.lang.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.
-
-
Field Summary
Fields Modifier and Type Field Description private static double
AREA_DIFF_TOL
private GeometryMethodOperation
chainOp
private boolean
returnEmptyGC
-
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)
private void
areaValidate(Geometry g0, Geometry g1)
java.lang.Class
getReturnType(java.lang.String opName)
Gets the class of the return type of the given operation.Result
invoke(java.lang.String opName, Geometry geometry, java.lang.Object[] args)
Invokes the named operationstatic Geometry
invokeGeometryOverlayMethod(int opCode, Geometry g0, Geometry g1)
Result
invokeValidatedOverlayOp(int opCode, Geometry g0, java.lang.Object[] args)
Invokes an overlay op, optionally using snapping, and optionally validating the result.static int
overlayOpCode(java.lang.String methodName)
private void
reportError(java.lang.String msg)
private void
validate(int opCode, Geometry g0, Geometry g1, Geometry result)
-
-
-
Field Detail
-
returnEmptyGC
private boolean returnEmptyGC
-
chainOp
private GeometryMethodOperation chainOp
-
AREA_DIFF_TOL
private static final double AREA_DIFF_TOL
- See Also:
- Constant Field Values
-
-
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(java.lang.String methodName)
-
getReturnType
public java.lang.Class getReturnType(java.lang.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(java.lang.String opName, Geometry geometry, java.lang.Object[] args) throws java.lang.Exception
Invokes the named operation- Specified by:
invoke
in interfaceGeometryOperation
- Parameters:
opName
-geometry
-args
-- Returns:
- the result
- Throws:
java.lang.Exception
- See Also:
GeometryOperation.invoke(java.lang.String, org.locationtech.jts.geom.Geometry, java.lang.Object[])
-
invokeValidatedOverlayOp
public Result invokeValidatedOverlayOp(int opCode, Geometry g0, java.lang.Object[] args) throws java.lang.Exception
Invokes an overlay op, optionally using snapping, and optionally validating the result.- Parameters:
opCode
-g0
-args
-- Returns:
- the result
- Throws:
java.lang.Exception
-
reportError
private void reportError(java.lang.String msg)
-
-