public class BufferResultValidator
extends java.lang.Object
This is a heuristic test, and may return false positive results (I.e. it may fail to detect an invalid result.) It should never return a false negative result, however (I.e. it should never report a valid result as invalid.)
This test may be (much) more expensive than the original buffer computation.
Modifier and Type | Field and Description |
---|---|
private double |
distance |
private Geometry |
errorIndicator |
private Coordinate |
errorLocation |
private java.lang.String |
errorMsg |
private Geometry |
input |
private boolean |
isValid |
private static double |
MAX_ENV_DIFF_FRAC
Maximum allowable fraction of buffer distance the
actual distance can differ by.
|
private Geometry |
result |
private static boolean |
VERBOSE |
Constructor and Description |
---|
BufferResultValidator(Geometry input,
double distance,
Geometry result) |
Modifier and Type | Method and Description |
---|---|
private void |
checkArea() |
private void |
checkDistance() |
private void |
checkEnvelope() |
private void |
checkExpectedEmpty() |
private void |
checkPolygonal() |
Geometry |
getErrorIndicator()
Gets a geometry which indicates the location and nature of a validation failure.
|
Coordinate |
getErrorLocation() |
java.lang.String |
getErrorMessage() |
boolean |
isValid() |
static boolean |
isValid(Geometry g,
double distance,
Geometry result) |
static java.lang.String |
isValidMsg(Geometry g,
double distance,
Geometry result)
Checks whether the geometry buffer is valid,
and returns an error message if not.
|
private void |
report(java.lang.String checkName) |
private static boolean VERBOSE
private static final double MAX_ENV_DIFF_FRAC
private Geometry input
private double distance
private Geometry result
private boolean isValid
private java.lang.String errorMsg
private Coordinate errorLocation
private Geometry errorIndicator
public static java.lang.String isValidMsg(Geometry g, double distance, Geometry result)
g
- distance
- result
- public boolean isValid()
public java.lang.String getErrorMessage()
public Coordinate getErrorLocation()
public Geometry getErrorIndicator()
If the failure is due to the buffer curve being too far or too close to the input, the indicator is a line segment showing the location and size of the discrepancy.
private void report(java.lang.String checkName)
private void checkPolygonal()
private void checkExpectedEmpty()
private void checkEnvelope()
private void checkArea()
private void checkDistance()