public void select(Object o, Layer parentLayer, Position pickPosition) { if (this.selectedAnnotLayer == null) { selectedAnnotLayer = new SelectedAnnotationLayer(); selectedAnnotLayer.setEnabled(true); selectedAnnotLayer.setName("Layers.SelectedFeatureAnnotationLayer"); wwd.getModel().getLayers().add(selectedAnnotLayer); } // if synchronized (selectedAnnotLayer) { // unselect the currently selected object unselect(); // select o if (null != o) { if (o instanceof Annotation) { Annotation ann = (Annotation) o; this.savedAnnotationBorderColor = ann.getAttributes().getBorderColor(); ann.getAttributes().setBorderColor(SELECTED_ANNOTATION_BORDER_COLOR); storeSelection(o, parentLayer); } else if (o instanceof Selectable) { ((Selectable) o).select(this.wwd, this.selectedAnnotLayer, pickPosition); storeSelection(o, parentLayer); } else { Logging.logger().severe("Unsupported object type selected!"); } } } }
public void unselect() { if (null != this.selectedObject) { if (this.selectedObject instanceof Annotation) { ((Annotation) this.selectedObject) .getAttributes() .setBorderColor(this.savedAnnotationBorderColor); storeSelection(null, null); } else if (this.selectedObject instanceof Selectable) { ((Selectable) this.selectedObject).unselect(); selectedAnnotLayer .removeAllAnnotations(); // should not be necessary, but we do this just in case we // forgot to remove some annot. storeSelection(null, null); } else { Logging.logger().severe("Unsupported object type selected!"); } } setStatusText(""); }