Package org.apache.lucene.document
Class ShapeField
- java.lang.Object
-
- org.apache.lucene.document.ShapeField
-
public final class ShapeField extends java.lang.ObjectA base shape utility class used for both LatLon (spherical) and XY (cartesian) shape fields.Polygon's andLine's are decomposed into a triangular mesh using theTessellatorutility class. EachShapeField.Triangleis encoded by this base class and indexed as a seven dimension multi-value field.Finding all shapes that intersect a range (e.g., bounding box), or target shape, at search time is efficient.
This class defines the static methods for encoding the three vertices of a tessellated triangles as a seven dimension point. The coordinates are converted from double precision values into 32 bit integers so they are sortable at index time.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classShapeField.DecodedTriangleRepresents a encoded triangle usingdecodeTriangle(byte[], DecodedTriangle).static classShapeField.QueryRelationQuery Relation Typesstatic classShapeField.Trianglepolygons are decomposed into tessellated triangles usingTessellatorthese triangles are encoded and inserted as separate indexed POINT fields
-
Field Summary
Fields Modifier and Type Field Description (package private) static intBYTESvertex coordinates are encoded as 4 byte integersprivate static intMAXY_MINX_MINY_MAXX_Y_Xprivate static intMAXY_MINX_MINY_X_Y_MAXXprivate static intMAXY_MINX_Y_X_MINY_MAXXprivate static intMINY_MINX_MAXY_MAXX_Y_Xprivate static intMINY_MINX_Y_MAXX_MAXY_Xprivate static intMINY_MINX_Y_X_MAXY_MAXXprotected static FieldTypeTYPEtessellated triangles are seven dimensions; the first four are the bounding box index dimensionsprivate static intY_MINX_MINY_MAXX_MAXY_Xprivate static intY_MINX_MINY_X_MAXY_MAXX
-
Constructor Summary
Constructors Modifier Constructor Description privateShapeField()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voiddecodeTriangle(byte[] t, ShapeField.DecodedTriangle triangle)Decode a triangle encoded byencodeTriangle(byte[], int, int, boolean, int, int, boolean, int, int, boolean).static voidencodeTriangle(byte[] bytes, int aY, int aX, boolean ab, int bY, int bX, boolean bc, int cY, int cX, boolean ca)A triangle is encoded using 6 points and an extra point with encoded information in three bits of how to reconstruct it.private static voidresolveTriangleType(ShapeField.DecodedTriangle triangle)
-
-
-
Field Detail
-
BYTES
static final int BYTES
vertex coordinates are encoded as 4 byte integers- See Also:
- Constant Field Values
-
TYPE
protected static final FieldType TYPE
tessellated triangles are seven dimensions; the first four are the bounding box index dimensions
-
MINY_MINX_MAXY_MAXX_Y_X
private static final int MINY_MINX_MAXY_MAXX_Y_X
- See Also:
- Constant Field Values
-
MINY_MINX_Y_X_MAXY_MAXX
private static final int MINY_MINX_Y_X_MAXY_MAXX
- See Also:
- Constant Field Values
-
MAXY_MINX_Y_X_MINY_MAXX
private static final int MAXY_MINX_Y_X_MINY_MAXX
- See Also:
- Constant Field Values
-
MAXY_MINX_MINY_MAXX_Y_X
private static final int MAXY_MINX_MINY_MAXX_Y_X
- See Also:
- Constant Field Values
-
Y_MINX_MINY_X_MAXY_MAXX
private static final int Y_MINX_MINY_X_MAXY_MAXX
- See Also:
- Constant Field Values
-
Y_MINX_MINY_MAXX_MAXY_X
private static final int Y_MINX_MINY_MAXX_MAXY_X
- See Also:
- Constant Field Values
-
MAXY_MINX_MINY_X_Y_MAXX
private static final int MAXY_MINX_MINY_X_Y_MAXX
- See Also:
- Constant Field Values
-
MINY_MINX_Y_MAXX_MAXY_X
private static final int MINY_MINX_Y_MAXX_MAXY_X
- See Also:
- Constant Field Values
-
-
Method Detail
-
encodeTriangle
public static void encodeTriangle(byte[] bytes, int aY, int aX, boolean ab, int bY, int bX, boolean bc, int cY, int cX, boolean ca)A triangle is encoded using 6 points and an extra point with encoded information in three bits of how to reconstruct it. Triangles are encoded with CCW orientation and might be rotated to limit the number of possible reconstructions to 2^3. Reconstruction always happens from west to east.
-
decodeTriangle
public static void decodeTriangle(byte[] t, ShapeField.DecodedTriangle triangle)Decode a triangle encoded byencodeTriangle(byte[], int, int, boolean, int, int, boolean, int, int, boolean).
-
resolveTriangleType
private static void resolveTriangleType(ShapeField.DecodedTriangle triangle)
-
-