Class CoordinatesBuilder


  • public class CoordinatesBuilder
    extends Object
    A builder for a list of coordinates. Enables chaining of individual coordinates either as long/lat pairs or as Coordinate elements, arrays or collections.
    • Constructor Detail

      • CoordinatesBuilder

        public CoordinatesBuilder()
    • Method Detail

      • coordinate

        public CoordinatesBuilder coordinate​(Coordinate coordinate)
        Add a new coordinate to the collection
        Parameters:
        coordinate - the coordinate to add
        Returns:
        this
      • coordinate

        public CoordinatesBuilder 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
      • coordinates

        public CoordinatesBuilder coordinates​(Coordinate... coordinates)
        Add an array of coordinates to the current coordinates
        Parameters:
        coordinates - array of Coordinates to add
        Returns:
        this
      • close

        public CoordinatesBuilder close()
        Makes a closed ring out of the current coordinates by adding the starting point as the end point. Will have no effect of starting and end point are already the same coordinate.
      • build

        public List<Coordinate> build()
        Returns:
        a list containing the current coordinates