All Implemented Interfaces:
Serializable

public class LineString extends SimpleGeometry
Geometry that represents a line string, which is a series of connected line segments.
See Also:
  • Constructor Details

    • LineString

      public LineString(List<Coordinate> coordinates)
      Constructs a new LineString geometry based on the provided coordinates. The provided coordinates define the vertices of the line. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line, for example to represent a path or route.

      Coordinates must be specified in the map's user projection, which by default is EPSG:4326, also referred to as GPS coordinates.

      Parameters:
      coordinates - the coordinates that define the line string
      Throws:
      IllegalArgumentException - if the provided coordinate list is null or has fewer than 2 coordinates
    • LineString

      public LineString(Coordinate... coordinates)
      Constructs a new LineString geometry based on the provided coordinates. The provided coordinates define the vertices of the line. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line, for example to represent a path or route.

      Coordinates must be specified in the map's user projection, which by default is EPSG:4326, also referred to as GPS coordinates.

      Parameters:
      coordinates - the coordinates that define the line string
      Throws:
      IllegalArgumentException - if the provided coordinate array is null or has fewer than 2 coordinates
  • Method Details

    • getType

      public String getType()
      Description copied from class: AbstractConfigurationObject
      The unique type name of this class. Used by the client-side synchronization mechanism to determine which OpenLayers class to synchronize into.
      Specified by:
      getType in class AbstractConfigurationObject
    • setCoordinates

      public void setCoordinates(List<Coordinate> coordinates)
      Sets the coordinates that define the line string. The provided coordinates define the vertices of the line. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line, for example to represent a path or route.

      Coordinates must be specified in the map's user projection, which by default is EPSG:4326, also referred to as GPS coordinates.

      Parameters:
      coordinates - the new coordinates
      Throws:
      IllegalArgumentException - if the provided coordinate list is null or has fewer than 2 coordinates
    • setCoordinates

      public void setCoordinates(Coordinate... coordinates)
      Sets the coordinates that define the line string. The provided coordinates define the vertices of the line. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line, for example to represent a path or route.

      Coordinates must be specified in the map's user projection, which by default is EPSG:4326, also referred to as GPS coordinates.

      Parameters:
      coordinates - the new coordinates
      Throws:
      IllegalArgumentException - if the provided coordinate array is null or has fewer than 2 coordinates
    • getCoordinates

      public Coordinate[] getCoordinates()
      The coordinates that define the line string, as an array.
      Returns:
      the current coordinates
    • translate

      public void translate(double deltaX, double deltaY)
      Description copied from class: SimpleGeometry
      Translate the geometry by the specified delta
      Specified by:
      translate in class SimpleGeometry
      Parameters:
      deltaX - amount to move on x-axis
      deltaY - amount to move on y-axis