public class OverlayValidatedGeometryOperation extends java.lang.Object implements GeometryOperation
GeometryOperation
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.
Modifier and Type | Field and Description |
---|---|
private static double |
AREA_DIFF_TOL |
private GeometryMethodOperation |
chainOp |
private boolean |
returnEmptyGC |
Constructor and Description |
---|
OverlayValidatedGeometryOperation() |
OverlayValidatedGeometryOperation(GeometryMethodOperation chainOp)
Creates a new operation which chains to the given
GeometryMethodOperation
for non-intercepted methods. |
Modifier and Type | Method and 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 operation
|
static 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) |
private boolean returnEmptyGC
private GeometryMethodOperation chainOp
private static final double AREA_DIFF_TOL
public OverlayValidatedGeometryOperation()
public OverlayValidatedGeometryOperation(GeometryMethodOperation chainOp)
GeometryMethodOperation
for non-intercepted methods.chainOp
- the operation to chain topublic static int overlayOpCode(java.lang.String methodName)
public java.lang.Class getReturnType(java.lang.String opName)
GeometryOperation
getReturnType
in interface GeometryOperation
opName
- the name of the operationpublic Result invoke(java.lang.String opName, Geometry geometry, java.lang.Object[] args) throws java.lang.Exception
invoke
in interface GeometryOperation
opName
- geometry
- args
- java.lang.Exception
GeometryOperation.invoke(java.lang.String, org.locationtech.jts.geom.Geometry, java.lang.Object[])
public Result invokeValidatedOverlayOp(int opCode, Geometry g0, java.lang.Object[] args) throws java.lang.Exception
opCode
- g0
- args
- java.lang.Exception
private void reportError(java.lang.String msg)