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


Java ScreenAnnotation类代码示例

本文整理汇总了Java中gov.nasa.worldwind.render.ScreenAnnotation的典型用法代码示例。如果您正苦于以下问题:Java ScreenAnnotation类的具体用法?Java ScreenAnnotation怎么用?Java ScreenAnnotation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ScreenAnnotation类属于gov.nasa.worldwind.render包,在下文中一共展示了ScreenAnnotation类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: highlightAnnotation

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
/**
 * Highlight the given annotation
 *
 * @param annotation
 * @param point
 */
private void highlightAnnotation(final LabeledPath label, final GeoPoint point) {
	final ScreenAnnotation annotation = label.getAnnotation();
	if (_lastSelection != null) {
		final LabeledPath lastSelectedLabel = _lastSelection.getLeft();
		final ScreenAnnotation lastSelectedAnnotation = lastSelectedLabel.getAnnotation();
		final GeoPoint lastSelectedPoint = _lastSelection.getRight();
		if (_mapShowLabel) {
			lastSelectedAnnotation.setAttributes(createAnnotationAttr(false, lastSelectedPoint.getCountryFlag(IMAGE_RESOLUTION), getText(lastSelectedPoint)));
			lastSelectedAnnotation.setAlwaysOnTop(false);
		} else {
			_renderableLayer.removeRenderable(lastSelectedLabel);
		}
	}
	final ImageIcon image = point.getCountryFlag(IMAGE_RESOLUTION);
	final String text = getText(point);
	annotation.setAttributes(createAnnotationAttr(true, image, text));
	annotation.setAlwaysOnTop(true);
	if (!_mapShowLabel) {
		_renderableLayer.addRenderable(label);
		_controller.redraw();
	}
	_lastSelection = Pair.of(label, point);
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:30,代码来源:WWJPanel.java

示例2: initComponents

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected void initComponents()
{
	this.titleLabel = new ScreenAnnotation("", new java.awt.Point());
	this.setupTitle(this.titleLabel);
	
	this.timestampLabel = new ScreenAnnotation("", new java.awt.Point());
	this.setupLabel(this.timestampLabel);
	
    this.closeButton = new ButtonAnnotation(CLOSE_IMAGE_PATH, PIXEL16_MASK_PATH);
    this.closeButton.setActionCommand(AVKey.CLOSE);
    this.closeButton.addActionListener(this);
    this.closeButton.setToolTipText(CLOSE_TOOLTIP_TEXT);
    
    this.searchForSeries = new ButtonAnnotation(Builder.getIconURL("searchforseries.png", Builder.ICONS, 32), null);
    this.searchForSeries.setActionCommand("searchForSeries");
    this.searchForSeries.addActionListener(this);
    this.searchForSeries.setToolTipText(SEARCHFORSERIES_TOOLTIP_TEXT);
   
    this.viewMetadata = new ButtonAnnotation(Builder.getIconURL("viewmetadata.png", Builder.ICONS, 32), null);
    this.viewMetadata.setActionCommand("viewMetadata");
    this.viewMetadata.addActionListener(this);
    this.viewMetadata.setToolTipText(VIEWMETADATA_TOOLTIP_TEXT);
    
   // this.busyImage = new BusyImage(BUSY_IMAGE_PATH);   
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:26,代码来源:TridasAnnotation.java

示例3: initialize

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected void initialize()
{
    // Set up screen annotation that will display the layer list
    this.annotation = new ScreenAnnotation("", new Point(0, 0));

    // Set annotation so that it will not force text to wrap (large width) and will adjust it's width to
    // that of the text. A height of zero will have the annotation height follow that of the text too.
    this.annotation.getAttributes().setSize(new Dimension(Integer.MAX_VALUE, 0));
    this.annotation.getAttributes().setAdjustWidthToText(Annotation.SIZE_FIT_TEXT);

    // Set appearance attributes
    this.annotation.getAttributes().setCornerRadius(0);
    this.annotation.getAttributes().setFont(this.font);
    this.annotation.getAttributes().setHighlightScale(1);
    this.annotation.getAttributes().setTextColor(Color.WHITE);
    this.annotation.getAttributes().setBackgroundColor(new Color(0f, 0f, 0f, .5f));
    this.annotation.getAttributes().setInsets(new Insets(6, 6, 6, 6));
    this.annotation.getAttributes().setBorderWidth(1);
    this.addRenderable(this.annotation);

    // Listen to world window for select event
    this.wwd.addSelectListener(this);
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:24,代码来源:TellervoLayerManagerLayer.java

示例4: computePanAmount

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected Angle computePanAmount(Globe globe, OrbitView view, ScreenAnnotation control, double panStep)
{
    // Compute last pick point distance relative to pan control center
    double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
    Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
    double px = lastPickPoint.x - center.x;
    double py = view.getViewport().getHeight() - lastPickPoint.y - center.y;
    double pickDistance = Math.sqrt(px * px + py * py);
    double pickDistanceFactor = Math.min(pickDistance / 10, 5);

    // Compute globe angular distance depending on eye altitude
    Position eyePos = view.getEyePosition();
    double radius = globe.getRadiusAt(eyePos);
    double minValue = 0.5 * (180.0 / (Math.PI * radius)); // Minimum change ~0.5 meters
    double maxValue = 1.0; // Maximum change ~1 degree

    // Compute an interpolated value between minValue and maxValue, using (eye altitude)/(globe radius) as
    // the interpolant. Interpolation is performed on an exponential curve, to keep the value from
    // increasing too quickly as eye altitude increases.
    double a = eyePos.getElevation() / radius;
    a = (a < 0 ? 0 : (a > 1 ? 1 : a));
    double expBase = 2.0; // Exponential curve parameter.
    double value = minValue + (maxValue - minValue) * ((Math.pow(expBase, a) - 1.0) / (expBase - 1.0));

    return Angle.fromDegrees(value * pickDistanceFactor * panStep);
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:27,代码来源:ViewControlsSelectListener.java

示例5: highlight

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
/**
 * Specifies the control to highlight. Any currently highlighted control is un-highlighted.
 *
 * @param control the control to highlight.
 */
public void highlight(Object control)
{
    // Manage highlighting of controls.
    if (this.currentControl == control)
        return; // same thing selected

    // Turn off highlight if on.
    if (this.currentControl != null)
    {
        this.currentControl.getAttributes().setImageOpacity(-1); // use default opacity
        this.currentControl = null;
    }

    // Turn on highlight if object selected.
    if (control != null && control instanceof ScreenAnnotation)
    {
        this.currentControl = (ScreenAnnotation) control;
        this.currentControl.getAttributes().setImageOpacity(1);
    }
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:26,代码来源:ViewControlsLayer.java

示例6: makeLabelAnnotation

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
/**
 * Make screen annotation
 *
 * @param text text
 * @param image image
 * @return the annotation
 */
private ScreenAnnotation makeLabelAnnotation(final String text, final ImageIcon image) {
	final String normalizedText = text == null ? " " : text;
	final ScreenAnnotation screenAnnotation = new ScreenAnnotation(normalizedText, new Point());
	screenAnnotation.setAttributes(createAnnotationAttr(false, image, normalizedText));
	screenAnnotation.setPickEnabled(true);
	return screenAnnotation;
}
 
开发者ID:leolewis,项目名称:openvisualtraceroute,代码行数:15,代码来源:WWJPanel.java

示例7: computePanHeading

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected Angle computePanHeading(OrbitView view, ScreenAnnotation control)
{
    // Compute last pick point 'heading' relative to pan control center
    double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
    Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
    double px = lastPickPoint.x - center.x;
    double py = view.getViewport().getHeight() - lastPickPoint.y - center.y;
    Angle heading = view.getHeading().add(Angle.fromRadians(Math.atan2(px, py)));
    heading = heading.degrees >= 0 ? heading : heading.addDegrees(360);
    return heading;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:12,代码来源:ViewControlsSelectListener.java

示例8: computeLookHeading

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected Angle computeLookHeading(OrbitView view, ScreenAnnotation control, double headingStep)
{
    // Compute last pick point 'heading' relative to look control center on x
    double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
    Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
    double px = lastPickPoint.x - center.x;
    double pickDistanceFactor = Math.min(Math.abs(px) / 3000, 5) * Math.signum(px);
    // New heading
    Angle heading = view.getHeading().add(Angle.fromRadians(headingStep * pickDistanceFactor));
    heading = heading.degrees >= 0 ? heading : heading.addDegrees(360);
    return heading;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:13,代码来源:ViewControlsSelectListener.java

示例9: computeLookPitch

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected Angle computeLookPitch(OrbitView view, ScreenAnnotation control, double pitchStep)
{
    // Compute last pick point 'pitch' relative to look control center on y
    double size = control.getAttributes().getSize().width * control.getAttributes().getScale();
    Vec4 center = new Vec4(control.getScreenPoint().x, control.getScreenPoint().y + size / 2, 0);
    double py = view.getViewport().getHeight() - lastPickPoint.y - center.y;
    double pickDistanceFactor = Math.min(Math.abs(py) / 3000, 5) * Math.signum(py);
    // New pitch
    Angle pitch = view.getPitch().add(Angle.fromRadians(pitchStep * pickDistanceFactor));
    pitch = pitch.degrees >= 0 ? (pitch.degrees <= 90 ? pitch : Angle.fromDegrees(90)) : Angle.ZERO;
    return pitch;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:13,代码来源:ViewControlsSelectListener.java

示例10: getControlType

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
/**
 * Get the control type associated with the given object or null if unknown.
 *
 * @param control the control object
 *
 * @return the control type. Can be one of {@link AVKey#VIEW_PAN}, {@link AVKey#VIEW_LOOK}, {@link
 *         AVKey#VIEW_HEADING_LEFT}, {@link AVKey#VIEW_HEADING_RIGHT}, {@link AVKey#VIEW_ZOOM_IN}, {@link
 *         AVKey#VIEW_ZOOM_OUT}, {@link AVKey#VIEW_PITCH_UP}, {@link AVKey#VIEW_PITCH_DOWN}, {@link
 *         AVKey#VIEW_FOV_NARROW} or {@link AVKey#VIEW_FOV_WIDE}. <p> Returns null if the object is not a view
 *         control associated with this layer. </p>
 */
public String getControlType(Object control)
{
    if (control == null || !(control instanceof ScreenAnnotation))
        return null;

    if (showPanControls && controlPan.equals(control))
        return AVKey.VIEW_PAN;
    else if (showLookControls && controlLook.equals(control))
        return AVKey.VIEW_LOOK;
    else if (showHeadingControls && controlHeadingLeft.equals(control))
        return AVKey.VIEW_HEADING_LEFT;
    else if (showHeadingControls && controlHeadingRight.equals(control))
        return AVKey.VIEW_HEADING_RIGHT;
    else if (showZoomControls && controlZoomIn.equals(control))
        return AVKey.VIEW_ZOOM_IN;
    else if (showZoomControls && controlZoomOut.equals(control))
        return AVKey.VIEW_ZOOM_OUT;
    else if (showPitchControls && controlPitchUp.equals(control))
        return AVKey.VIEW_PITCH_UP;
    else if (showPitchControls && controlPitchDown.equals(control))
        return AVKey.VIEW_PITCH_DOWN;
    else if (showFovControls && controlFovNarrow.equals(control))
        return AVKey.VIEW_FOV_NARROW;
    else if (showFovControls && controlFovWide.equals(control))
        return AVKey.VIEW_FOV_WIDE;
    else if (showVeControls && controlVeUp.equals(control))
        return AVKey.VERTICAL_EXAGGERATION_UP;
    else if (showVeControls && controlVeDown.equals(control))
        return AVKey.VERTICAL_EXAGGERATION_DOWN;

    return null;
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:44,代码来源:ViewControlsLayer.java

示例11: layoutComponents

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
protected void layoutComponents()
{
	titleLabel.setText(getTitleContent());
	
    AnnotationAttributes attribs = timestampLabel.getAttributes();
    attribs.setTextAlign(AVKey.LEFT);
	timestampLabel.setText(getTimestampContent());
	
    AnnotationNullLayout layout = new AnnotationNullLayout();
    this.setLayout(layout);
    closeButton.setEnabled(true);
    
   // this.addChild(this.busyImage);
    this.addChild(this.closeButton);
   // layout.setConstraint(this.busyImage, AVKey.NORTHWEST);
    layout.setConstraint(this.closeButton, AVKey.NORTHEAST);
    layout.setConstraint(titleLabel, AVKey.NORTH);       
    
    Annotation contentContainer = new ScreenAnnotation("", new java.awt.Point());
    {
        this.setupContainer(contentContainer);
        contentContainer.setLayout(new AnnotationFlowLayout(AVKey.VERTICAL, AVKey.LEFT, 15, 30	)); // hgap, vgap
        
        contentContainer.addChild(this.titleLabel);
        
        Annotation buttonContainer = new ScreenAnnotation("", new java.awt.Point());
        setupLabel(buttonContainer);
        buttonContainer.setLayout(new AnnotationFlowLayout(AVKey.HORIZONTAL, AVKey.CENTER, 30, 5)); // hgap, vgap
        buttonContainer.addChild(this.searchForSeries);
        buttonContainer.addChild(this.viewMetadata);
        
        contentContainer.addChild(buttonContainer);
        contentContainer.addChild(this.timestampLabel);
        
    }

    this.addChild(contentContainer);
    

    
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:42,代码来源:TridasAnnotation.java

示例12: selected

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的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

示例13: selected

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的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

示例14: getAnnotation

import gov.nasa.worldwind.render.ScreenAnnotation; //导入依赖的package包/类
/**
 * Get the <code>ScreenAnnotation</code> used to display the layer list.
 *
 * @return the <code>ScreenAnnotation</code> used to display the layer list.
 */
public ScreenAnnotation getAnnotation()
{
    return this.annotation;
}
 
开发者ID:ltrr-arizona-edu,项目名称:tellervo,代码行数:10,代码来源:TellervoLayerManagerLayer.java


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