NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

RE: visad cell-Impl

Hi all:

 i have two fields f1,f2 and two data references d1,d2 added to my display:
the scalar maps and the dispaly is written using the first field and i am
only using data points from the second field which basically a file like:

flatxx.tx 
(isotopicMass, pi) -> (Ratio) 
Ratio, isotopicMass, pi 
50  0   0 
30  250000  0 
90  250000  0 
10  0   0 
80  0   0 
i am only using data from the first column in this file. my question is if i
right-click on the mouse the doAction() in cellImpl seem not to  be working,
what i expect is to be able able to retrieve the entire from the file say
:10  0   0  if i rihght-click on 10 in the display:

here is what i have 

        final FieldImpl fieldx = 
      (FieldImpl) new TextAdapter("flatxx.txt").getData(); 
        
 DataReferenceImpl ref = new DataReferenceImpl("ref"); 
   final  DataReferenceImpl refx = new DataReferenceImpl("refx"); 
  final PickManipulationRendererJ3D pmr3d = new
PickManipulationRendererJ3D(); 
    ref.setData(field); 
    refx.setData(fieldx); 
    display.addReference(ref); 
    display.addReferences(pmr3d,refx); 
   
    //cellImpl computation and data retrieval 
       CellImpl cellfield2d = new CellImpl() 
    { 
      private boolean nice = true; 
      public void doAction() throws VisADException,RemoteException 
      { 
        
        if (nice) nice = false; 
        else { 
          int i = pmr3d.getCloseIndex(); 
          System.out.println("i="+i); 
          
          Tuple data = (Tuple)fieldx.getSample(i); 
          Set domainSet = fieldx.getDomainSet(); 
          float[][] values = domainSet.indexToValue(new int[] { i }); 
          
          System.out.print("Ratio = " +
((Real)data.getComponent(0)).getValue()+ ", "); 
        FlatField coords = (FlatField) refx.getData(); 
         final Set set = coords.getDomainSet(); 
                final float [][] domainSamples = set.getSamples(); 
               System.out.println( domainSamples[0][i]); 
        } 
      } 
    }; 
    cellfield2d.addReference(refx); 

thanks 

Isaac 

  


  • 2002 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: