public class SelectEvent extends WWEvent
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()
.
Modifier and Type | Field and 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.
|
Constructor and 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) |
Modifier and Type | Method and Description |
---|---|
void |
consume()
Consumes the event so it will not be processed in the default manner by the source which originated it.
|
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.
|
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.
|
java.lang.String |
getEventAction() |
java.awt.event.MouseEvent |
getMouseEvent() |
PickedObjectList |
getObjects() |
java.awt.Point |
getPickPoint() |
java.awt.Rectangle |
getPickRectangle() |
java.lang.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() |
java.lang.String |
toString() |
isConsumed
public static final java.lang.String BOX_ROLLOVER
null
. In either case, the event's pickRect contains the selection box bounds in AWT
screen coordinates.public static final java.lang.String DRAG
public static final java.lang.String DRAG_END
public static final java.lang.String HOVER
HOVER
event. In the latter case, the picked object will be null.public static final java.lang.String LEFT_CLICK
public static final java.lang.String LEFT_DOUBLE_CLICK
public static final java.lang.String LEFT_PRESS
public static final java.lang.String RIGHT_CLICK
public static final java.lang.String RIGHT_PRESS
public static final java.lang.String ROLLOVER
public SelectEvent(java.lang.Object source, java.lang.String eventAction, java.awt.event.MouseEvent mouseEvent, PickedObjectList pickedObjects)
public SelectEvent(java.lang.Object source, java.lang.String eventAction, java.awt.Point pickPoint, PickedObjectList pickedObjects)
public SelectEvent(java.lang.Object source, java.lang.String eventAction, java.awt.Rectangle pickRectangle, PickedObjectList pickedObjects)
public void consume()
WWEvent
public java.util.List<?> getAllTopObjects()
null
if this event's picked object list is empty, or does not contain
any picked objects marked as on top.null
if
nothing is marked as on top.public java.util.List<PickedObject> getAllTopPickedObjects()
null
if this event's picked object list is empty, or does not contain any picked objects
marked as on top.null
if nothing is marked as on top.public java.lang.String getEventAction()
public java.awt.event.MouseEvent getMouseEvent()
public PickedObjectList getObjects()
public java.awt.Point getPickPoint()
public java.awt.Rectangle getPickRectangle()
public java.lang.Object getTopObject()
public PickedObject getTopPickedObject()
public boolean hasObjects()
public boolean isBoxSelect()
public boolean isDrag()
public boolean isDragEnd()
public boolean isHover()
public boolean isLeftClick()
public boolean isLeftDoubleClick()
public boolean isLeftPress()
public boolean isRightClick()
public boolean isRightPress()
public boolean isRollover()
public java.lang.String toString()
toString
in class java.util.EventObject