Exemplo n.º 1
0
  /**
   * Gets the contour levels given a data range.
   *
   * @param minimum The minimum data value. Must be a finite value.
   * @param maximum The maximum data value. Must be a finite value.
   * @return Contour levels appropriate for the given data range. No contour level will lie outside
   *     the range. The levels will be ordered by increasing value.
   * @throws VisADException Invalid range extrema or VisAD failure.
   */
  public synchronized float[] getLevels(float minimum, float maximum) throws VisADException {

    if (Float.isInfinite(minimum)
        || Float.isNaN(minimum)
        || Float.isInfinite(maximum)
        || Float.isNaN(maximum)) {
      throw new VisADException(
          getClass().getName()
              + ".getLevels(float,float): "
              + "Invalid range extrema (max or min is infinite or NaN)");
    }

    float base = getBase();

    return visad.Contour2D.intervalToLevels(interval, minimum, maximum, base, new boolean[1]);
  }
Exemplo n.º 2
0
  /**
   * Sets a VisAD ContourControl.
   *
   * @param control The VisAD ContourControl to be set by this object.
   * @param minimum The minimum value. Shall be a finite value.
   * @param maximum The maximum value. Shall be a finite value.
   * @throws VisADException Invalid range extrema or VisAD failure.
   * @throws RemoteException Java RMI failure.
   */
  public synchronized void setControl(ContourControl control, float minimum, float maximum)
      throws VisADException, RemoteException {

    if (Float.isInfinite(minimum)
        || Float.isNaN(minimum)
        || Float.isInfinite(maximum)
        || Float.isNaN(maximum)) {
      throw new VisADException(
          getClass().getName()
              + ".setControl(ContourControl,float,float): "
              + "Invalid range extrema (max or min is infinite or NaN)");
    }

    // control.setContourInterval(interval, minimum, maximum, getBase());
    control.setLevels(
        visad.Contour2D.intervalToLevels(interval, minimum, maximum, getBase(), new boolean[1]),
        getBase(),
        dash);
  }