IDLgrWindow (?) bug [message #19139] |
Mon, 28 February 2000 00:00 |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
Hello everyone,
I think there is a bug in the way IDL creates an independent object
graphics window. Once you change things in it, the viewport (or
something else) changes, messing the displayed axes up. Try the code at
the bottom of this message. I use PPC IDL 5.2 and tried it in PPC IDL 5.3.
IDL> test, All_objects=All_objects, window=window, scene=scene, $
IDL> x_axis=x_axis, x_top=x_axis_top
IDL> mod_axis, window=window, x_axis=x_axis, scene=scene, x_top=x_axis_top
Use obj_destroy, objects toclean up after you saw the results.
After mod_axis is executed, the all axes lengthen and reach the edges of
the window. However, if you try using the widget_draw in object graphics
mode, it does not happen:
IDL> test, All_objects=All_objects, window=window, scene=scene, $
IDL> x_axis=x_axis, x_top=x_axis_top, /wid
IDL> mod_axis, window=window, x_axis=x_axis, scene=scene, x_top=x_axis_top
Everything looks normal, scaling changes; of course, the labels are
messed up because size recalculation is left out in the sample code.
Use obj_destroy, objects toclean up after you saw the results.
Does anyone know if this is a feature or a bug? It took me half-day
yesterday to figure out why my axes act up, until I tried to put my
development object window into a widget.
Cheers,
Pavel
pro test, All_objects=All_objects, window=window, scene=scene, $
x_axis=x_axis, x_top=x_axis_top, wid=wid
if keyword_set(wid) then begin
base = widget_base()
draw = widget_draw(base, xsize=400, ysize=300, graphics=2)
widget_control, base, /realize
widget_control, draw, get_value=Window
endif else Window = obj_new('IDLgrWindow')
All_objects = obj_new('IDL_Container')
Scene = obj_new('IDLgrScene')
; Fill the entire window with the default view.
View = obj_new('IDLgrView', viewplane_rect=[-0.1, -0.1, 1.12, 1.16],
location=[0.0, 0.0])
Model = obj_new('IDLgrModel')
; Initialize axes.
x_axis_top = obj_new('IDLgrAxis', 0, ticklen=0.03, tickdir=1,
loc=[1000, 1, 0], /notext, /exact)
y_axis_top = obj_new('IDLgrAxis', 1, ticklen=0.03, tickdir=1, loc=[1,
1000, 0], /notext, /exact)
x_axis = obj_new('IDLgrAxis', 0, ticklen=0.03, name='X_AXIS',
location=[1000, 0, 0], /exact)
y_axis = obj_new('IDLgrAxis', 1, ticklen=0.03, name='Y_AXIS',
location=[0, 1000, 0], /exact)
Model -> add, x_axis
Model -> add, y_axis
Model -> add, x_axis_top
Model -> add, y_axis_top
View -> add, Model
Scene -> add, View
; Put all objects in container, for easy destruction.
All_objects -> add, Scene
All_objects -> add, Window
window -> draw, Scene
end
pro mod_axis, window=window, x_axis=x_axis, scene=scene, x_top=x_axis_top
x_nr = normalize([20.,120.])
x_axis -> setProperty, range=[20.,120.], xcoord_conv=x_nr
x_axis_top -> setProperty, range=[20.,120.], xcoord_conv=x_nr
window -> draw, scene
end
|
|
|
|
|
Re: IDLgrWindow (?) bug [message #19271 is a reply to message #19139] |
Mon, 28 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Udo Grabowski (udo.grabowski@imk.fzk.de) writes:
> I myself experimented a couple of times with objects in direct graphics,
> and I immediately got rid of all problems when I realized that the
> viewplane_rect setting determines that data range of the plot which is projected
> INTO the viewport. The viewport itself is by default determined from the
> underlying
> graphics window and may further be specified INSIDE the window by the 'location'
> and 'dimensions' keywords in units given by the 'units' keyword (which has
> nothing
> to do with the viewplane_rect entries). Keeping this in mind, all my plots since
> then have an predictable and identical behaviour under direct as well as under
> object graphics (except that color trouble...).
Here is a man who is *rapidly* gaining himself an invitation
to the next IEPA meeting. (I can't say where this is going to
be, but I can tell you it is in a VERY desirable location).
You are passing this information along to others, aren't you? :-)
You are right. The viewport is mapped into the graphics
window. It can be positioned in the window with the LOCATION
and DIMENSIONS keywords. The viewport rectangle (and the
associated Z clipping planes, which together create the
viewport volume) is described in whatever arbitrary
coordinate system you like to make up! The only "trick"
to object graphics is learning how to put objects, which
are created in their "own" coordinate space, into the
arbitrary coordinate space of the viewport. Once you
understand this, everything else is just detail. :-)
Congratulations!
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|
Re: IDLgrWindow (?) bug [message #19272 is a reply to message #19139] |
Mon, 28 February 2000 00:00  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
David Fanning wrote:
>
> On some X windows machines the redraw used the *size* of the
> old window even when drawing into the new window. I wonder if
> this problem is related to the one you are seeing?
Maybe; however, I did not change the window size, it stays the same
default size that IDL made it, to start with. I might try to run it on a
Unix, to see if it will be there.
> I eventually just recreated the draw widget as a work-around,
> but I thought it was a lousy solution. I've never been able
> to report the problem because I've never been able to
> replicate it on my Windows machine.
A one-platform bug is still a bug, right?
Cheers,
Pavel
|
|
|
Re: IDLgrWindow (?) bug [message #19273 is a reply to message #19139] |
Mon, 28 February 2000 00:00  |
Pavel Romashkin
Messages: 166 Registered: April 1999
|
Senior Member |
|
|
If it is a bug, then its not a cross-platform one. Keep the shares and
your PC, David, and don't buy those gigaflops arguments around Macs :-).
What is the use of gigaflops if you still have no dynamic memory
allocation in the OS?
I'll run it by RSI to see what they say, since they target Mac market
just as much as my boss :-(.
Cheers,
Pavel
David Fanning wrote:
>
> P.S. Let's just say I'm glad Martin didn't talk me into
> selling those Microsoft shares! (Although God knows after
> looking at the markets this morning I wish I had sold
> *everything* yesterday. :-(
> n
|
|
|
Re: IDLgrWindow (?) bug [message #19274 is a reply to message #19139] |
Mon, 28 February 2000 00:00  |
Udo Grabowski
Messages: 17 Registered: February 2000
|
Junior Member |
|
|
Hello !
I myself experimented a couple of times with objects in direct graphics,
and I immediately got rid of all problems when I realized that the
viewplane_rect setting determines that data range of the plot which is projected
INTO the viewport. The viewport itself is by default determined from the
underlying
graphics window and may further be specified INSIDE the window by the 'location'
and 'dimensions' keywords in units given by the 'units' keyword (which has
nothing
to do with the viewplane_rect entries). Keeping this in mind, all my plots since
then have an predictable and identical behaviour under direct as well as under
object graphics (except that color trouble...).
--
Dr. Udo Grabowski email: udo.grabowski@imk.fzk.de
Institut f. Meteorologie und Klimaforschung II, Forschungszentrum Karslruhe
Postfach 3640, D-76021 Karlsruhe, Germany Tel: (+49) 7247 82-6026
http://www.fzk.de/imk/imk2/ame/grabowski/ Fax: " -6141
|
|
|
Re: IDLgrWindow (?) bug [message #19275 is a reply to message #19139] |
Mon, 28 February 2000 00:00  |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Pavel Romashkin (pavel@netsrv1.cmdl.noaa.gov) writes:
> Sorry for not being explicit. "Messing up" means that the axes become
> longer than they were, and extend beyond the window edges.
You know, I'm vaguely remembering a problem I had when I first
released my new PS_FORM program, FSC_PSConfig. I was changing
the size of the draw widget and then redisplaying the graphic.
On some X windows machines the redraw used the *size* of the
old window even when drawing into the new window. I wonder if
this problem is related to the one you are seeing?
I eventually just recreated the draw widget as a work-around,
but I thought it was a lousy solution. I've never been able
to report the problem because I've never been able to
replicate it on my Windows machine.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
|
|
|