NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
Ben- Ben Monnahan wrote:
Hi, it's me again. I would like to implement a way to zoom that would allow the user to right click and drag a box out and then zoom in to that box. I have noticed something called RubberBandBoxRendererJ3D in the javadoc and mentioned on the list. As you may remember, I am using 2D to create line plots. I have been thinking(I haven't checked to see how much work it will be) that I could possibly convert RubberBandBoxRenderJ3D to a J2D version. Is using this kind of thing even the best way to go about something like this? Or is there a simpler way? If it's going to be too messy I may be able to deal with not having the rubberband displayed on the screen. In that case I'm assuming I would just need to keep track of the mouse events.
A RubberBandBoxRendererJ2D would be a great addition to VisAD. I looked at it once, but didn't have the time to work on it. We use the RubberBandBoxRendererJ3D to zoom on our map displays. It's a little tricky in 3D because you have to figure out the appropriate translations, but I basically use what MouseHelper does when it zooms.
Also, I would like to change the way the ticks are done. Basically I wantto force the min and max values for the scale to be in the tick list. The only way I can see to do it would be by subclassing AxisScale andoverriding the computeTicks() method. Is there something I'm missing where I can just tell it to use an array of vals as the tick list and calculate it outside the class?
You can use the setLabelTable method of AxisScale to manually set the ticks you want to see. You could use the logic in computeTicks to calculate the "standard" ticks, then add in the max and min values, create a hash table of these values (key = Double(tick), value = String). If you want a public method for computeTicks, see Contour2D.intervalToLevels which does essentially the same thing. The only problem I'd see with this approach is that if one of the calculated ticks is close to the endpoints, the labels would overlap. If you just want the endpoints, then call ScalarMap.getRange() and use those values to compute the HashTable for setLabelTable. If you want all this to be done automagically, then add a ScalarMapListener to the scalarmap and recompute the table as the range changes. Don
visad
archives: