Class Selection



  • public class Selection
    extends Object
    • Constructor Detail

      • Selection

        public Selection(MapWindow window)
        Create a new Selection for the given window.
        Parameters:
        window - the window to use for the selection. The window is necessary to transform between pixel and geographic values
    • Method Detail

      • add

        public void add(int x,
                        int y)
        Add the point (x, y) to the current line. If the last line is closed or there is no current line, start a new one.
        Parameters:
        x - the x coordinate of the new point.
        y - the y coordinate of the new point.
      • remove

        public void remove()
        Remove the last point from the current line. If the current line is empty, the next removal will proceed at a random instance of the other lines.
      • close

        public void close()
        If possible (enough points), close the current line to a polygon.
      • getGeometries

        public GeometryCollection getGeometries()
        Retrieve the geometries represented by this selection.
        Returns:
        the selection in form of a GeometryCollection
      • getGeometriesAsList

        public List<Geometry> getGeometriesAsList()
        Retrieve the geometries represented by this selection.
        Returns:
        the selection in form of a list of geometries.
      • getGeometriesAsListDegrees

        public List<Geometry> getGeometriesAsListDegrees()
        Retrieve the geometries represented by this selection.
        Returns:
        the selection in form of a list of geometries.
      • fromDegrees

        public void fromDegrees()
        Rebuild the pixel representations of the lines from the degree instances.
      • fromPixels

        public void fromPixels()
        Rebuild the geographic representations of the lines from the pixel instances.
      • addSelectionChangeListener

        public void addSelectionChangeListener(SelectionChangeListener listener)
        Add a listener that get informed on changes of the selections.
        Parameters:
        listener - the listener to add.
      • removeSelectionChangeListener

        public void removeSelectionChangeListener(SelectionChangeListener listener)
        Remove a listener from the list of selection listeners.
        Parameters:
        listener - the listener to remove.
      • add

        public void add(LineString string)
        Add the denoted LineString to the list of edited geometries.
        Parameters:
        string - the LineString to add.
      • remove

        public void remove(int index)
        Remove the element at the denoted index position from the list of geometries.
        Parameters:
        index - the index of the geometry to remove.
      • setEditedGeometry

        public void setEditedGeometry(int index)
        Set the currently edited geometry to the one referenced by the denoted index.
        Parameters:
        index - the index of the geometry to edit.