Class Line

All Implemented Interfaces:
Curve, Geometry, LineTypeGeometry, Serializable, Cloneable

public class Line extends LineString
A line is a LineString with 2 points.
See Also:
  • Constructor Details

  • Method Details

    • getGeometryId

      public short getGeometryId()
      Description copied from class: LineString
      Returns the geometry class id. This method is useful for geometry serialization.
      Specified by:
      getGeometryId in interface Geometry
      Overrides:
      getGeometryId in class LineString
      Returns:
      the geometry id.
    • pointOnLine

      public Point pointOnLine(double interpolation)
      This method finds the point being at a certain percentage of the path between the starting point and the final point.
      Overrides:
      pointOnLine in class LineString
      Parameters:
      interpolation - the interpolation expressed as a percentage (between 0 and 1)
      Returns:
      the reulsting point
    • getCenteredPoint

      public Point getCenteredPoint()
      Description copied from class: LineString
      This method returns a point that is typically centered on the geometry. If the geometry is a point, the point is returned. If it is a line, a point on the curve interpolated at 50% is returned. If the geometry is a surface, the centroid is returned if it is inside the polygon, if not, a point inside the polygon (but likely not exactly in the center) will be returned. If the geometry is a collection, the method is called on the first part of the collection.
      Specified by:
      getCenteredPoint in interface Geometry
      Overrides:
      getCenteredPoint in class LineString
      Returns:
      a point likely at the center of the geometry
    • toString

      public String toString()
      Description copied from interface: Geometry
      Returns information about the current geometry.
      Specified by:
      toString in interface Geometry
      Overrides:
      toString in class LineString
      Returns:
      information about the current geometry.