If I want to get the current visad coords and screen coords (by coords I
mean the values for the 4 corners) for the box (the box that defines the
graph region), what is the most proper way to go about this?
I'd like to get these values in order to do some range testing when
performing various operations such as zooming. I'd like to test whether a
particular coordinate is inside the box.
----- Original Message -----
From: "Bill Hibbard" <test@xxxxxxxxxxxxxxxxxx>
To: "Brandon Kohn" <blkohn@xxxxxxxxxxx>
Sent: Monday, April 01, 2002 2:42 PM
Subject: Re: translation howto?
> Hi Brandon,
> Its going to depend on a couple of factors. Axis scales are
> drawn in graphics coordinates which are then passed through
> the transform matrix in ProjectionControl. The only way I
> could answer your question would be to dig into the code in
> Good luck,
> On Mon, 1 Apr 2002, Brandon Kohn wrote:
> > Hello again,
> > You wouldn't happen to know how I can calculate the 'height' of the axis
> > (height when the long portion of the axis is horizontal)? Should be
> > linewidth + offset from box + ticksize + label size. I've been playing
> > around in AxisScale, but I haven't really gotten a firm grasp on where
> > values are located.
> > Thanks
> > Brandon
> > ----- Original Message -----
> > From: "Bill Hibbard" <billh@xxxxxxxxxxxxx>
> > To: "Brandon Kohn" <blkohn@xxxxxxxxxxx>
> > Cc: <visad-list@xxxxxxxxxxxxx>
> > Sent: Saturday, March 30, 2002 1:50 PM
> > Subject: Re: translation howto?
> > > Hi Brandon,
> > >
> > > > I'm attempting to create a 2D graph display that resizes when it's
> > parent
> > > > window resizes. I'm using the autoAspect feature and some resizing
> > > > that I found on a JPython script sheet that resizes the box to some
> > > > percentage of the window via the matrix in ProjectionControl. The
> > problem
> > > > is that when the graph is resized this way it is centered in the
> > using
> > > > only the box coords, not the box plus the axes. So, when I resize
> > box
> > > > to say 75% + of the window, the axis labels are out of the canvas.
> > Anything
> > > > less than 75% leaves alot of whitespace all around the graph (which
> > what
> > > > I want to avoid). I figure one way around this problem is to calc
> > sizes
> > > > of the axes and then translate the box up and left by these amounts.
> > Then
> > > > do the resize. This seems like a pretty bad hack, and I'm wondering
> > > > there is a better way to do this. If I'm stuck with the hack, is
> > a
> > > > simple way to do the translation?
> > >
> > > I wouldn't call it a hack, since any code that does what you
> > > want will have to make this calculation. The only question is
> > > whether that code is encapsulated behind some simple API.
> > >
> > > There is no such method that I know of in VisAD, so you'll
> > > probably have to code one yourself. You can use the make_matrix()
> > > method of MouseBehavior (get the MouseBehavior from the
> > > DisplayRenderer, which you get from the DisplayImpl) to
> > > convert a translation into a matrix, then use MouseBehavior's
> > > multiply_matrix() method to combine it with the matrix you
> > > get from ProjectionControl.getMatrix(), and pass the result
> > > back to ProjectionControl.setMatrix().
> > >
> > > Good luck,
> > > Bill
> > >
> > >