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.
I'm constructing all my ScalarMaps internally through my own code I added. In these loops, I extract the data types and set up the mappings to DisplayRealTypes. I do this for every single input field that comes in. That is why I have to create a "null" or "non-existent" mapping for those that I don't want mapped. It's not as if the user can just not select the fields that should not have a mapping because my iteration automatically assigns something to every input field: // sets up ScalarMap[] array to pass into setMaps. sets up mapping for each gene for cell at (i,j) 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 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); 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); } If you know of a better way to do this, let me know. -----Original Message----- From: Curtis Rueden [mailto:curtis@xxxxxxxxxxxxx] Sent: Thursday, July 17, 2003 3:25 PM To: User Subject: RE: null scalary type in ScalarMap Hi, If you don't want a particular ScalarType mapped to the display, then don't create a ScalarMap for it! You should not create any ScalarMaps with null DisplayRealType. -Curtis At 05:08 PM 7/17/2003, you wrote: >Hi Curtis, > >I'm actually trying to have null values for just the DisplayRealType and >not the ScalarType. I want the possibility for an input field to be >mapped to a null value as one possible visualization instead of *always* >mapping every single input field in the data set to a VisAD parameter. > >However, as I dig further and further into the original code, I'm >finding that I would have to modify many classes to avoid null pointer >exceptions. Am I correct that there would be no simple way to wrap a >null DisplayRealType without getting null pointer exceptions? > >Thanks,
visad
archives: