Re: How to link the change to RangeWidget with SelectRangeWidget?

Thanks Bill,

Is there any way to detect there is a ScalarMap event generated from the
Rangewidget of visMap?

If there is, can I first
double [] xxx = visMap.getRange();

and then do
visRangeMap.setRange((float)xxx[0], (float)xxx[1]);


Thanks, /helen

Bill Hibbard wrote:

> Hi Helen,
>
> > Suppose
> >
> > RealType vis = RealType.getRealType("VIS");
> > ScalarMap visMap = new ScalarMap(vis, Display.RGB);
> > visMap.setRange(-10.0f,10.0f);
> >
> > ScalarMap visRangeMap = new ScalarMap(vis, Display.SelectRange);
> > visRangeMap.setRange(-10.0f,10.0f);
> > .....
> >
> > JFrame f = new JFrame();
> >
> > f.getContentPane().add (new RangeWidget(visMap),BorderLayout.NORTH);
> > f.getContentPane().add (new ColorMapWidget(visMap),BorderLayout.CENTER);
> >
> > f.getContentPane().add (new
> > SelectRangeWidget(visRangeMap),BorderLayout.SOUTH);
> >
> > If I make some change in RangeWidget, i.e. change -10.0f to -5.0f, how
> > this change be reflected in SelectRangeWidget, that is, the select range
> > slider will be moved only between -5.0 to 10.0
>
> Since your SelectRangeWidget is created from visRangeMap but your
> RangeWidget is created from visMap, the RangeWidget will have no
> effect on the SelectRangeWidget. And since the DisplayRealType
> Display.SelectRange is not "scalable", you cannot create a
> RangeWidget from visRangeMap.
>
> Cheers,
> Bill