WG: How get range info from certain objects?

Hi Charles,

> I want to use the setRange method of ScalarMap to reverse the polarity

> of an axis, but first I need to know the max and min values of that 
> axis before I can reverse them. I have a GriddedSet being passed 
> into my procedure, which I assign to a DataReference, etc. If I then 
> do a System.out.println on the DataReference, I get a list 
> "DomainDimension 
> 1..."etc.
> that has the information I need, but I couldn't find what method 
> to call to extract the specific range in the form to use it in code,
> i.e. to alter and pass on to setRange.

You can get the ranges of your GriddedSet via its
computerRanges(RealType[] reals). This method is defined in Data so
every visad data objects contains it. It returns a double[][] whose
first index stands for the corresponding RealType in your reals array
and whose second index marks the min and max values.

Another way would be to get the ranges directly from your ScalarMap:

double[] range = scalarMap.getRange();
scalarMap.setRange(range[1], range[0]);

Hope that helps, Mathias


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