Hi Michelle,
You're not seeing Altitude, Latitude or Longitude because
they are CoordinateSystem reference types, which
DataUtility.getScalarTypes does not extract by default.
However, you can extract them by passing in coordSys=true to
getScalarTypes. Also, I recommend using keepDupl=false, so
that you don't receive the same RealTypes multiple times.
Try the following code:
Data[] myData = mySS.DisplayCells[width][height].getData();
Vector myVector = new Vector(10);
DataUtility.getScalarTypes(myData, myVector, false, true);
for (int i = 0; i < myVector.size(); i++) {
ScalarType st = (ScalarType) myVector.elementAt(i);
System.out.println("type #" + i + " = " + st);
}
If the above code doesn't get all the ScalarTypes, it's
probably a bug in getScalarTypes, and I'll look into it.
-Curtis
At 02:49 PM 6/30/2003, you wrote:
>Hi Curtis,
>
>I tried calling getData() on a FancySSCell and then passing that and a newly
>constructed vector to hold the resulting scalar types into the call to
>getScalarTypes() (as you suggested). However, in the printout of the scalar
>types, I only get time, row, col, height, U, and V. No matter how many times
>I run my program, these are always the input fields and altitude, latitude,
>longitude, or W never appear as "map from" fields. So the values that the
>input fields are mapped to change as expected, but the input fields
>themselves are always the same. Printed to screen:
>
>mpas[0] is ScalarMap: Time -> DisplayRGBA
>
>maps[1] is ScalarMap: row -> DisplayValue
>
>maps[2] is ScalarMap: col -> DisplayCyan
>
>maps[3] is ScalarMap: Height -> DisplayYAxisOffset
>
>maps[4] is ScalarMap: U -> DisplayRGBA
>
>maps[5] is ScalarMap: row -> DisplayBlue
>
>maps[6] is ScalarMap: col -> DisplaySaturation
>
>maps[7] is ScalarMap: Height -> DisplayYellow
>
>maps[8] is ScalarMap: V -> DisplayRadius
>
>maps[9] is ScalarMap: row -> DisplayZAxis
>
>If I imported small.v5d as the input data file and tried to determine the
>scalar values of input fields, do you know why the input fields of altitude,
>latitude, longitude, or W never show up especially since I'm randomizing the
>intial mappings including input fields?
>
> public void setCellMapping(int width, int height) throws
>VisADException, RemoteException {
>
> int fields = theJgapAPI.field_count;
>//used as arg to getMappingForCell()
> int cell_number = (width + (4 * 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(10); //capacity = 10
>because there are 10 input fields in small.v5d
> int useless = DataUtility.getScalarTypes(myData,
>myVector, true, false); //will setup the myVector structure holding input
>fields scalar types
>
> for (int i = 0; i < fields; i++) {
> int assignment
>theJgapAPI.getMappingForCell(cell_number, i);
> DisplayRealType mapTo
>mappings[assignment];
> RealType mapFrom = (RealType)
>myVector.get(i);
> 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
>
>
>
>
>-----Original Message-----
>From: Curtis Rueden [mailto:curtis@xxxxxxxxxxxxx]
>Sent: Monday, June 23, 2003 5:44 PM
>To: Kam, Michelle C
>Cc: visad-list@xxxxxxxxxxxxx
>Subject: RE: specifying fields from input file
>
>
>Hi Michelle,
>
>>I was actually trying to either find a data structure that held all the
>>input fields or create one myself. If I used the method you described below
>>of calling getData() and then getType() and then parsing that, I have to
>>iterate through all the fields for each field in the data file. From the
>>looks of setMaps(), it seems as if the structure "dr[]" that holds Data
>>objects is local to setMaps() and I can't access that from VisadAPI.java
>>when iterating through the array. Do you know if there is a similar global
>>structure? Also, is there a method in BasicSSCell called parse() because
>I'm
>>not sure how you would parse() a MathType.
>
>MappingDialog extracts the ScalarTypes using visad.util.DataUtility's
>getScalarTypes() method (this method calls several other internal, recursive
>methods to which I alluded before). Check out the Javadoc on
>visad.util.DataUtility for more information on its usage.
>
>You should be able to getData() your data from the SSCell, then call
>DataUtility.getScalarTypes, passing in your data objects.
>
>-Curtis