IDL Object Graphics Update [message #11674] |
Mon, 18 May 1998 00:00 |
davidf
Messages: 2866 Registered: September 1996
|
Senior Member |
|
|
Hi Folks,
I wrote last Friday about some of my object graphics programs:
> I don't want to rain on the IDL 5.1 parade (because I like
> it too), but I have noticed that almost all of my object
> graphics programs are broken. :-(
>
> Here is a simple program that illustrates the problem. This
> program runs in IDL 5.0.3 and fails in IDL 5.1.
>
> pro test
> thisView = OBJ_NEW('IDLgrView')
> thisModel = OBJ_NEW('IDLgrModel')
> thisView->Add, thisModel
> thisSurface = Obj_New("IDLgrSurface")
> thisModel->Add, thisSurface
> thisContainer = Obj_New('IDLgrContainer')
>
> ; The next line causes the following error:
> ;
> ; % IDLGRCONTAINER::ADD: Objects can only have one
> ; parent at a time: <ObjHeapVar10(IDLGRSURFACE)>
>
> thisContainer->Add, thisSurface
> end
Although RSI technical support tells me this is a bug,
I suspected otherwise. Today well placed sources at RSI
confirm my suspicions that this is NOT a bug, but is how
IDL works currently and for what I think is a valid reason:
If the same graphics primitive belonged, for example, to
two different models there could be some confusion about
its current geometry. IDL version 5.1 has simply enforced
parenting rules that were loosely applied in IDL 5.0.3.
Two workarounds are suggested. First, it is suggested that
I use an IDL_Container object instead of the IDLgrContainer
object. The former does no class checking and so will allow
pretty much anything to be put into it.
Wanting to understand this a bit more, I started to look at
the on-line documentation for IDL_Container and IDLgrContainer.
Oddly, there is NO documentation for IDLgrContainer at all
in the IDL 5.1 on-line help or in the slim volume of documentation
shipped with 5.1. I can only conclude that there is a bit of
revisionist history going on here, because clearly
IDLgrContainer has disappeared without a trace and it appears
RSI wants it that way. (Reminds me of some thoughts I had about
one of my old girl friends.) I recommend you find all references
to IDLgrContainer in your code and change it to IDL_Container.
The second workaround is to use an IDLgrViewgroup object,
a new object class that is an IDL_Container subclass.
Viewgroup objects are different from Scene objects, apparently
(I am reading between the lines somewhat here, trying to
piece together various documentation fragments), in that
they can contain objects that do not themselves have
DRAW methods. Thus, I can add, for example, Text objects
to a Viewgroup object in addition to Axis objects.
In any case, I've fixed the object graphics programs that
are available on my web page and from my anonymous ftp
site. If any of you have downloaded these programs, you
may want to check back for the updates.
I am currently working on a short book explaining how to
write object programs in IDL and how to use the object
graphics system. If anyone has any interesting tidbits to
report I would like to hear about them so I can add them
to this reference material.
Cheers,
David
-----------------------------------------------------------
David Fanning, Ph.D.
Fanning Software Consulting
E-Mail: davidf@dfanning.com
Phone: 970-221-0438
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|