NASA World Wind

gov.nasa.worldwind.event
Class SelectEvent

java.lang.Object
  extended by java.util.EventObject
      extended by gov.nasa.worldwind.event.WWEvent
          extended by gov.nasa.worldwind.event.SelectEvent
All Implemented Interfaces:
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 World Window 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 World Window 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
static String BOX_ROLLOVER
          The user has selected one or more of objects using a selection box.
static String DRAG
          The user is attempting to drag the picked object.
static String DRAG_END
          The user has stopped dragging the picked object.
static 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 String LEFT_CLICK
          The user clicked the left mouse button while the cursor was over picked object.
static String LEFT_DOUBLE_CLICK
          The user double-clicked the left mouse button while the cursor was over picked object.
static String LEFT_PRESS
          The user pressed the left mouse button while the cursor was over picked object.
static String RIGHT_CLICK
          The user clicked the right mouse button while the cursor was over picked object.
static String RIGHT_PRESS
          The user pressed the right mouse button while the cursor was over picked object.
static String ROLLOVER
          The cursor has moved over the object or has moved off the object most recently rolled over.
 
Fields inherited from class gov.nasa.worldwind.event.WWEvent
consumed
 
Fields inherited from class java.util.EventObject
source
 
Constructor Summary
SelectEvent(Object source, String eventAction, MouseEvent mouseEvent, PickedObjectList pickedObjects)
           
SelectEvent(Object source, String eventAction, Point pickPoint, PickedObjectList pickedObjects)
           
SelectEvent(Object source, String eventAction, Rectangle pickRectangle, PickedObjectList pickedObjects)
           
 
Method Summary
 void consume()
          Consumes the event so it will not be processed in the default manner by the source which originated it.
 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.
 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.
 String getEventAction()
           
 MouseEvent getMouseEvent()
           
 PickedObjectList getObjects()
           
 Point getPickPoint()
           
 Rectangle getPickRectangle()
           
 Object getTopObject()
           
 PickedObject getTopPickedObject()
           
 boolean hasObjects()
           
 boolean isBoxSelect()
           
 boolean isDrag()
           
 boolean isDragEnd()
           
 boolean isHover()
           
 boolean isLeftClick()
           
 boolean isLeftDoubleClick()
           
 boolean isLeftPress()
           
 boolean isRightClick()
           
 boolean isRightPress()
           
 boolean isRollover()
           
 String toString()
           
 
Methods inherited from class gov.nasa.worldwind.event.WWEvent
isConsumed
 
Methods inherited from class java.util.EventObject
getSource
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

BOX_ROLLOVER

public static final 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

DRAG

public static final String DRAG
The user is attempting to drag the picked object.

See Also:
Constant Field Values

DRAG_END

public static final String DRAG_END
The user has stopped dragging the picked object.

See Also:
Constant Field Values

HOVER

public static final 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

LEFT_CLICK

public static final 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 String LEFT_DOUBLE_CLICK
The user double-clicked the left mouse button while the cursor was over picked object.

See Also:
Constant Field Values

LEFT_PRESS

public static final String LEFT_PRESS
The user pressed the left mouse button while the cursor was over picked object.

See Also:
Constant Field Values

RIGHT_CLICK

public static final String RIGHT_CLICK
The user clicked the right mouse button while the cursor was over picked object.

See Also:
Constant Field Values

RIGHT_PRESS

public static final String RIGHT_PRESS
The user pressed the right mouse button while the cursor was over picked object.

See Also:
Constant Field Values

ROLLOVER

public static final 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
Constructor Detail

SelectEvent

public SelectEvent(Object source,
                   String eventAction,
                   MouseEvent mouseEvent,
                   PickedObjectList pickedObjects)

SelectEvent

public SelectEvent(Object source,
                   String eventAction,
                   Point pickPoint,
                   PickedObjectList pickedObjects)

SelectEvent

public SelectEvent(Object source,
                   String eventAction,
                   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

getAllTopObjects

public 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.

getAllTopPickedObjects

public 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.

getEventAction

public String getEventAction()

getMouseEvent

public MouseEvent getMouseEvent()

getObjects

public PickedObjectList getObjects()

getPickPoint

public Point getPickPoint()

getPickRectangle

public Rectangle getPickRectangle()

getTopObject

public Object getTopObject()

getTopPickedObject

public PickedObject getTopPickedObject()

hasObjects

public boolean hasObjects()

isBoxSelect

public boolean isBoxSelect()

isDrag

public boolean isDrag()

isDragEnd

public boolean isDragEnd()

isHover

public boolean isHover()

isLeftClick

public boolean isLeftClick()

isLeftDoubleClick

public boolean isLeftDoubleClick()

isLeftPress

public boolean isLeftPress()

isRightClick

public boolean isRightClick()

isRightPress

public boolean isRightPress()

isRollover

public boolean isRollover()

toString

public String toString()
Overrides:
toString in class EventObject

NASA World Wind