Exemplo n.º 1
0
 /**
  * Change underscore characters (_) in the Scalar name to blanks. Can be used to change the
  * displayed scalar name on the axis.
  *
  * @param u2b true to change, false to change back
  * @see #setScalarName as an alternative
  */
 public void setUnderscoreToBlank(boolean u2b) {
   underscore_to_blank = u2b;
   if (Scalar != null) {
     scalarName = Scalar.getName();
     if (underscore_to_blank) {
       scalarName = scalarName.replace('_', ' ');
     }
     // set the label on the scale as well.  DRM 17-Nov-2000
     if (axisScale != null) axisScale.setTitle(scalarName);
   }
 }
Exemplo n.º 2
0
 /**
  * Set color of axis scales; color must be float[3] with red,
  * green and blue components; DisplayScalar must be XAxis,
  * YAxis or ZAxis.  Preferred method is to use <CODE>AxisScale.setColor<CODE>
  * methods.
  * @param  color  array of R,G,B values of color.
  * @throws  VisADException  non-spatial DisplayScalar or wrong length
  *                          of color array
  * @see #getAxisScale()
  * @see visad.AxisScale#setColor(Color color)
  * @see visad.AxisScale#setColor(float[] color)
  */
 public void setScaleColor(float[] color) throws VisADException {
   if (!DisplayScalar.equals(Display.XAxis)
       && !DisplayScalar.equals(Display.YAxis)
       && !DisplayScalar.equals(Display.ZAxis)) {
     throw new DisplayException(
         "ScalarMap.setScaleColor: DisplayScalar " + "must be XAxis, YAxis or ZAxis");
   }
   if (color == null || color.length != 3) {
     throw new DisplayException("ScalarMap.setScaleColor: color is " + "null or wrong length");
   }
   // DRM 10-Oct 2000
   axisScale.setColor(color);
 }
Exemplo n.º 3
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.º 4
0
 /**
  * Create the scale that is displayed. This is called automatically when <CODE>setRange(lo, hi)
  * </CODE> and <CODE>setDisplay</CODE> are called. It makes a call to <CODE>AxisScale.makeScale()
  * </CODE> where the actual hard work is done.
  *
  * @throws VisADException VisAD error.
  */
 public void makeScale() throws VisADException {
   if (axisScale != null) {
     DisplayRenderer displayRenderer = null;
     if (display == null) return;
     displayRenderer = display.getDisplayRenderer();
     if (displayRenderer == null) return;
     boolean scaleMade = axisScale.makeScale();
     if (scaleMade) {
       // displayRenderer.setScale(axis, axis_ordinal, array, scale_color);
       if (scale_on) {
         displayRenderer.setScale(axisScale);
       } else {
         displayRenderer.clearScale(axisScale);
       }
       scale_flag = false;
     }
   }
 }
Exemplo n.º 5
0
 protected void copy(ScalarMap map) throws VisADException, RemoteException {
   map.isScaled = isScaled;
   map.isManual = isManual;
   map.dataRange[0] = dataRange[0];
   map.dataRange[1] = dataRange[1];
   map.defaultUnitRange[0] = defaultUnitRange[0];
   map.defaultUnitRange[1] = defaultUnitRange[1];
   map.displayRange[0] = displayRange[0];
   map.displayRange[1] = displayRange[1];
   map.scale = scale;
   map.offset = offset;
   map.axisScale = (axisScale != null) ? axisScale.clone(map) : null;
   map.scale_flag = scale_flag;
   map.back_scale_flag = back_scale_flag;
   if (map.display != null) {
     map.setControl();
   }
 }
Exemplo n.º 6
0
 /**
  * Enable the display of the scale for this map. This can be used to selectively turn on or off
  * the scales in a display. Must be used in conjunction with <CODE>
  * GraphicsModeControl.setScaleEnable()</CODE> or <CODE>DisplayRenderer.setScaleOn(boolean on)
  * </CODE>.
  *
  * @param on true will enable display of axis, false will disable display
  * @see visad.GraphicsModeControl#setScaleEnable(boolean enable)
  * @see visad.DisplayRenderer#setScaleOn(boolean on)
  * @see visad.AxisScale#setVisible(boolean visible)
  */
 public void setScaleEnable(boolean on) {
   scale_on = on;
   if (axisScale != null) axisScale.setVisible(on);
 }
Exemplo n.º 7
0
 /**
  * Set the name being used on the axis scale.
  *
  * @param name new name for the scalar.
  * @see AxisScale#setTitle(String name)
  */
 public void setScalarName(String name) {
   scalarName = name;
   if (axisScale != null) axisScale.setTitle(scalarName);
 }