Пример #1
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);
  }
Пример #2
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;
  }