Class BufferResultValidator
java.lang.Object
org.locationtech.jts.operation.buffer.validate.BufferResultValidator
Validates that the result of a buffer operation
is geometrically correct, within a computed tolerance.
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.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate double
private Geometry
private Coordinate
private String
private Geometry
private boolean
private static final double
Maximum allowable fraction of buffer distance the actual distance can differ by.private Geometry
private static boolean
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate void
private void
private void
private void
private void
Gets a geometry which indicates the location and nature of a validation failure.boolean
isValid()
static boolean
static String
isValidMsg
(Geometry g, double distance, Geometry result) Checks whether the geometry buffer is valid, and returns an error message if not.private void
-
Field Details
-
VERBOSE
private static boolean VERBOSE -
MAX_ENV_DIFF_FRAC
private static final double MAX_ENV_DIFF_FRACMaximum allowable fraction of buffer distance the actual distance can differ by. 1% sometimes causes an error - 1.2% should be safe.- See Also:
-
input
-
distance
private double distance -
result
-
isValid
private boolean isValid -
errorMsg
-
errorLocation
-
errorIndicator
-
-
Constructor Details
-
BufferResultValidator
-
-
Method Details
-
isValid
-
isValidMsg
Checks whether the geometry buffer is valid, and returns an error message if not.- Parameters:
g
-distance
-result
-- Returns:
- an appropriate error message or null if the buffer is valid
-
isValid
public boolean isValid() -
getErrorMessage
-
getErrorLocation
-
getErrorIndicator
Gets a geometry which indicates the location and nature of a validation failure.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.
- Returns:
- a geometric error indicator or null if no error was found
-
report
-
checkPolygonal
private void checkPolygonal() -
checkExpectedEmpty
private void checkExpectedEmpty() -
checkEnvelope
private void checkEnvelope() -
checkArea
private void checkArea() -
checkDistance
private void checkDistance()
-