Class LineStringFeature

All Implemented Interfaces:
Serializable

public class LineStringFeature extends Feature
A convenience class for displaying a line string with one or more segments on the map.

Technically this is a Feature that uses a LineString geometry for representation.

See Also:
  • Constructor Details

    • LineStringFeature

      public LineStringFeature(List<Coordinate> coordinates)
      Creates a new line string feature with the default style using the provided coordinates. The provided coordinates define the vertices of the line string. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line string, 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 list of coordinates that define the vertices of the line string
      Throws:
      IllegalArgumentException - if the provided coordinate list is null or has fewer than 2 coordinates
    • LineStringFeature

      public LineStringFeature(Coordinate... coordinates)
      Creates a new line string feature with the default style using the provided coordinates. The provided coordinates define the vertices of the line string. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line string, 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 vertices of the line string
      Throws:
      IllegalArgumentException - if the provided coordinate array is null or has fewer than 2 coordinates
  • Method Details

    • getCoordinates

      public Coordinate[] getCoordinates()
      The coordinates that define the line string, as an array. Each coordinate represents a vertex in the line string.
      Returns:
      the current coordinates
    • setCoordinates

      public void setCoordinates(List<Coordinate> coordinates)
      Sets the coordinates that define the line string. The provided coordinates define the vertices of the line string. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line string, 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 string. A line string must have at least two coordinates. Using more than two coordinates creates a multi-segment line string, 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
    • getGeometry

      public LineString getGeometry()
      The LineString geometry representing this feature.
      Overrides:
      getGeometry in class Feature
      Returns:
      the current line string geometry
    • setGeometry

      public void setGeometry(SimpleGeometry geometry)
      Sets the geometry representing this feature. This must be a LineString geometry.
      Overrides:
      setGeometry in class Feature
      Parameters:
      geometry - the new geometry, not null
      Throws:
      IllegalArgumentException - if the geometry is not an instance of LineString