comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Copying an object
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Copying an object [message #17025] Tue, 31 August 1999 00:00 Go to next message
Waleed Al-Nuaimy is currently offline  Waleed Al-Nuaimy
Messages: 12
Registered: July 1999
Junior Member
Hi. How may one create an exact copy of an object?

In particular, I have an IDLgrModel containing other Models each wirth a
polygon object inside, and each little model is subjected to a number of
scale/translation/rotations. I want to create another Model identical to
this in all respects. Is there a direct way to do this?

Many thanks

Waleed Al-Nuaimy

Geo-Services International (UK) Ltd.
Re: Copying an object [message #17070 is a reply to message #17025] Fri, 03 September 1999 00:00 Go to previous message
Ben Tupper is currently offline  Ben Tupper
Messages: 186
Registered: August 1999
Senior Member
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
David Fanning wrote:
<blockquote TYPE=CITE>&nbsp;
<p>P.S. Let's just say I should pay more attention to those
<br>tips that guy Flemming, or whoever he is, writes. :-)
<br>&nbsp;</blockquote>
I've been wondering about identity of this Flemming guy, also.
<pre>--&nbsp;
Ben Tupper

Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org

Pemaquid River Company
pemaquidriver@tidewater.net</pre>
&nbsp;</html>
Re: Copying an object [message #17073 is a reply to message #17025] Fri, 03 September 1999 00:00 Go to previous message
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Stein Vidar Hagfors Haugan (steinhh@ulrik.uio.no) writes:

> Since the documentation for STRUCT_ASSIGN in 5.2.1 says
> that both destination and source may be an object reference

Ah, thanks for this, Stein Vidar. I tried STRUCT_ASSIGN
the other day because I had heard rumors it was suppose
to work with objects, but it failed miserably. Of course,
it didn't occur to me to look at the documentation and
find out it needed to be done inside an object method. :-)

Cheers,

David

P.S. Let's just say I should pay more attention to those
tips that guy Flemming, or whoever he is, writes. :-)

--
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: Copying an object [message #17074 is a reply to message #17025] Fri, 03 September 1999 00:00 Go to previous message
steinhh is currently offline  steinhh
Messages: 260
Registered: June 1994
Senior Member
Since the documentation for STRUCT_ASSIGN in 5.2.1 says
that both destination and source may be an object reference
when used inside an object method, the only "problem" is to make an
uninitialized instance of the object (like val = {STRUCT_NAME}).
But this could easily be implemented in an object's init method,
thus:

FUNCTION BLAH::INIT,....,CLONE=CLONE

IF OBJ_VALID(CLONE) THEN BEGIN
IF NOT OBJ_CLASS(CLONE) EQ OBJ_CLASS(SELF) THEN ... ;ERROR
STRUCT_ASSIGN,CLONE,SELF
RETURN,1
END
:
: ;; Non-clone initialization code
END

which would be called like this:

clone = OBJ_NEW('BLAH',CLONE=ORIGINAL)

Of course, this doesn't deal with issues of "parents" or other
pointers to the cloned objects. But this will have to be dealt
with for each specific type of object.

Regards,

Stein Vidar
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: IDL demo during Seybold SF keynote
Next Topic: Re: Last version of IDL supported on VAX/VMS?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 13:38:21 PDT 2025

Total time taken to generate the page: 0.00653 seconds