本文整理汇总了Java中gov.nasa.worldwind.event.SelectEvent.getTopObject方法的典型用法代码示例。如果您正苦于以下问题:Java SelectEvent.getTopObject方法的具体用法?Java SelectEvent.getTopObject怎么用?Java SelectEvent.getTopObject使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.event.SelectEvent
的用法示例。
在下文中一共展示了SelectEvent.getTopObject方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selected
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
public void selected(SelectEvent event) {
if (event.getEventAction().equals(SelectEvent.LEFT_CLICK)) {
Object topObject = event.getTopObject();
int index = 0;
for (DetailedIcon icon : icons) {
if (icon == topObject)
break;
index++;
}
if (index == icons.length)
return;
int j = currentRowsIndices.indexOf( index );
if (j != -1) {
table.getSelectionModel().setSelectionInterval(j, j);
table.ensureIndexIsVisible(j);
}
}
}
示例2: updateCursor
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
protected void updateCursor(SelectEvent e)
{
Object topObject = e.getTopObject();
if (topObject != null && topObject instanceof ButtonAnnotation)
{
this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.HAND_CURSOR));
}
else if (topObject != null && topObject instanceof TellervoAnnotation)
{
if (((TellervoAnnotation) topObject).isBusy())
{
this.setCursor(java.awt.Cursor.getPredefinedCursor(java.awt.Cursor.WAIT_CURSOR));
}
else
{
this.setCursor(java.awt.Cursor.getDefaultCursor());
}
}
else
{
this.setCursor(java.awt.Cursor.getDefaultCursor());
}
}
示例3: addTooltipController
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
public static void addTooltipController( WorldWindow wwd ) {
new ToolTipController(wwd){
@Override
public void selected( SelectEvent event ) {
// Intercept the selected position and assign its display name
// the position's data value.
if (event.getTopObject() instanceof BasicMarkerWithInfo) {
BasicMarkerWithInfo marker = (BasicMarkerWithInfo) event.getTopObject();
String info = marker.getInfo();
marker.setValue(AVKey.DISPLAY_NAME, info);
}
super.selected(event);
}
};
}
示例4: selected
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
public void selected(SelectEvent event) {
if (event.getEventAction().equals(SelectEvent.LEFT_CLICK)) {
Object topObject = event.getTopObject();
int index = 0;
for (DetailedIcon icon : icons) {
if (icon == topObject)
break;
index++;
}
if (index == icons.size())
{
index = 0;
for (Earthquake eq : all)
{
if (eq == topObject)
break;
index++;
}
}
if (pickedItem != -1) {
icons.get(pickedItem).setHighlighted(false);
}
if (index == icons.size())
pickedItem = -1;
else {
pickedItem = index;
icons.get(pickedItem).setHighlighted(true);
}
selectionChanged();
}
}
示例5: updateToolTip
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
protected void updateToolTip(SelectEvent e)
{
if (e.getEventAction() != SelectEvent.HOVER)
return;
Object topObject = e.getTopObject();
if (topObject != null && topObject instanceof ButtonAnnotation)
{
this.showToolTip(e, (ButtonAnnotation) topObject);
}
else
{
this.showToolTip(e, null);
}
}
示例6: addTooltipController
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
public static void addTooltipController(WorldWindow wwd) {
new ToolTipController(wwd) {
@Override
public void selected(SelectEvent event) {
if (event.getTopObject() instanceof BasicMarkerWithInfo) {
BasicMarkerWithInfo marker = (BasicMarkerWithInfo) event.getTopObject();
String info = marker.getInfo();
marker.setValue(AVKey.DISPLAY_NAME, info);
}
super.selected(event);
}
};
}
示例7: selected
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
@Override
public final void selected(final SelectEvent event) {
if (editor.isArmed() && event.isDrag() && event.hasObjects()) {
final Object object = event.getTopObject();
if (SurfacePolygon.class.isInstance(object)) {
editor.moveObstacle(event);
} else if (SurfaceIcon.class.isInstance(object)) {
editor.moveVertex(event);
}
}
}
示例8: selected
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
public void selected(SelectEvent event)
{
if (this.wwd == null)
return;
if (!(this.wwd.getView() instanceof OrbitView))
return;
OrbitView view = (OrbitView) this.wwd.getView();
if (this.viewControlsLayer.getHighlightedObject() != null)
{
this.viewControlsLayer.highlight(null);
this.wwd.redraw(); // must redraw so the de-highlight can take effect
}
if (event.getMouseEvent() != null && event.getMouseEvent().isConsumed())
return;
if (event.getTopObject() == null || event.getTopPickedObject().getParentLayer() != this.getParentLayer()
|| !(event.getTopObject() instanceof AVList))
return;
String controlType = ((AVList) event.getTopObject()).getStringValue(AVKey.VIEW_OPERATION);
if (controlType == null)
return;
ScreenAnnotation selectedObject = (ScreenAnnotation) event.getTopObject();
this.lastPickPoint = event.getPickPoint();
if (event.getEventAction().equals(SelectEvent.ROLLOVER))
{
// Highlight on rollover
this.viewControlsLayer.highlight(selectedObject);
this.wwd.redraw();
}
if (event.getEventAction().equals(SelectEvent.DRAG))
{
// just consume drag events
event.consume();
}
else if (event.getEventAction().equals(SelectEvent.HOVER))
{
// Highlight on hover
this.viewControlsLayer.highlight(selectedObject);
this.wwd.redraw();
}
else if (event.getEventAction().equals(SelectEvent.LEFT_PRESS) ||
(event.getEventAction().equals(SelectEvent.DRAG) && controlType.equals(AVKey.VIEW_PAN)) ||
(event.getEventAction().equals(SelectEvent.DRAG) && controlType.equals(AVKey.VIEW_LOOK)))
{
// Handle left press on controls
this.pressedControl = selectedObject;
this.pressedControlType = controlType;
// Consume drag events, but do not consume left press events. It is not necessary to consume left press
// events here, and doing so prevents the WorldWindow from gaining focus.
if (event.getEventAction().equals(SelectEvent.DRAG))
event.consume();
}
else if (event.getEventAction().equals(SelectEvent.LEFT_CLICK)
|| event.getEventAction().equals(SelectEvent.LEFT_DOUBLE_CLICK)
|| event.getEventAction().equals(SelectEvent.DRAG_END))
{
// Release pressed control
if (pressedControl != null)
event.consume();
this.pressedControl = null;
resetOrbitView(view);
view.firePropertyChange(AVKey.VIEW, null, view);
}
// Keep pressed control highlighted - overrides rollover non currently pressed controls
if (this.pressedControl != null)
{
this.viewControlsLayer.highlight(this.pressedControl);
this.wwd.redraw();
}
}
示例9: selected
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
/**
* <code>SelectListener</code> implementation.
*
* @param event the current <code>SelectEvent</code>
*/
@Override
public void selected(SelectEvent event) {
//System.out.println("event.getEventAction(): " + event.getEventAction());
final ScreenAnnotation annotation = getAnnotation();
if (event.hasObjects() && event.getTopObject() == annotation) {
boolean update = false;
if (event.getEventAction().equals(SelectEvent.ROLLOVER)
|| event.getEventAction().equals(SelectEvent.LEFT_CLICK)) {
// Highlight annotation
if (!annotation.getAttributes().isHighlighted()) {
annotation.getAttributes().setHighlighted(true);
update = true;
}
// Check for text or url
final PickedObject po = event.getTopPickedObject();
if (po.getValue(AVKey.URL) != null) {
// Set cursor hand on hyperlinks
((Component) this.wwd).setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
int i = Integer.parseInt((String) po.getValue(AVKey.URL));
// Select current hyperlink
if (getSelectedIndex() != i) {
setSelectedIndex(i);
update = true;
}
// Enable/disable layer on left click
if (event.getEventAction().equals(SelectEvent.LEFT_CLICK)) {
final LayerList layers = getValidLayers();
if (i >= 0 && i < layers.size()) {
final Layer layer = layers.get(i);
final boolean enable = !layer.isEnabled();
layer.setEnabled(enable);
updateVirtualEarthLayers(layer, enable);
update = true;
}
}
} else {
// Unselect if not on an hyperlink
if (getSelectedIndex() != -1) {
setSelectedIndex(-1);
update = true;
}
// Set cursor
if (this.isComponentDragEnabled())
((Component) this.wwd).setCursor(Cursor.getPredefinedCursor(Cursor.MOVE_CURSOR));
else
((Component) this.wwd).setCursor(Cursor.getDefaultCursor());
}
}
if (event.getEventAction().equals(SelectEvent.DRAG)
|| event.getEventAction().equals(SelectEvent.DRAG_END)) {
// Handle dragging
if (this.isComponentDragEnabled() || this.isLayerDragEnabled()) {
final boolean wasDraggingLayer = this.draggingLayer;
this.drag(event);
// Update list if dragging a layer, otherwise just redraw the world window
if (this.draggingLayer || wasDraggingLayer)
update = true;
else
this.wwd.redraw();
}
}
// Redraw annotation if needed
if (update)
this.update();
} else if (event.getEventAction().equals(SelectEvent.ROLLOVER) && annotation.getAttributes().isHighlighted()) {
// de-highlight annotation
annotation.getAttributes().setHighlighted(false);
((Component) this.wwd).setCursor(Cursor.getDefaultCursor());
this.update();
}
}