Example #1
0
 /**
  * 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);
 }
  protected AnnotationAttributes getAnnotationPanelAttributes(String annoText) {
    AnnotationAttributes attrs = new AnnotationAttributes();

    attrs.setAdjustWidthToText(AVKey.SIZE_FIXED);
    attrs.setSize(this.computePanelSize(annoText));
    attrs.setFrameShape(AVKey.SHAPE_RECTANGLE);
    attrs.setTextColor(Color.WHITE);
    attrs.setBackgroundColor(new Color(0f, 0f, 0f, 0.6f));
    attrs.setCornerRadius(10);
    attrs.setInsets(new Insets(10, 10, 0, 0));
    attrs.setBorderColor(new Color(0xababab));
    attrs.setFont(Font.decode("Arial-PLAIN-12"));
    attrs.setTextAlign(AVKey.LEFT);

    return attrs;
  }
  protected void setupAnnotationAttributes(Annotation annotation) {
    java.awt.Color transparentBlack = new java.awt.Color(0, 0, 0, 0);

    AnnotationAttributes defaultAttribs = new AnnotationAttributes();
    defaultAttribs.setAdjustWidthToText(AVKey.SIZE_FIXED);
    defaultAttribs.setBackgroundColor(transparentBlack);
    defaultAttribs.setBorderColor(transparentBlack);
    defaultAttribs.setBorderWidth(0);
    defaultAttribs.setCornerRadius(0);
    defaultAttribs.setDrawOffset(new java.awt.Point(0, 0));
    defaultAttribs.setHighlightScale(1);
    defaultAttribs.setInsets(new java.awt.Insets(0, 0, 0, 0));
    defaultAttribs.setImageScale(1);
    defaultAttribs.setImageOffset(new java.awt.Point(0, 0));
    defaultAttribs.setImageOpacity(1);
    defaultAttribs.setImageRepeat(AVKey.REPEAT_NONE);
    defaultAttribs.setLeader(AVKey.SHAPE_NONE);
    defaultAttribs.setSize(new java.awt.Dimension(0, 0));

    annotation.setPickEnabled(false);
    annotation.getAttributes().setDefaults(defaultAttribs);
  }