org.apache.lucene.spatial.query

## Class SpatialArgs

- java.lang.Object
- - org.apache.lucene.spatial.query.SpatialArgs

-     public class SpatialArgs
      extends Object

  Principally holds the query `Shape` and the `SpatialOperation`. It's used as an argument to some methods on `SpatialStrategy`.
  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static double` | `DEFAULT_DISTERRPCT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SpatialArgs(SpatialOperation operation, com.spatial4j.core.shape.Shape shape)`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static double` | `calcDistanceFromErrPct(com.spatial4j.core.shape.Shape shape, double distErrPct, com.spatial4j.core.context.SpatialContext ctx)` Computes the distance given a shape and the `distErrPct`.
    `Double` | `getDistErr()` The acceptable error of the shape.
    `Double` | `getDistErrPct()` A measure of acceptable error of the shape as a fraction.
    `SpatialOperation` | `getOperation()`
    `com.spatial4j.core.shape.Shape` | `getShape()`
    `double` | `resolveDistErr(com.spatial4j.core.context.SpatialContext ctx, double defaultDistErrPct)` Gets the error distance that specifies how precise the query shape is.
    `void` | `setDistErr(Double distErr)`
    `void` | `setDistErrPct(Double distErrPct)`
    `void` | `setOperation(SpatialOperation operation)`
    `void` | `setShape(com.spatial4j.core.shape.Shape shape)`
    `String` | `toString()`
    `void` | `validate()` Check if the arguments make sense -- throw an exception if not

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Field Detail

    - #### DEFAULT_DISTERRPCT

          public static final double DEFAULT_DISTERRPCT

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SpatialArgs

          public SpatialArgs(SpatialOperation operation,
                     com.spatial4j.core.shape.Shape shape)

  - ### Method Detail

    - #### calcDistanceFromErrPct

          public static double calcDistanceFromErrPct(com.spatial4j.core.shape.Shape shape,
                                      double distErrPct,
                                      com.spatial4j.core.context.SpatialContext ctx)

      Computes the distance given a shape and the `distErrPct`. 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.5
        `ctx` - Mandatory
      Returns:
        A distance (in degrees).

    - #### resolveDistErr

          public double resolveDistErr(com.spatial4j.core.context.SpatialContext ctx,
                              double defaultDistErrPct)

      Gets the error distance that specifies how precise the query shape is. This looks at `getDistErr()`, `getDistErrPct()`, and `defaultDistErrPct`.
      Parameters:
        `defaultDistErrPct` - 0 to 0.5
      Returns:
        >= 0

    - #### validate

          public void validate()
                        throws IllegalArgumentException

      Check if the arguments make sense -- throw an exception if not
      Throws:
        `IllegalArgumentException`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getOperation

          public SpatialOperation getOperation()

    - #### setOperation

          public void setOperation(SpatialOperation operation)

    - #### getShape

          public com.spatial4j.core.shape.Shape getShape()

    - #### setShape

          public void setShape(com.spatial4j.core.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.
      Returns:
        0 to 0.5
      See Also:
        `calcDistanceFromErrPct(com.spatial4j.core.shape.Shape, double, com.spatial4j.core.context.SpatialContext)`

    - #### 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)

Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.