Class ShapeBuilder<T extends Shape,​G extends Geometry,​E extends ShapeBuilder<T,​G,​E>>

    • Field Detail

      • LOGGER

        protected static final org.apache.logging.log4j.Logger LOGGER
      • ZERO_ZERO

        public static final Coordinate ZERO_ZERO
        coordinate at [0.0, 0.0]
      • wrapdateline

        protected final boolean wrapdateline
        We're expecting some geometries might cross the dateline.
      • MULTI_POLYGON_MAY_OVERLAP

        protected static final boolean MULTI_POLYGON_MAY_OVERLAP
        It's possible that some geometries in a MULTI* shape might overlap. With the possible exception of GeometryCollection, this normally isn't allowed.
        See Also:
        Constant Field Values
      • INTERSECTION_ORDER

        protected static final org.elasticsearch.common.geo.builders.ShapeBuilder.IntersectionOrder INTERSECTION_ORDER
    • Constructor Detail

      • ShapeBuilder

        protected ShapeBuilder()
        default ctor
      • ShapeBuilder

        protected ShapeBuilder​(List<Coordinate> coordinates)
        ctor from list of coordinates
    • Method Detail

      • coordinate

        public E coordinate​(double longitude,
                            double latitude)
        Add a new coordinate to the collection
        Parameters:
        longitude - longitude of the coordinate
        latitude - latitude of the coordinate
        Returns:
        this
      • coordinate

        public E coordinate​(Coordinate coordinate)
        Add a new coordinate to the collection
        Parameters:
        coordinate - coordinate of the point
        Returns:
        this
      • coordinates

        public E coordinates​(Coordinate... coordinates)
        Add a array of coordinates to the collection
        Parameters:
        coordinates - array of Coordinates to add
        Returns:
        this
      • coordinates

        public E coordinates​(Collection<? extends Coordinate> coordinates)
        Add a collection of coordinates to the collection
        Parameters:
        coordinates - array of Coordinates to add
        Returns:
        this
      • coordinates

        protected Coordinate[] coordinates​(boolean closed)
        Copy all coordinate to a new Array
        Parameters:
        closed - if set to true the first point of the array is repeated as last element
        Returns:
        Array of coordinates
      • buildS4J

        public abstract T buildS4J()
        Create a new Shape from this builder. Since calling this method could change the defined shape. (by inserting new coordinates or change the position of points) the builder looses its validity. So this method should only be called once on a builder
        Returns:
        new Shape defined by the builder
      • buildGeometry

        public abstract G buildGeometry()
        build lucene geometry.
        Returns:
        GeoPoint, double[][], Line, Line[], Polygon, Polygon[], Rectangle, Object[]
      • type

        public abstract GeoShapeType type()
        get the shapes type
        Returns:
        type of the shape
      • numDimensions

        public abstract int numDimensions()
        tracks number of dimensions for this shape
      • intersection

        protected static final double intersection​(Coordinate p1,
                                                   Coordinate p2,
                                                   double dateline)
        Calculate the intersection of a line segment and a vertical dateline.
        Parameters:
        p1 - start-point of the line segment
        p2 - end-point of the line segment
        dateline - 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,
                                           ShapeBuilder.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 dateline
        edges - set of edges that may intersect with the dateline
        Returns:
        number of intersecting edges
      • toWKT

        public String toWKT()
      • debugEnabled

        protected static final boolean debugEnabled()
      • coordinatesToXcontent

        protected XContentBuilder coordinatesToXcontent​(XContentBuilder builder,
                                                        boolean closed)
                                                 throws IOException
        builds an array of coordinates to a XContentBuilder
        Parameters:
        builder - builder to use
        closed - repeat the first point at the end of the array if it's not already defines as last element of the array
        Returns:
        the builder
        Throws:
        IOException
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object