本文整理汇总了Java中gov.nasa.worldwind.event.SelectEvent.hasObjects方法的典型用法代码示例。如果您正苦于以下问题:Java SelectEvent.hasObjects方法的具体用法?Java SelectEvent.hasObjects怎么用?Java SelectEvent.hasObjects使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.event.SelectEvent
的用法示例。
在下文中一共展示了SelectEvent.hasObjects方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
}
示例2: 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();
}
}