@Override public void setSurfShapeColor(String id, Color col, double opacity) throws NoSuchShapeException { SurfaceShape shape = getSurfShape(id); BasicShapeAttributes newAttr = new BasicShapeAttributes(attr); newAttr.setOutlineMaterial(new Material(col)); newAttr.setInteriorMaterial(new Material(col.brighter().brighter())); newAttr.setOutlineOpacity(opacity); newAttr.setInteriorOpacity(NORM_INSIDE_OPACITY * opacity); shape.setAttributes(newAttr); }
/** * Initializing constructor. * * @param name the name of this layer */ public SurfShapesLayer(String name) { // properties of layer setName(name); setEnabled(true); // painting attributes for shapes attr.setOutlineMaterial(Material.ORANGE); attr.setOutlineWidth(1.5); Material intMat = new Material(Color.ORANGE.brighter().brighter()); attr.setInteriorMaterial(intMat); attr.setInteriorOpacity(NORM_INSIDE_OPACITY); // painting attributes for hihglighted shapes attrHigh.setOutlineMaterial(Material.BLACK); attrHigh.setOutlineWidth(2); attrHigh.setInteriorMaterial(Material.WHITE); attrHigh.setInteriorOpacity(HIGHL_INSIDE_OPACITY); // popup annotation attributes AnnotationAttributes attrAnno = new AnnotationAttributes(); attrAnno.setAdjustWidthToText(AVKey.SIZE_FIT_TEXT); attrAnno.setFrameShape(AVKey.SHAPE_RECTANGLE); attrAnno.setCornerRadius(3); attrAnno.setDrawOffset(new Point(0, 8)); attrAnno.setLeaderGapWidth(8); attrAnno.setTextColor(Color.BLACK); attrAnno.setBackgroundColor(new Color(1f, 1f, 1f, .85f)); attrAnno.setBorderColor(new Color(0xababab)); attrAnno.setInsets(new Insets(3, 3, 3, 3)); attrAnno.setVisible(false); popupAnnotation.setAttributes(attrAnno); popupAnnotation.setAlwaysOnTop(true); addRenderable(popupAnnotation); }
@Override public void setHighlightOpacity(double opacity) { attrHigh.setOutlineOpacity(opacity); attrHigh.setInteriorOpacity(HIGHL_INSIDE_OPACITY * opacity); }
@Override public double getHighlightOpacity() { return attrHigh.getOutlineOpacity(); }
@Override public void setHighlightColor(Color col) { attrHigh.setOutlineMaterial(new Material(col)); attrHigh.setInteriorMaterial(new Material(col.brighter().brighter())); }
@Override public Color getHighlightColor() { return attrHigh.getOutlineMaterial().getDiffuse(); }
@Override public void setOpacity(double opacity) { attr.setOutlineOpacity(opacity); attr.setInteriorOpacity(NORM_INSIDE_OPACITY * opacity); }
@Override public double getOpacity() { return attr.getOutlineOpacity(); }