本文整理汇总了Java中gov.nasa.worldwind.event.SelectEvent.consume方法的典型用法代码示例。如果您正苦于以下问题:Java SelectEvent.consume方法的具体用法?Java SelectEvent.consume怎么用?Java SelectEvent.consume使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gov.nasa.worldwind.event.SelectEvent
的用法示例。
在下文中一共展示了SelectEvent.consume方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: moveVertex
import gov.nasa.worldwind.event.SelectEvent; //导入方法依赖的package包/类
public final void moveVertex(final SelectEvent event) {
final LatLon vertex = ((SurfaceIcon) event.getTopObject()).getLocation();
final List<LatLon> locations = obstacle.locations();
final int vIndex = locations.indexOf(vertex);
if (vIndex != -1) {
locations.set(vIndex, wwd.getCurrentPosition());
obstacle.setLocations(locations);
event.consume();
fireObstacleChanged();
}
}
示例2: 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();
}
}