当前位置: 首页>>代码示例>>Java>>正文


Java SelectEvent.getTopObject方法代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:21,代码来源:WWGTable.java

示例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());
    }
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:24,代码来源:AbstractTridasAnnotationController.java

示例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);
        }
    };
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:17,代码来源:NwwUtilities.java

示例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();
	}
}
 
开发者ID:iedadata,项目名称:geomapapp,代码行数:36,代码来源:WWFocalMechanismSolutionDB.java

示例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);
    }
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:16,代码来源:AbstractTridasAnnotationController.java

示例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);
        }
    };
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:15,代码来源:ToolTipsUtils.java

示例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);
        }
    }
}
 
开发者ID:ofmooseandmen,项目名称:sherpa,代码行数:12,代码来源:WorldWindowController.java

示例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();
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:82,代码来源:ViewControlsSelectListener.java

示例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();
    }
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:78,代码来源:LayerPanelLayer.java


注:本文中的gov.nasa.worldwind.event.SelectEvent.getTopObject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。