Re: setRange on IsoContour gives NullPointerException

Hi John,
 
> when i try to call setRange on an IsoContour I get a
> NullPointerException.  Specifically it happens at line 435 of
> ScalarMap.java:
>
>       ((ContourControl) control).getMainContours(bvalues, values);
>
> It would seem that "control" is null at this point.  The general context
> of this is that I am adding the ranges of Display objects to what is
> saved by the SpreadSheet's save function.  When I try to open a
> SpreadSheet file containing a cell which has data mapped to IsoContour,
> when I get to the point in my code where I call setRange on that map, I
> get the above exception.
 
First, we will add tests "if (control != null) {" around references
to control in ScalarMap.setRange().  Thanks for pointing this out.
 
However, the deeper question regards calling ScalarMap.setRange()
beofre the ScalarMap has been addMap()'ed to a DisplayImpl (this
is what control == null means).
 
It sounds like you are pushing into new territory, mixing your
own code with the SpreadSheet.  Are you doing it by writing new
classes that are linked into formulas?  Or are you modifying
the SpreadSheet source code?
 
If you are linking code into formulas, then I am unsure how you
are getting access to ScalarMaps and the SpreadSheet's save
function.  If you are modifying the SpreadSheet source code,
then we'd be happy to hear more specifics about what you are
doing.
 
> Also, is there any way to get at the currently selected values of a
> SelectRangeWidget (which i want to do for the same reason as above)?
> I've tried to look into it, and it seems they are based on the value of
> minValue and MaxValue in RangeSlider, which have no accessors.
 
A SelectRangeWidget is connected to a RangeControl, and you can
invoke its getRange() method which returns a float[2] array
containing the min and max of the currently selected range.
 
There is no way to get the RangeControl from the SelectRangeWidget,
but I wonder if that's needed.  You can of course get the
RangeControl from the ScalarMap via the getControl() method.
 
Please let us know if you need a method of SelectRangeWidget that
returns its RangeControl.
 
Cheers,
Bill
----------------------------------------------------------
Bill Hibbard, SSEC, 1225 W. Dayton St., Madison, WI  53706
hibbard@xxxxxxxxxxxxxxxxx  608-263-4427  fax: 608-263-6738
http://www.ssec.wisc.edu/~billh/vis.html