Class LineEditor



  • public class LineEditor
    extends Object
    A LineEditor manages the process of editing a line / polygon.
    • Constructor Detail

      • LineEditor

        public LineEditor(MapWindow window)
        Create a new line editor.
        Parameters:
        window - the window to use for transformations from pixel to geographic space.
    • Method Detail

      • add

        public void add(int x,
                        int y)
        Add the point (x,y) to the list of points.
        Parameters:
        x - the x coordinate of the new point.
        y - the y coordinate of the new point.
      • removeLast

        public void removeLast()
        If possible remove the last point.
      • close

        public void close()
        If possible, close the line to a polygon by connecting the last point with the first one.
      • canClose

        public boolean canClose()
        Returns:
        whether it is currently possible to close this line to a polygon.
      • isClosed

        public boolean isClosed()
        Returns:
        whether this line is closed, i.e. is a polygon.
      • isEmpty

        public boolean isEmpty()
        Returns:
        whether this line is empty. i.e. has zero coordinates.
      • getGeometryPixels

        public Geometry getGeometryPixels()
        Returns:
        the geometry represented (a point, line or polygon) in pixel space.
      • getGeometryDegrees

        public Geometry getGeometryDegrees()
        Returns:
        the geometry represented (a point, line or polygon) in geographic space.
      • fromDegrees

        public void fromDegrees()
        Rebuild the pixel representation of the geometry by the geographic representation.
      • fromPixels

        public void fromPixels()
        Rebuild the geographic representation of the geometry by the pixel representation.
      • setLineDegrees

        public void setLineDegrees(LineString string)
        Set this LineEditor's geometry to the denoted string.
        Parameters:
        string - the LineString to edit.