Package org.apache.lucene.spatial.query
Class SpatialArgs
- java.lang.Object
-
- org.apache.lucene.spatial.query.SpatialArgs
-
public class SpatialArgs extends Object
Principally holds the queryShapeand theSpatialOperation. It's used as an argument to some methods onSpatialStrategy.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
-
Field Summary
Fields Modifier and Type Field Description static doubleDEFAULT_DISTERRPCT
-
Constructor Summary
Constructors Constructor Description SpatialArgs(SpatialOperation operation, org.locationtech.spatial4j.shape.Shape shape)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static doublecalcDistanceFromErrPct(org.locationtech.spatial4j.shape.Shape shape, double distErrPct, org.locationtech.spatial4j.context.SpatialContext ctx)Computes the distance given a shape and thedistErrPct.DoublegetDistErr()The acceptable error of the shape.DoublegetDistErrPct()A measure of acceptable error of the shape as a fraction.SpatialOperationgetOperation()org.locationtech.spatial4j.shape.ShapegetShape()doubleresolveDistErr(org.locationtech.spatial4j.context.SpatialContext ctx, double defaultDistErrPct)Gets the error distance that specifies how precise the query shape is.voidsetDistErr(Double distErr)voidsetDistErrPct(Double distErrPct)voidsetOperation(SpatialOperation operation)voidsetShape(org.locationtech.spatial4j.shape.Shape shape)StringtoString()voidvalidate()Check if the arguments make sense -- throw an exception if not
-
-
-
Field Detail
-
DEFAULT_DISTERRPCT
public static final double DEFAULT_DISTERRPCT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SpatialArgs
public SpatialArgs(SpatialOperation operation, org.locationtech.spatial4j.shape.Shape shape)
-
-
Method Detail
-
calcDistanceFromErrPct
public static double calcDistanceFromErrPct(org.locationtech.spatial4j.shape.Shape shape, double distErrPct, org.locationtech.spatial4j.context.SpatialContext ctx)Computes the distance given a shape and thedistErrPct. The algorithm is the fraction of the distance from the center of the query shape to its closest bounding box corner.- Parameters:
shape- Mandatory.distErrPct- 0 to 0.5ctx- Mandatory- Returns:
- A distance (in degrees).
-
resolveDistErr
public double resolveDistErr(org.locationtech.spatial4j.context.SpatialContext ctx, double defaultDistErrPct)Gets the error distance that specifies how precise the query shape is. This looks atgetDistErr(),getDistErrPct(), anddefaultDistErrPct.- Parameters:
defaultDistErrPct- 0 to 0.5- Returns:
>= 0
-
validate
public void validate() throws IllegalArgumentExceptionCheck if the arguments make sense -- throw an exception if not- Throws:
IllegalArgumentException
-
getOperation
public SpatialOperation getOperation()
-
setOperation
public void setOperation(SpatialOperation operation)
-
getShape
public org.locationtech.spatial4j.shape.Shape getShape()
-
setShape
public void setShape(org.locationtech.spatial4j.shape.Shape shape)
-
getDistErrPct
public Double getDistErrPct()
A measure of acceptable error of the shape as a fraction. This effectively inflates the size of the shape but should not shrink it.
-
setDistErrPct
public void setDistErrPct(Double distErrPct)
-
getDistErr
public Double getDistErr()
The acceptable error of the shape. This effectively inflates the size of the shape but should not shrink it.- Returns:
>= 0
-
setDistErr
public void setDistErr(Double distErr)
-
-