Class SelectEvent

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    DragSelectEvent

    public class SelectEvent
    extends WWEvent
    This class signals that an object or terrain is under the cursor and identifies that object and the operation that caused the signal. See the Field Summary for a description of the possible operations. When a SelectEvent occurs, all select event listeners registered with the associated WorldWindow are called. Select event listeners are registered by calling WorldWindow.addSelectListener(SelectListener).

    A ROLLOVER SelectEvent is generated every frame when the cursor is over a visible object either because the user moved it there or because the WorldWindow was repainted and a visible object was found to be under the cursor. A ROLLOVER SelectEvent is also generated when there are no longer any objects under the cursor. Select events generated for objects under the cursor have a non-null pickPoint, and contain the top-most visible object of all objects at the cursor position.

    A BOX_ROLLOVER SelectEvent is generated every frame when the selection box intersects a visible object either because the user moved or expanded it or because the WorldWindow was repainted and a visible object was found to intersect the box. A BOX_ROLLOVER SelectEvent is also generated when there are no longer any objects intersecting the selection box. Select events generated for objects intersecting the selection box have a non-null pickRectangle, and contain all top-most visible objects of all objects intersecting the selection box.

    If a select listener performs some action in response to a select event, it should call the event's consume() method in order to indicate to subsequently called listeners that the event has been responded to and no further action should be taken. Left press select events should not be consumed unless it is necessary to do so. Consuming left press events prevents the WorldWindow from gaining focus, thereby preventing it from receiving key events.

    If no object is under the cursor but the cursor is over terrain, the select event will identify the terrain as the picked object and will include the corresponding geographic position. See PickedObject.isTerrain().

    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String BOX_ROLLOVER
      The user has selected one or more of objects using a selection box.
      static java.lang.String DRAG
      The user is attempting to drag the picked object.
      static java.lang.String DRAG_END
      The user has stopped dragging the picked object.
      static java.lang.String HOVER
      The cursor has moved over the picked object and become stationary, or has moved off the object of the most recent HOVER event.
      static java.lang.String LEFT_CLICK
      The user clicked the left mouse button while the cursor was over picked object.
      static java.lang.String LEFT_DOUBLE_CLICK
      The user double-clicked the left mouse button while the cursor was over picked object.
      static java.lang.String LEFT_PRESS
      The user pressed the left mouse button while the cursor was over picked object.
      static java.lang.String RIGHT_CLICK
      The user clicked the right mouse button while the cursor was over picked object.
      static java.lang.String RIGHT_PRESS
      The user pressed the right mouse button while the cursor was over picked object.
      static java.lang.String ROLLOVER
      The cursor has moved over the object or has moved off the object most recently rolled over.
      • Fields inherited from class java.util.EventObject

        source
    • Constructor Summary

      Constructors 
      Constructor Description
      SelectEvent​(java.lang.Object source, java.lang.String eventAction, java.awt.event.MouseEvent mouseEvent, PickedObjectList pickedObjects)  
      SelectEvent​(java.lang.Object source, java.lang.String eventAction, java.awt.Point pickPoint, PickedObjectList pickedObjects)  
      SelectEvent​(java.lang.Object source, java.lang.String eventAction, java.awt.Rectangle pickRectangle, PickedObjectList pickedObjects)  
    • Field Detail

      • LEFT_CLICK

        public static final java.lang.String LEFT_CLICK
        The user clicked the left mouse button while the cursor was over picked object.
        See Also:
        Constant Field Values
      • LEFT_DOUBLE_CLICK

        public static final java.lang.String LEFT_DOUBLE_CLICK
        The user double-clicked the left mouse button while the cursor was over picked object.
        See Also:
        Constant Field Values
      • RIGHT_CLICK

        public static final java.lang.String RIGHT_CLICK
        The user clicked the right mouse button while the cursor was over picked object.
        See Also:
        Constant Field Values
      • LEFT_PRESS

        public static final java.lang.String LEFT_PRESS
        The user pressed the left mouse button while the cursor was over picked object.
        See Also:
        Constant Field Values
      • RIGHT_PRESS

        public static final java.lang.String RIGHT_PRESS
        The user pressed the right mouse button while the cursor was over picked object.
        See Also:
        Constant Field Values
      • HOVER

        public static final java.lang.String HOVER
        The cursor has moved over the picked object and become stationary, or has moved off the object of the most recent HOVER event. In the latter case, the picked object will be null.
        See Also:
        Constant Field Values
      • ROLLOVER

        public static final java.lang.String ROLLOVER
        The cursor has moved over the object or has moved off the object most recently rolled over. In the latter case the picked object will be null.
        See Also:
        Constant Field Values
      • DRAG

        public static final java.lang.String DRAG
        The user is attempting to drag the picked object.
        See Also:
        Constant Field Values
      • DRAG_END

        public static final java.lang.String DRAG_END
        The user has stopped dragging the picked object.
        See Also:
        Constant Field Values
      • BOX_ROLLOVER

        public static final java.lang.String BOX_ROLLOVER
        The user has selected one or more of objects using a selection box. A box rollover event is generated every frame if one or more objects intersect the box, in which case the event's pickedObjects list contain the selected objects. A box rollover event is generated once when the selection becomes empty, in which case the event's pickedObjects is null. In either case, the event's pickRect contains the selection box bounds in AWT screen coordinates.
        See Also:
        Constant Field Values
    • Constructor Detail

      • SelectEvent

        public SelectEvent​(java.lang.Object source,
                           java.lang.String eventAction,
                           java.awt.event.MouseEvent mouseEvent,
                           PickedObjectList pickedObjects)
      • SelectEvent

        public SelectEvent​(java.lang.Object source,
                           java.lang.String eventAction,
                           java.awt.Point pickPoint,
                           PickedObjectList pickedObjects)
      • SelectEvent

        public SelectEvent​(java.lang.Object source,
                           java.lang.String eventAction,
                           java.awt.Rectangle pickRectangle,
                           PickedObjectList pickedObjects)
    • Method Detail

      • consume

        public void consume()
        Description copied from class: WWEvent
        Consumes the event so it will not be processed in the default manner by the source which originated it. This does nothing if the event cannot be consumed.
        Overrides:
        consume in class WWEvent
      • getEventAction

        public java.lang.String getEventAction()
      • getPickPoint

        public java.awt.Point getPickPoint()
      • getPickRectangle

        public java.awt.Rectangle getPickRectangle()
      • getMouseEvent

        public java.awt.event.MouseEvent getMouseEvent()
      • hasObjects

        public boolean hasObjects()
      • getTopPickedObject

        public PickedObject getTopPickedObject()
      • getTopObject

        public java.lang.Object getTopObject()
      • getAllTopPickedObjects

        public java.util.List<PickedObject> getAllTopPickedObjects()
        Returns a list of all picked objects in this event's picked object list who's onTop flag is set to true. This returns null if this event's picked object list is empty, or does not contain any picked objects marked as on top.
        Returns:
        a new list of the picked objects marked as on top, or null if nothing is marked as on top.
      • getAllTopObjects

        public java.util.List<?> getAllTopObjects()
        Returns a list of all objects associated with a picked object in this event's picked object list who's onTop flag is set to true. This returns null if this event's picked object list is empty, or does not contain any picked objects marked as on top.
        Returns:
        a new list of the objects associated with a picked object marked as on top, or null if nothing is marked as on top.
      • isRollover

        public boolean isRollover()
      • isHover

        public boolean isHover()
      • isDragEnd

        public boolean isDragEnd()
      • isDrag

        public boolean isDrag()
      • isRightPress

        public boolean isRightPress()
      • isRightClick

        public boolean isRightClick()
      • isLeftDoubleClick

        public boolean isLeftDoubleClick()
      • isLeftClick

        public boolean isLeftClick()
      • isLeftPress

        public boolean isLeftPress()
      • isBoxSelect

        public boolean isBoxSelect()
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.util.EventObject