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.

FlatField.evaluate() returning missing

Gretings VisAD users,

I have some values stored in a FlatField and I use FlatField.evaluate()  to
retrive the values it contains, like this:

------------------------
//Inside the displayChanged() method of a DisplayListener

VisADRay ray
display.getDisplayRenderer().getMouseBehavior().findRay(displayEvent.getX(),
displayEvent.getY());

float[] lon = lonMap.inverseScaleValues(new float[] {(float)
ray.position[0]});
float[] lat = latMap.inverseScaleValues(new float[] {(float)
ray.position[1]});

RealTuple tuple = new RealTuple(new Real[] {
            new Real(RealType.Longitude, lon[0]),
                    new Real(RealType.Latitude, lat[0])
        });

double value = ((Real) vals_ff.evaluate(tuple)).getValue();

------------------------

And this works fine for the first Field, but when I change the domain I have
to create another field, and then the evaluate() method starts to return
"missing" all the time. Here is the FlatField creation code:

---------------------------

//This if only is true in the first time a new domain is neded
if (domain_set==null || oldRange!=newRange){
            domain_set = new Gridded2DSet(domain_tuple,
createDomain(newRange), DIM, DIM);
            vals_ff = new FlatField( func_dom_pix, domain_set);

            if (radar_ref == null) {
                radar_ref = new DataReferenceImpl("radar_ref");
                display.addReference(radar_ref);
            }

            radar_ref.setData( vals_ff );
 }

 vals_ff.setSamples(flatSamples);

-----------------------

I dont think the createDomain() method is really important, but I can send it
if you need. The worst thing is that the problem happens most of the time,
not everytime. I will try to make a sample to demonstrate in the meantime.
--
____________________
Cicero A. W. Zandoná

-------------------------------------------------------


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