Re: ShadowFunctionOrSetType

Hi Michelle,

If you have a ScalarMap object, you can find out what is being mapped
with ScalarMap.getScalar().getName(). You can find out what it is being
mapped to with ScalarMap.getDisplayScalar.getName(). Since you have an
array of ScalarMap objects, it should be simple to iterate through them
and check each one to see if it matches your conditions.

If for some reason the above is insufficient, I must ask, if you are
generating these mappings elsewhere in your *own code*, why can't you
add functionality to detect such mappings at the point of generation,
instead of trying to determine it from VisAD later?  That is, if I name
my dog Rover, does it make sense to ask my dog what his name is later?
It makes more sense for me to remember his name myself.

-Curtis

>Kam, Michelle C wrote:
>>Hi Tom,
>>Attached is an example of a file I am working with. When you load it
>>into a spreadsheet cell and then open up the mapping dialog box, you see
>>"index" listed at the top of the "map from" column along with other
>>input fields like q1, q2,..etc. I'm prespecifying what the input fields
>>get mapped to such as latitude, longitude, flow1 x. But as Tom pointed
>>out, when "index" is mapped to "Iso-contour", a "terminal legal"
>>exception is thrown. Therefore, I'm trying to find out when the mappings
>>that I generate produce that specific mapping so that I can then treat
>>this scenario as a special case.
>>That is why I was wondering if there was a way to extract the
>>corresponding VisAD "mapTo" value for input field "index" after my
>>mappings are setup. This is where I set up my mappings that I randomly
>>generated in another class:
>>                public void setCellMapping(int width, int height) throws
>>VisADException, RemoteException {
>>                        
>>                        //System.out.println("In setCellMapping() and
>>width = " + width + "height = " + height);
>>                        int fields = theJgapAPI.field_count;  //limit on
>>for loop
>>                        int cellsAcross = mySS.NumVisX;   //3 for now
>>                        int cell_number = (width + (cellsAcross *
>>height));   //used as arg to getMappingForCell()
>>                        
>>                        //ScalarMap[] theMaps = new ScalarMap[fields];
>>//array that will be passed into setMaps()      
>>                        
>>                        Data[] myData
>>mySS.DisplayCells[width][height].getData();  
>>                        Vector myVector = new Vector(fields); //capacity
>>= 10 because there are 10 input fields in small.v5d
>>                        int useless = DataUtility.getScalarTypes(myData,
>>myVector, false, true);  //will setup the myVector structure holding
>>input fields scalar types               
>>                        
>>                        Vector nonNullMappings = new Vector();
>>                        for (int i = 0; i < fields; i++) {
>>                                //System.out.println("in
>>setCellMapping() and i = " + i);
>>                                
>>                                int assignment
>>theJgapAPI.getMappingForCell(cell_number, i);
>>                                DisplayRealType mapTo
>>mappings[assignment];
>>                                RealType mapFrom = (RealType)
>>myVector.get(i);        
>>                                
>>                                if (mapTo != null) {
>>                                        nonNullMappings.add(new
>>ScalarMap(mapFrom, mapTo));
>>                                }
>>                        }                       
>>                        
>>                        ScalarMap[] theMaps = new
>>ScalarMap[nonNullMappings.size()];      
>>                        nonNullMappings.copyInto(theMaps);
>>                                                
>>                                //theMaps[i] = new ScalarMap(mapFrom,
>>mapTo);
>>                                //System.out.println("mapFrom = " +
>>mapFrom);
>>                                //System.out.println("mapTo = "+mapTo);
>>                                //String name = mapsFrom[i]; //string
>>name of input field i for this file, small.v5d for now
>>                                //RealType mapFrom
>>RealType.getRealType(name);  //constructs a RealType object from a given
>>String name             
>>                                //theMaps[i] = new ScalarMap(mapFrom,
>>mapTo);
>>                        
>>        
>>mySS.DisplayCells[width][height].setMaps(theMaps);              
>>                }
>>Thanks,
>>Michelle
>>
>>Michelle Kam           (408) 742-2881
>>Lockheed Martin Space Systems Co. SSM/ATC/MSIS
>>B/153 O/L922 1111 Lockheed Martin Way, Sunnyvale, CA 94089


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