Example #1
0
 /**
  * Set the scale
  *
  * @param baseScale the base scale
  * @throws RemoteException On badness
  * @throws VisADException On badness
  */
 public void setScale(double baseScale) throws VisADException, RemoteException {
   this.baseScale = baseScale;
   if (getDisplayMaster() == null) {
     return;
   }
   ProjectionControl pcontrol = getDisplayMaster().getDisplay().getProjectionControl();
   if (pcontrol == null) {
     return;
   }
   double[] matrix = pcontrol.getMatrix();
   double[] rot = new double[3];
   double[] scale = new double[1];
   double[] trans = new double[3];
   MouseBehaviorJ3D.unmake_matrix(rot, scale, trans, matrix);
   // System.err.println("scale:" + scale[0]);
   // It seems like dividing by 15 gives us good results
   zoom = (float) scale[0] / (float) baseScale;
 }
Example #2
0
 /**
  * Set the DisplayImpl this ScalarMap is linked to
  *
  * @param d display to link to
  * @throws VisADException map is already linked to a DisplayImpl or other VisAD error
  */
 synchronized void setDisplay(DisplayImpl d) throws VisADException {
   if (d.equals(display)) return;
   if (display != null) {
     throw new DisplayException(
         "ScalarMap.setDisplay: ScalarMap cannot belong" + " to two Displays");
   }
   display = d;
   if (scale_flag) makeScale();
   // System.out.println("setDisplay " + Scalar + " -> " + DisplayScalar);
   // WLH 27 Nov 2000
   if (!(this instanceof ConstantMap)) {
     ProjectionControl pcontrol = display.getProjectionControl();
     try {
       setAspectCartesian(pcontrol.getAspectCartesian());
     } catch (RemoteException e) {
     }
   }
 }