Esempio n. 1
0
  /**
   * set aspect ratio of XAxis, YAxis & ZAxis in ScalarMaps rather than matrix (i.e., don't distort
   * text fonts); won't work for spherical, polar, cylindrical coordinates
   *
   * @param aspect ratios; 3 elements for Java3D, 2 for Java2D
   * @throws VisADException a VisAD error occurred
   * @throws RemoteException an RMI error occurred
   */
  void setAspectCartesian(double[] aspect) throws VisADException, RemoteException {
    double asp = Double.NaN;
    if (DisplayScalar.equals(Display.XAxis)) asp = aspect[0];
    if (DisplayScalar.equals(Display.YAxis)) asp = aspect[1];
    if (DisplayScalar.equals(Display.ZAxis)) asp = aspect[2];
    if (asp == asp) {
      isScaled = DisplayScalar.getRange(displayRange);
      displayRange[0] *= asp;
      displayRange[1] *= asp;
      computeScaleAndOffset();

      makeScale();
      // needs work in AxisScale ****
    }
    // note XAxis, YAxis and ZAxis have no unit, so cannot be setRangeByUnits()
  }
Esempio n. 2
0
 ScalarMap(ScalarType scalar, DisplayRealType display_scalar, boolean needNonNullScalar)
     throws VisADException {
   if (scalar == null && needNonNullScalar) {
     throw new DisplayException("ScalarMap: scalar is null");
   }
   if (display_scalar == null) {
     throw new DisplayException("ScalarMap: display_scalar is null");
   }
   if (display_scalar.equals(Display.List)) {
     throw new DisplayException("ScalarMap: display_scalar may not be List");
   }
   boolean text = display_scalar.getText();
   if (scalar != null) {
     /* WLH 15 June 2000
           if (text && !(scalar instanceof TextType)) {
             throw new DisplayException("ScalarMap: RealType scalar cannot be " +
                                        "used with TextType display_scalar");
           }
     */
     if (!text && !(scalar instanceof RealType)) {
       throw new DisplayException(
           "ScalarMap: TextType scalar cannot be " + "used with RealType display_scalar");
     }
   }
   control = null;
   Scalar = scalar;
   DisplayScalar = display_scalar;
   display = null;
   ScalarIndex = -1;
   DisplayScalarIndex = -1;
   isScaled = DisplayScalar.getRange(displayRange);
   isManual = false;
   dataRange[0] = Double.NaN;
   dataRange[1] = Double.NaN;
   defaultUnitRange[0] = dataRange[0];
   defaultUnitRange[1] = dataRange[1];
   OldTick = Long.MIN_VALUE;
   NewTick = Long.MIN_VALUE + 1;
   tickFlag = false;
   if (Scalar != null) scalarName = Scalar.getName();
   if (DisplayScalar.equals(Display.XAxis)
       || DisplayScalar.equals(Display.YAxis)
       || DisplayScalar.equals(Display.ZAxis)) {
     axisScale = new AxisScale(this);
   }
 }