public Level2ProductLayer() { this.setName("S-1 Level-2 OCN"); theWWD = null; //dpHighlightAttrs = new BasicShapeAttributes(); //dpHighlightAttrs.setOutlineMaterial(Material.WHITE); //dpHighlightAttrs.setOutlineWidth(2d); // this is copied from gov.nasa.worldwindx.examples.util.LayerManagerLayer theInfoAnnotation = new ScreenAnnotation("", new Point(120, 520)); // 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. theInfoAnnotation.getAttributes().setSize(new Dimension(Integer.MAX_VALUE, 0)); theInfoAnnotation.getAttributes().setAdjustWidthToText(AVKey.SIZE_FIT_TEXT); // Set appearance attributes theInfoAnnotation.getAttributes().setCornerRadius(0); //theInfoAnnotation.getAttributes().setFont(this.font); theInfoAnnotation.getAttributes().setHighlightScale(1); theInfoAnnotation.getAttributes().setTextColor(Color.WHITE); theInfoAnnotation.getAttributes().setBackgroundColor(new Color(0f, 0f, 0f, .5f)); theInfoAnnotation.getAttributes().setInsets(new Insets(6, 6, 6, 6)); theInfoAnnotation.getAttributes().setBorderWidth(1); theInfoAnnotation.getAttributes().setVisible(false); }
public void updateInfoAnnotation(final SelectEvent event) { //SystemUtils.LOG.info("updateInfoAnnotation " + event.getTopObject() + " " + theObjectInfoHash.get(event.getTopObject())); if (event.getEventAction().equals(SelectEvent.ROLLOVER) && theObjectInfoHash.get(event.getTopObject()) != null) { String info = theObjectInfoHash.get(event.getTopObject()); if (event.getTopObject() instanceof DirectedPath) { //SystemUtils.LOG.info("DirectedPath:::"); DirectedPath dp = (DirectedPath) event.getTopObject(); //dp.getAttributes().setOutlineMaterial(Material.WHITE); dp.setHighlighted(true); //dp.setAttributes(productLayer.dpHighlightAttrs); //theSelectedObjectLabel.setText("" + productLayer.theObjectInfoHash.get(dp)); theLastSelectedDP = dp; } theInfoAnnotation.setText(info); theInfoAnnotation.getAttributes().setVisible(true); //SystemUtils.LOG.info("selectedProduct " + getSelectedProduct()); //final ExecCommand command = datApp.getCommandManager().getExecCommand("showPolarWaveView"); //command.execute(2); } else if (event.getEventAction().equals(SelectEvent.LEFT_CLICK) && theSurfaceProductHash.get(event.getTopObject()) != null && theSurfaceSequenceHash.get(event.getTopObject()) != null) { //SystemUtils.LOG.info("click " + event.getTopObject()); OceanSwellTopComponent.setOSWRecord(theSurfaceProductHash.get(event.getTopObject()), theSurfaceSequenceHash.get(event.getTopObject())); } else { if (theLastSelectedDP != null) { theLastSelectedDP.setHighlighted(false); } theInfoAnnotation.getAttributes().setVisible(false); //theSelectedObjectLabel.setText(""); } }
|| event.getEventAction().equals(SelectEvent.LEFT_CLICK)) { if (!annotation.getAttributes().isHighlighted()) { annotation.getAttributes().setHighlighted(true); update = true; } else if (event.getEventAction().equals(SelectEvent.ROLLOVER) && annotation.getAttributes().isHighlighted()) { annotation.getAttributes().setHighlighted(false); ((Component) this.wwd).setCursor(Cursor.getDefaultCursor()); this.update();
this.dragRefPoint = getAnnotation().getScreenPoint(); this.draggingComponent = true;
theInfoAnnotation.setText(text); theInfoAnnotation.getAttributes().setVisible(false);