Exemplo n.º 1
0
 /** set tickFlag according to OldTick and NewTick */
 public synchronized void setTicks() {
   tickFlag = (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
   /*
   System.out.println(Scalar + " -> " + DisplayScalar +
                      "  set  tickFlag = " + tickFlag);
   */
   OldTick = NewTick;
   if (control != null) control.setTicks();
 }
Exemplo n.º 2
0
  /**
   * Clear the link to the VisAD display. This will subsequently cause {@link #getDisplay()} and
   * {@link #getControl()} to return <code>null</code>; consequently, information stored in the
   * Control might have to be reestablished. This method invokes the method {@link
   * ScalarMapListener#controlChanged(ScalarMapControlEvent)} on all registered {@link
   * ScalarMapListener}s with this instance as the event source, {@link
   * ScalarMapEvent#CONTROL_REMOVED} as the event ID, and the control as the event control.
   *
   * @throws RemoteException Java RMI failure
   * @throws VisADException VisAD failure
   */
  synchronized void nullDisplay() throws RemoteException, VisADException {
    if (control != null) {
      control.nullControl();
      ScalarMapControlEvent evt;
      evt = new ScalarMapControlEvent(this, ScalarMapEvent.CONTROL_REMOVED, control);
      notifyCtlListeners(evt);
    }
    control = null;

    display = null;
    ScalarIndex = -1;
    DisplayScalarIndex = -1;
    scale_flag = back_scale_flag;

    if (axisScale != null) axisScale.setAxisOrdinal(-1);
  }
Exemplo n.º 3
0
 /** return true if application called setRange */
 public synchronized boolean checkTicks(DataRenderer r, DataDisplayLink link) {
   if (control == null) {
     /*
     System.out.println(Scalar + " -> " + DisplayScalar + "  check  tickFlag = " +
                        tickFlag);
     */
     return tickFlag;
   } else {
     /*
     boolean cflag = control.checkTicks(r, link);
     System.out.println(Scalar + " -> " + DisplayScalar + "  check  tickFlag = " +
                        tickFlag + " cflag = " + cflag);
     */
     return tickFlag || control.checkTicks(r, link);
   }
 }
Exemplo n.º 4
0
 public synchronized boolean peekTicks(DataRenderer r, DataDisplayLink link) {
   if (control == null) {
     /*
     boolean flag = (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
     if (flag) {
       System.out.println(Scalar + " -> " + DisplayScalar + "  peek  flag = " + flag);
     }
     */
     return (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
   } else {
     /*
     boolean flag = (OldTick < NewTick || (NewTick < 0 && 0 < OldTick));
     boolean cflag = control.peekTicks(r, link);
     if (flag || cflag) {
       System.out.println(Scalar + " -> " + DisplayScalar + "  peek   flag = " +
                          flag + " cflag = " + cflag);
     }
     */
     return (OldTick < NewTick || (NewTick < 0 && 0 < OldTick)) || control.peekTicks(r, link);
   }
 }
Exemplo n.º 5
0
 /** reset tickFlag */
 synchronized void resetTicks() {
   // System.out.println(Scalar + " -> " + DisplayScalar + "  reset");
   tickFlag = false;
   if (control != null) control.resetTicks();
 }
Exemplo n.º 6
0
  /**
   * Copy the state of a remote control to this control
   *
   * @param rmt remote control to sync with this one
   * @throws VisADException rmt == null or rmt is not a GraphicsModeControlJ3D or couldn't tell if
   *     control was changed.
   */
  public void syncControl(Control rmt) throws VisADException {
    if (rmt == null) {
      throw new VisADException(
          "Cannot synchronize " + getClass().getName() + " with null Control object");
    }

    if (!(rmt instanceof GraphicsModeControlJ3D)) {
      throw new VisADException(
          "Cannot synchronize " + getClass().getName() + " with " + rmt.getClass().getName());
    }

    GraphicsModeControlJ3D rmtCtl = (GraphicsModeControlJ3D) rmt;

    boolean changed = false;
    boolean redisplay = false;

    if (!Util.isApproximatelyEqual(lineWidth, rmtCtl.lineWidth)) {
      changed = true;
      redisplay = true;
      lineWidth = rmtCtl.lineWidth;
    }
    if (!Util.isApproximatelyEqual(pointSize, rmtCtl.pointSize)) {
      changed = true;
      redisplay = true;
      pointSize = rmtCtl.pointSize;
    }

    if (pointMode != rmtCtl.pointMode) {
      changed = true;
      redisplay = true;
      pointMode = rmtCtl.pointMode;
    }
    if (textureEnable != rmtCtl.textureEnable) {
      changed = true;
      redisplay = true;
      textureEnable = rmtCtl.textureEnable;
    }
    if (scaleEnable != rmtCtl.scaleEnable) {
      changed = true;
      getDisplayRenderer().setScaleOn(scaleEnable);
      scaleEnable = rmtCtl.scaleEnable;
    }

    if (transparencyMode != rmtCtl.transparencyMode) {
      changed = true;
      redisplay = true;
      transparencyMode = rmtCtl.transparencyMode;
    }

    if (adjustProjectionSeam != rmtCtl.adjustProjectionSeam) {
      changed = true;
      redisplay = true;
      adjustProjectionSeam = rmtCtl.adjustProjectionSeam;
    }

    if (texture3DMode != rmtCtl.texture3DMode) {
      changed = true;
      redisplay = true;
      texture3DMode = rmtCtl.texture3DMode;
    }

    if (cacheAppearances != rmtCtl.cacheAppearances) {
      changed = true;
      cacheAppearances = rmtCtl.cacheAppearances;
    }

    if (mergeGeometries != rmtCtl.mergeGeometries) {
      changed = true;
      mergeGeometries = rmtCtl.mergeGeometries;
    }

    if (projectionPolicy != rmtCtl.projectionPolicy) {
      changed = true;
      redisplay = true;
      projectionPolicy = rmtCtl.projectionPolicy;

      DisplayRendererJ3D displayRenderer;
      displayRenderer = (DisplayRendererJ3D) getDisplayRenderer();
      if (displayRenderer != null) {
        displayRenderer.getView().setProjectionPolicy(projectionPolicy);
      }
    }
    if (polygonMode != rmtCtl.polygonMode) {
      changed = true;
      polygonMode = rmtCtl.polygonMode;
    }

    if (missingTransparent != rmtCtl.missingTransparent) {
      changed = true;
      missingTransparent = rmtCtl.missingTransparent;
    }

    if (curvedSize != rmtCtl.curvedSize) {
      changed = true;
      curvedSize = rmtCtl.curvedSize;
    }

    if (!Util.isApproximatelyEqual(polygonOffset, rmtCtl.polygonOffset)) {
      changed = true;
      polygonOffset = rmtCtl.polygonOffset;
    }

    if (!Util.isApproximatelyEqual(polygonOffsetFactor, rmtCtl.polygonOffsetFactor)) {
      changed = true;
      polygonOffsetFactor = rmtCtl.polygonOffsetFactor;
    }

    if (anti_alias_flag != rmtCtl.anti_alias_flag) {
      changed = true;
      anti_alias_flag = rmtCtl.anti_alias_flag;
    }

    if (colorMode != rmtCtl.colorMode) {
      changed = true;
      colorMode = rmtCtl.colorMode;
    }

    if (lineStyle != rmtCtl.lineStyle) {
      changed = true;
      lineStyle = rmtCtl.lineStyle;
    }

    if (changed) {
      try {
        changeControl(true);
      } catch (RemoteException re) {
        throw new VisADException(
            "Could not indicate that control" + " changed: " + re.getMessage());
      }
    }
    if (redisplay) {
      getDisplay().reDisplayAll();
    }
  }