Package org.apache.lucene.document

# Class XYShapeDocValues

java.lang.Object
org.apache.lucene.document.XYShapeDocValues

public final class XYShapeDocValues extends Object
A concrete implementation of `ShapeDocValues` for storing binary doc value representation of `XYShape` geometries in a `XYShapeDocValuesField`

Note: This class cannot be instantiated directly. See `XYShape` for factory API based on different geometries.

WARNING: This API is experimental and might change in incompatible ways in the next release.

## Field Summary

Fields
Modifier and Type
Field
Description
`protected final Geometry`
`boundingBox`
the bounding box of the shape docvalue
`protected final Geometry`
`centroid`
the centroid of the shape docvalue
`protected final org.apache.lucene.document.ShapeDocValues.ShapeComparator`
`shapeComparator`
the geometry comparator used to check relations
`protected static final byte`
`VERSION`
doc value format version; used to support bwc for any encoding changes

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`XYShapeDocValues(List<ShapeField.DecodedTriangle> tessellation)`
protected ctor for instantiating a cartesian doc value based on a tessellation
`protected`
`XYShapeDocValues(BytesRef binaryValue)`
protected ctor for instantiating a cartesian doc value based on an already retrieved binary format

## Method Summary

Modifier and Type
Method
Description
`protected BytesRef`
`binaryValue()`
returns the encoded doc values field as a `BytesRef`
`protected XYRectangle`
`computeBoundingBox()`
`protected XYPoint`
`computeCentroid()`
`XYRectangle`
`getBoundingBox()`
`XYPoint`
`getCentroid()`
`protected int`
`getEncodedCentroidX()`
Retrieves the encoded x centroid location for the geometry(s)
`protected int`
`getEncodedCentroidY()`
Retrieves the encoded y centroid location for the geometry(s)
`int`
`getEncodedMaxX()`
returns the max x value for the shape's bounding box
`int`
`getEncodedMaxY()`
returns the max y value for the shape's bounding box
`int`
`getEncodedMinX()`
returns the min x value for the shape's bounding box
`int`
`getEncodedMinY()`
returns the min y value for the shape's bounding box
`protected org.apache.lucene.document.ShapeDocValues.Encoder`
`getEncoder()`
`ShapeField.DecodedTriangle.TYPE`
`getHighestDimension()`
Retrieves the highest dimensional type (POINT, LINE, TRIANGLE) for computing the geometry(s) centroid
`static Query`
`newGeometryQuery(String field, ShapeField.QueryRelation relation, Object... geometries)`
Creates a geometry query for shape docvalues
`int`
`numberOfTerms()`
Returns the number of terms (tessellated triangles) for this shape
`PointValues.Relation`
`relate(Component2D component)`
`protected static int`
`vIntSize(int i)`
Computes the variable Integer size in bytes
`protected static int`
`vLongSize(long i)`
Computes the variable Long size in bytes

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

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

## Field Details

### VERSION

protected static final byte VERSION
doc value format version; used to support bwc for any encoding changes

See Also:
  - Constant Field Values

### shapeComparator

protected final org.apache.lucene.document.ShapeDocValues.ShapeComparator shapeComparator
the geometry comparator used to check relations

### centroid

protected final Geometry centroid
the centroid of the shape docvalue

### boundingBox

protected final Geometry boundingBox
the bounding box of the shape docvalue

## Constructor Details

### XYShapeDocValues

protected XYShapeDocValues(List<ShapeField.DecodedTriangle> tessellation)
protected ctor for instantiating a cartesian doc value based on a tessellation

### XYShapeDocValues

protected XYShapeDocValues(BytesRef binaryValue)
protected ctor for instantiating a cartesian doc value based on an already retrieved binary format

## Method Details

### getCentroid

public XYPoint getCentroid()

### getBoundingBox

public XYRectangle getBoundingBox()

### computeCentroid

protected XYPoint computeCentroid()

### computeBoundingBox

protected XYRectangle computeBoundingBox()

### getEncoder

protected org.apache.lucene.document.ShapeDocValues.Encoder getEncoder()

### binaryValue

protected BytesRef binaryValue()
returns the encoded doc values field as a `BytesRef`

### numberOfTerms

public int numberOfTerms()
Returns the number of terms (tessellated triangles) for this shape

### getEncodedMinX

public int getEncodedMinX()
returns the min x value for the shape's bounding box

### getEncodedMinY

public int getEncodedMinY()
returns the min y value for the shape's bounding box

### getEncodedMaxX

public int getEncodedMaxX()
returns the max x value for the shape's bounding box

### getEncodedMaxY

public int getEncodedMaxY()
returns the max y value for the shape's bounding box

### getEncodedCentroidX

protected int getEncodedCentroidX()
Retrieves the encoded x centroid location for the geometry(s)

### getEncodedCentroidY

protected int getEncodedCentroidY()
Retrieves the encoded y centroid location for the geometry(s)

### getHighestDimension

public ShapeField.DecodedTriangle.TYPE getHighestDimension()
Retrieves the highest dimensional type (POINT, LINE, TRIANGLE) for computing the geometry(s) centroid

### newGeometryQuery

public static Query newGeometryQuery(String field, ShapeField.QueryRelation relation, Object... geometries)
Creates a geometry query for shape docvalues

### relate

public PointValues.Relation relate(Component2D component) throws IOException

Throws:
  `IOException`

### vLongSize

protected static int vLongSize(long i)
Computes the variable Long size in bytes

### vIntSize

protected static int vIntSize(int i)
Computes the variable Integer size in bytes