RE: specifying fields from input file

Hi Curtis,

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.

Since I'm not sure if there is such a global structure, I'm iterating
through the Scalar[] array in MappingDialog.java of String names
corresponding to input fields and then constructing the RealType from the
string name. The reason is that when I "evolve()" the current generation of
cells, I'm changing what each field (or "gene") gets mapped to. So I have to
iterate through the structure holding the fields to re-assign them after
each generation in order to display the new mappings. In the VisadAPI.java
attachment, in setCellMapping(width, height), I go through the array of
strings called "Scalars[]" which is declared in MappingDialog and my
function getScalars() in MappingDialog.java just returns it. I also declared
the local variable "mapDialog" in addMapDialog() to be a public class
variable in FancySSCell.java so I can access the Scalars array from
VisadAPI.java.

When I implement the functionality for selecting multiple cells, I'm not
going to adjust the rest of the spreadsheet to accomodate this. ie. I'm not
going to worry about the formula bar, or the checkbox, or the cut, paste,
copy buttons even though they should be changed. I merely want the user to
be able to select multiple cells so that these preferred cells can "live" to
the next generation. I just need some way of knowing which cells the user
likes best and then to feed those particular mappings or cell #'s into my
evolution function (in another class). Knowing that, if I were to use the
java Vector class to store the cells that are selected at the same time,
would changing just the code around CurX, CurY variables make sense? Or do
you know of other places that should be included?

Thanks,
Michelle

(VisadAPI.java doesn't compile yet, but I attached it to show how I'm
iterating through Scalars[] to see if you think it makes sense).

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 2:54 PM
To: Michelle Kam
Subject: RE: specifying fields from input file


Hi Michelle,

>When I load a data file into a spreadsheet cell, the input fileds such as 
>latitude, longitude, etc are different per each file. Do you know which
class 
>I can find those fields that appear in the left column of the mapping
dialog 
>box called "Map From"? I'm looking for an array or some data structure that

>holds those fields so that I can map each input field to a corresponding 
>Display type such as CylRadius that shows up in the "Map To" section of the

>mapping dialoge box.

MappingDialog extracts these ScalarTypes from the data's MathType.
Call BasicSSCell.getData to get the Data object, then call getType
on the Data, then parse the MathType it returns. MappingDialog does
this with a collection of recursive algorithms, but if you know
something about the structure of your MathType, you can probably
make some assumptions to simplify the process.

>I was trying to find a way to select multiple cells at once by pressing
>"Control" and selecting the desired cells with the mouse button. Would you
>recommend adding more fields in SpreadSheet.java like "CurX2" and "CurY2"
to
>represent the 2nd cell that was selected by the user? And then add a method
>in SpreadSheet.java to handle 2 cells?

You'll need a more general solution to do multiple selection. My
first thought is to use a Vector to keep a list of which cells are
currently selected. Then you'd have to rewrite all the code that
affects the selected cell to instead go through that Vector and
apply changes to all selected cells.

This problem is much trickier than it appears at first, because you
have to make some decisions about how things behave when multiple
cells are selected. For example, you'd probably need to display
"[Multiple cells selected]" or something in the formula bar when a
multiple selection exists. If the dimensionalities of the selected
cells do not match, you'd need to use a fuzzy gray checkbox in the
cell menu to represent that fact. You'd need to arbitrarily pick a
cell for adding new data when the user types something in the
formula bar. You'd probably have to disable the Cut, Copy and Paste
features when a multiple selection exists. Overall, multiple
selection support represents significant work, with little to no
added functionality or convenience, which is why I never added it.

>And when I set up my array holding all the possible "Map To" fields that
>show up in the mapping dialog when you run the program, I counted 44
>different fields in the "Map To" section but in MappingDialog.java, there
>are 50 different entries for MapNames[][] and MapTypes[][]. Why don't the 6
>extra fields like "Hue" and "Saturation" appear in the dialog box?

Hue and Saturation actually *do* appear in the MappingDialog. They
are labeled "H" and "S", respectively. However, there are six types
that are not represented in that graphic. These are types that were
added to VisAD after I designed the MappingDialog graphic, and thus
they are not included. Actually, I did redesign the graphic once to
incorporate some new types we added, but those latest six were
added after the first redesign.

-Curtis

Attachment: VisadAPI.java
Description: Binary data

  //changed the variable: "mapDialog" from a local variable to a public class 
variable so getMapsFrom() in 
  //MappingDialog.java can be accessed
  
  public MappingDialog mapDialog; 
//around line 920, public accesor method to get private "maps from" array

        /* 
         *Gets the "map from" array
         */
         
         public String[] getMapsFrom() {
                
                return Scalars;
         }
  • 2003 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the visad archives: