Re: visad cell-Impl

"Brobbey,Isaac" wrote:
> 
> 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

Since the (0, 0) value is repeated three times and the
(250000, 0) value is repeated twice for (isotopicMass, pi),
the domain Irregular2DSet for this FlatField will be
degenerate. There is not a functional dependency of Ratio
on (isotopicMass, pi). I think you want some other MathType
for your data, such as (ratio -> (isotopicMass, pi)).

> 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:

What do you mean by "seem not to  be working". Does it never
print any messages? Is the doAction() method never called? I
cannot see any obvious problem. Because this is just a program
fragment, I cannot compile and run it to test it.

> 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);