Package org.elasticsearch.index.mapper
Class GeoShapeIndexer
java.lang.Object
org.elasticsearch.index.mapper.GeoShapeIndexer
- All Implemented Interfaces:
AbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
public final class GeoShapeIndexer extends java.lang.Object implements AbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
Utility class that converts geometries into Lucene-compatible form
-
Field Summary
Fields Modifier and Type Field Description protected static java.util.Comparator<org.elasticsearch.index.mapper.GeoShapeIndexer.Edge>INTERSECTION_ORDER -
Constructor Summary
Constructors Constructor Description GeoShapeIndexer(boolean orientation, java.lang.String name) -
Method Summary
Modifier and Type Method Description java.util.List<org.apache.lucene.index.IndexableField>indexShape(ParseContext context, Geometry shape)protected static doubleintersection(double p1x, double p2x, double dateline)Calculate the intersection of a line segment and a vertical dateline.protected static intintersections(double dateline, org.elasticsearch.index.mapper.GeoShapeIndexer.Edge[] edges)Calculate all intersections of line segments and a vertical line.protected static Pointposition(Point p1, Point p2, double position)GeometryprepareForIndexing(Geometry geometry)java.lang.Class<Geometry>processedClass()protected static Pointshift(Point coordinate, double dateline)static org.apache.lucene.geo.PolygontoLucenePolygon(Polygon polygon)
-
Field Details
-
INTERSECTION_ORDER
protected static final java.util.Comparator<org.elasticsearch.index.mapper.GeoShapeIndexer.Edge> INTERSECTION_ORDER
-
-
Constructor Details
-
GeoShapeIndexer
public GeoShapeIndexer(boolean orientation, java.lang.String name)
-
-
Method Details
-
prepareForIndexing
- Specified by:
prepareForIndexingin interfaceAbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
-
processedClass
- Specified by:
processedClassin interfaceAbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
-
indexShape
public java.util.List<org.apache.lucene.index.IndexableField> indexShape(ParseContext context, Geometry shape)- Specified by:
indexShapein interfaceAbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
-
intersection
protected static double intersection(double p1x, double p2x, double dateline)Calculate the intersection of a line segment and a vertical dateline.- Parameters:
p1x- longitude of the start-point of the line segmentp2x- longitude of the end-point of the line segmentdateline- x-coordinate of the vertical dateline- Returns:
- position of the intersection in the open range (0..1] if the line
segment intersects with the line segment. Otherwise this method
returns
Double.NaN
-
shift
-
position
-
intersections
protected static int intersections(double dateline, org.elasticsearch.index.mapper.GeoShapeIndexer.Edge[] edges)Calculate all intersections of line segments and a vertical line. The Array of edges will be ordered asc by the y-coordinate of the intersections of edges.- Parameters:
dateline- x-coordinate of the datelineedges- set of edges that may intersect with the dateline- Returns:
- number of intersecting edges
-
toLucenePolygon
-