Class BufferDistanceValidator
- java.lang.Object
-
- org.locationtech.jts.operation.buffer.validate.BufferDistanceValidator
-
public class BufferDistanceValidator extends java.lang.Object
Validates that a given buffer curve lies an appropriate distance from the input generating it. Useful only for round buffers (cap and join). Can be used for either positive or negative distances.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.)
-
-
Field Summary
Fields Modifier and Type Field Description private double
bufDistance
private java.lang.String
errMsg
private Geometry
errorIndicator
private Coordinate
errorLocation
private Geometry
input
private boolean
isValid
private static double
MAX_DISTANCE_DIFF_FRAC
Maximum allowable fraction of buffer distance the actual distance can differ by.private double
maxDistanceFound
private double
maxValidDistance
private double
minDistanceFound
private double
minValidDistance
private Geometry
result
private static boolean
VERBOSE
-
Constructor Summary
Constructors Constructor Description BufferDistanceValidator(Geometry input, double bufDistance, Geometry result)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
checkMaximumDistance(Geometry input, Geometry bufCurve, double maxDist)
Checks that the furthest distance from the buffer curve to the input is less than the given maximum distance.private void
checkMinimumDistance(Geometry g1, Geometry g2, double minDist)
Checks that two geometries are at least a minimum distance apart.private void
checkNegativeValid()
private void
checkPositiveValid()
Geometry
getErrorIndicator()
Gets a geometry which indicates the location and nature of a validation failure.Coordinate
getErrorLocation()
java.lang.String
getErrorMessage()
private Geometry
getPolygonLines(Geometry g)
boolean
isValid()
-
-
-
Field Detail
-
VERBOSE
private static boolean VERBOSE
-
MAX_DISTANCE_DIFF_FRAC
private static final double MAX_DISTANCE_DIFF_FRAC
Maximum allowable fraction of buffer distance the actual distance can differ by. 1% sometimes causes an error - 1.2% should be safe.- See Also:
- Constant Field Values
-
input
private Geometry input
-
bufDistance
private double bufDistance
-
result
private Geometry result
-
minValidDistance
private double minValidDistance
-
maxValidDistance
private double maxValidDistance
-
minDistanceFound
private double minDistanceFound
-
maxDistanceFound
private double maxDistanceFound
-
isValid
private boolean isValid
-
errMsg
private java.lang.String errMsg
-
errorLocation
private Coordinate errorLocation
-
errorIndicator
private Geometry errorIndicator
-
-
Method Detail
-
isValid
public boolean isValid()
-
getErrorMessage
public java.lang.String getErrorMessage()
-
getErrorLocation
public Coordinate getErrorLocation()
-
getErrorIndicator
public Geometry getErrorIndicator()
Gets a geometry which indicates the location and nature of a validation failure.The indicator is a line segment showing the location and size of the distance discrepancy.
- Returns:
- a geometric error indicator or null if no error was found
-
checkPositiveValid
private void checkPositiveValid()
-
checkNegativeValid
private void checkNegativeValid()
-
checkMinimumDistance
private void checkMinimumDistance(Geometry g1, Geometry g2, double minDist)
Checks that two geometries are at least a minimum distance apart.- Parameters:
g1
- a geometryg2
- a geometryminDist
- the minimum distance the geometries should be separated by
-
checkMaximumDistance
private void checkMaximumDistance(Geometry input, Geometry bufCurve, double maxDist)
Checks that the furthest distance from the buffer curve to the input is less than the given maximum distance. This uses the Oriented Hausdorff distance metric. It corresponds to finding the point on the buffer curve which is furthest from some point on the input.- Parameters:
input
- a geometrybufCurve
- a geometrymaxDist
- the maximum distance that a buffer result can be from the input
-
-