Class NFESelectionTool

  • All Implemented Interfaces:
    Layer, Tool, PropertySupport
    Direct Known Subclasses:
    NFEFeatureElementSelectionTool

    public abstract class NFESelectionTool
    extends NFETool
    Base class for all the tools which perform selection. An implementation must specify which layers are selectable and the selection priority of the GeoObjects.
    • Field Detail

      • MAX_SELECTABLE_PRIORITY

        protected static final int MAX_SELECTABLE_PRIORITY
        See Also:
        Constant Field Values
      • MIN_SELECTABLE_PRIORITY

        protected static final int MIN_SELECTABLE_PRIORITY
        See Also:
        Constant Field Values
      • NO_SELECTABLE_PRIORITY

        protected static final int NO_SELECTABLE_PRIORITY
        See Also:
        Constant Field Values
    • Constructor Detail

    • Method Detail

      • isMultiSelect

        public boolean isMultiSelect()
        Tells whether the tool allows multiple selection or not
        Returns:
        true if the tool allows multiple selection
      • setMultiSelect

        public void setMultiSelect​(boolean multiSelect)
        Sets whether the tool allows multiple selection or not
        Parameters:
        multiSelect - true if the tool allows multiple selection
      • mouseMoved

        protected boolean mouseMoved​(java.awt.event.MouseEvent mouseEvent)
        Description copied from class: NFETool
        Called when a mouse moved event is registered
        Overrides:
        mouseMoved in class NFETool
        Parameters:
        mouseEvent - a mouse event event
        Returns:
        true if the event should be propagated
      • mouseClicked

        protected boolean mouseClicked​(java.awt.event.MouseEvent mouseEvent)
        Description copied from class: NFETool
        Called when a mouse clicked event is registered
        Overrides:
        mouseClicked in class NFETool
        Parameters:
        mouseEvent - a mouse event
        Returns:
        true if the event should be propagated
      • keyPressed

        protected boolean keyPressed​(java.awt.event.KeyEvent keyEvent)
        Description copied from class: NFETool
        Called when a key pressed event is registered
        Overrides:
        keyPressed in class NFETool
        Parameters:
        keyEvent - a key event
        Returns:
        true if the event should be propagated
      • keyReleased

        protected boolean keyReleased​(java.awt.event.KeyEvent keyEvent)
        Description copied from class: NFETool
        Called when a key released event is registered
        Overrides:
        keyReleased in class NFETool
        Parameters:
        keyEvent - a key event
        Returns:
        true if the event should be propagated
      • getSelectableObject

        protected GeoObject getSelectableObject​(java.util.Collection<Layer> selLayers,
                                                java.awt.event.MouseEvent mouseEvent)
        Gets the GeoObject to be selected given the selectable layers and the mouse event information
        Parameters:
        selLayers - a collection of layers containing GeoObjects eligible for selection
        mouseEvent - a mouse event
        Returns:
        a GeoObject to be selected or null if none was eligible
      • hover

        protected void hover​(GeoObject geoObj,
                             java.awt.event.MouseEvent mouseEvent)
        Notifies the GeoObject's layer that the GeoObject is being hovered
        Parameters:
        geoObj - a GeoObject being hovered
        mouseEvent - a mouse event
      • select

        protected void select​(GeoObject geoObj,
                              java.awt.event.MouseEvent mouseEvent)
        Notifies the GeoObject's layer that the object is being selected
        Parameters:
        geoObj - a GeoObject being selected
        mouseEvent - a mouse event
      • clear

        public void clear()
        Description copied from interface: Layer
        Clears all contents of this layer.
        Specified by:
        clear in interface Layer
        Overrides:
        clear in class BasicLayer
      • getSelectableGeoObjectPriority

        protected abstract int getSelectableGeoObjectPriority​(GeoObject geoObj,
                                                              java.awt.geom.Point2D srsMousePoint)
        Gets the GeoObject priority to be selected. Selection priority is needed as more than one element may be interacting with the mouse point when selecting.
        Parameters:
        geoObj - a selectable GeoObject
        srsMousePoint - the mouse point in model's coordinate system
        Returns:
      • getSelectableLayers

        protected abstract java.util.Collection<Layer> getSelectableLayers()
        Gets all the layers containing GeoObjects that may be selected by the tool
        Returns:
        a collection of layers
      • deleteSelection

        protected abstract void deleteSelection()
        Notifies all the layers to delete its current selected GeoObjects