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 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 Comparator<org.elasticsearch.index.mapper.GeoShapeIndexer.Edge>INTERSECTION_ORDER
-
Constructor Summary
Constructors Constructor Description GeoShapeIndexer(boolean orientation, String name)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description List<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)Class<Geometry>processedClass()protected static Pointshift(Point coordinate, double dateline)static PolygontoLucenePolygon(Polygon polygon)
-
-
-
Field Detail
-
INTERSECTION_ORDER
protected static final Comparator<org.elasticsearch.index.mapper.GeoShapeIndexer.Edge> INTERSECTION_ORDER
-
-
Constructor Detail
-
GeoShapeIndexer
public GeoShapeIndexer(boolean orientation, String name)
-
-
Method Detail
-
prepareForIndexing
public Geometry prepareForIndexing(Geometry geometry)
- Specified by:
prepareForIndexingin interfaceAbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
-
processedClass
public Class<Geometry> processedClass()
- Specified by:
processedClassin interfaceAbstractGeometryFieldMapper.Indexer<Geometry,Geometry>
-
indexShape
public List<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
-
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
-
-