Changeset 2634


Ignore:
Timestamp:
04/17/07 17:16:57 (13 years ago)
Author:
curtis
Message:

Take advantage of new visad.util.CursorUtil.evaluate method.

Location:
trunk/loci/visbio/view
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/loci/visbio/view/StackLink.java

    r2623 r2634  
    670670    // get data at appropriate slice 
    671671    Data data = sliceRef.getData(); 
    672  
    673     // evaluate function at the cursor location 
    674672    if (!(data instanceof FunctionImpl)) return; 
    675673    FunctionImpl func = (FunctionImpl) data; 
     674 
     675    // evaluate function at the cursor location 
    676676    double[] rangeValues = null; 
    677677    try { 
    678       RealTuple tuple = new RealTuple(new Real[] { 
    679         new Real(xType, domain[0]), 
    680         new Real(yType, domain[1]) 
    681       }); 
    682  
    683       Data result = func.evaluate(tuple, 
    684         Data.NEAREST_NEIGHBOR, Data.NO_ERRORS); 
    685       if (result instanceof Real) { 
    686         Real r = (Real) result; 
    687         rangeValues = new double[] {r.getValue()}; 
    688       } 
    689       else if (result instanceof RealTuple) { 
    690         RealTuple rt = (RealTuple) result; 
    691         int dim = rt.getDimension(); 
    692         rangeValues = new double[dim]; 
    693         for (int j=0; j<dim; j++) { 
    694           Real r = (Real) rt.getComponent(j); 
    695           rangeValues[j] = r.getValue(); 
    696         } 
    697       } 
    698       else return; 
    699     } 
    700     catch (VisADException exc) { return; } 
    701     catch (RemoteException exc) { return; } 
     678      rangeValues = CursorUtil.evaluate(func, domain); 
     679    } 
     680    catch (VisADException exc) { exc.printStackTrace(); } 
     681    catch (RemoteException exc) { exc.printStackTrace(); } 
    702682 
    703683    // compile range value messages 
  • trunk/loci/visbio/view/TransformLink.java

    r2623 r2634  
    441441 
    442442    int[] pos = handler.getPos(trans); 
     443    // need to change pos[stackAxis] = -1 
     444    //pos[stackAxis] = -1; 
    443445    ThumbnailHandler th = trans.getThumbHandler(); 
    444446    Data thumb = th == null ? null : th.getThumb(pos); 
     
    530532 
    531533    // get cursor's domain coordinates 
    532     RealType xType = it.getXType(); 
    533     RealType yType = it.getYType(); 
    534534    double[] domain = CursorUtil.cursorToDomain(display, 
    535       new RealType[] {xType, yType, null}, cur); 
     535      new RealType[] {it.getXType(), it.getYType(), null}, cur); 
    536536 
    537537    // evaluate function at the cursor location 
    538538    double[] rangeValues = null; 
    539539    try { 
    540       RealTuple tuple = new RealTuple(new Real[] { 
    541         new Real(xType, domain[0]), 
    542         new Real(yType, domain[1]) 
    543       }); 
    544  
    545       Data result = func.evaluate(tuple, 
    546         Data.NEAREST_NEIGHBOR, Data.NO_ERRORS); 
    547       if (result instanceof Real) { 
    548         Real r = (Real) result; 
    549         rangeValues = new double[] {r.getValue()}; 
    550       } 
    551       else if (result instanceof RealTuple) { 
    552         RealTuple rt = (RealTuple) result; 
    553         int dim = rt.getDimension(); 
    554         rangeValues = new double[dim]; 
    555         for (int j=0; j<dim; j++) { 
    556           Real r = (Real) rt.getComponent(j); 
    557           rangeValues[j] = r.getValue(); 
    558         } 
    559       } 
    560       else return; 
    561     } 
    562     catch (VisADException exc) { return; } 
    563     catch (RemoteException exc) { return; } 
     540      rangeValues = CursorUtil.evaluate(func, domain); 
     541    } 
     542    catch (VisADException exc) { exc.printStackTrace(); } 
     543    catch (RemoteException exc) { exc.printStackTrace(); } 
    564544 
    565545    // compile range value messages 
Note: See TracChangeset for help on using the changeset viewer.