Ejemplo n.º 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;
  }
Ejemplo n.º 3
0
  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);
  }
Ejemplo n.º 4
0
  protected void initialize(DrawContext dc) {
    if (this.initialized) return;

    // Setup user interface - common default attributes
    AnnotationAttributes ca = new AnnotationAttributes();
    ca.setAdjustWidthToText(AVKey.SIZE_FIXED);
    ca.setInsets(new Insets(0, 0, 0, 0));
    ca.setBorderWidth(0);
    ca.setCornerRadius(0);
    ca.setSize(new Dimension(buttonSize, buttonSize));
    ca.setBackgroundColor(new Color(0, 0, 0, 0));
    ca.setImageOpacity(.5);
    ca.setScale(scale);

    final String NOTEXT = "";
    final Point ORIGIN = new Point(0, 0);
    if (this.showPanControls) {
      // Pan
      controlPan = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlPan.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_PAN);
      controlPan.getAttributes().setImageSource(getImageSource(AVKey.VIEW_PAN));
      controlPan.getAttributes().setSize(new Dimension(panSize, panSize));
      this.addRenderable(controlPan);
    }
    if (this.showLookControls) {
      // Look
      controlLook = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlLook.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_LOOK);
      controlLook.getAttributes().setImageSource(getImageSource(AVKey.VIEW_LOOK));
      controlLook.getAttributes().setSize(new Dimension(panSize, panSize));
      this.addRenderable(controlLook);
    }
    if (this.showZoomControls) {
      // Zoom
      controlZoomIn = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlZoomIn.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_ZOOM_IN);
      controlZoomIn.getAttributes().setImageSource(getImageSource(AVKey.VIEW_ZOOM_IN));
      this.addRenderable(controlZoomIn);
      controlZoomOut = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlZoomOut.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_ZOOM_OUT);
      controlZoomOut.getAttributes().setImageSource(getImageSource(AVKey.VIEW_ZOOM_OUT));
      this.addRenderable(controlZoomOut);
    }
    if (this.showHeadingControls) {
      // Heading
      controlHeadingLeft = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlHeadingLeft.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_HEADING_LEFT);
      controlHeadingLeft.getAttributes().setImageSource(getImageSource(AVKey.VIEW_HEADING_LEFT));
      this.addRenderable(controlHeadingLeft);
      controlHeadingRight = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlHeadingRight.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_HEADING_RIGHT);
      controlHeadingRight.getAttributes().setImageSource(getImageSource(AVKey.VIEW_HEADING_RIGHT));
      this.addRenderable(controlHeadingRight);
    }
    if (this.showPitchControls) {
      // Pitch
      controlPitchUp = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlPitchUp.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_PITCH_UP);
      controlPitchUp.getAttributes().setImageSource(getImageSource(AVKey.VIEW_PITCH_UP));
      this.addRenderable(controlPitchUp);
      controlPitchDown = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlPitchDown.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_PITCH_DOWN);
      controlPitchDown.getAttributes().setImageSource(getImageSource(AVKey.VIEW_PITCH_DOWN));
      this.addRenderable(controlPitchDown);
    }
    if (this.showFovControls) {
      // Field of view FOV
      controlFovNarrow = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlFovNarrow.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_FOV_NARROW);
      controlFovNarrow.getAttributes().setImageSource(getImageSource(AVKey.VIEW_FOV_NARROW));
      this.addRenderable(controlFovNarrow);
      controlFovWide = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlFovWide.setValue(AVKey.VIEW_OPERATION, AVKey.VIEW_FOV_WIDE);
      controlFovWide.getAttributes().setImageSource(getImageSource(AVKey.VIEW_FOV_WIDE));
      this.addRenderable(controlFovWide);
    }
    if (this.showVeControls) {
      // Vertical Exaggeration
      controlVeUp = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlVeUp.setValue(AVKey.VIEW_OPERATION, AVKey.VERTICAL_EXAGGERATION_UP);
      controlVeUp.getAttributes().setImageSource(getImageSource(AVKey.VERTICAL_EXAGGERATION_UP));
      this.addRenderable(controlVeUp);
      controlVeDown = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      controlVeDown.setValue(AVKey.VIEW_OPERATION, AVKey.VERTICAL_EXAGGERATION_DOWN);
      controlVeDown
          .getAttributes()
          .setImageSource(getImageSource(AVKey.VERTICAL_EXAGGERATION_DOWN));
      this.addRenderable(controlVeDown);
    }
    if (this.showTrash) {
      trashControl = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
      trashControl.getAttributes().setImageSource(IMAGE_SETTINGS);
      trashControl.getAttributes().setSize(new Dimension(myButtonWidth, myButtonHeight));
      trashControl.setValue(AVKey.VIEW_OPERATION, "trash it");
      this.addRenderable(trashControl);
    }
    //        if (this.showMenu) {
    //        	menuControl = new ScreenAnnotation(NOTEXT, ORIGIN, ca);
    //        	menuControl.getAttributes().setImageSource(IMAGE_SIMPLE_GUI);
    //        	menuControl.getAttributes().setSize(new Dimension(50, 50));
    //        	menuControl.setValue(AVKey.VIEW_OPERATION, "auxiliary");
    //        	this.addRenderable(menuControl);
    //        }

    // Place controls according to layout and viewport dimension
    updatePositions(dc);

    this.initialized = true;
  }