[vtkusers] keeping track on actors
vermaas at astron.nl
Tue Jul 29 01:34:24 EDT 2003
I had some trouble keeping track on all the actors.
I have tons of actors for text, lines, cubes, axies, etc. Some of them need to be updated (like a cursor annotation). For example every time a pick event occurs.
In my (member)functions I use 'addActor' every time, but when I have just created that actor in that function (with New()) I must first delete it, otherwise I just get an extra prop in the scene next to the old one. To be able to delete the right actor I had to keep track of all of them and that's a nuicance.
So what I did is defining all the actors as members and create them all at once in the contructor (and delete them in the destructor). When I now use AddActor the Prop in the screen gets updated nicely and the NumberOfActors does not increase.
The only negative side I see is that my memberfunctions are less independant because they use these members which are global in the class.
Is this a valid way of handling the actors or is this stupid? Any idea's about this?
Nico Vermaas - ASTRON
Westerbork Radio Telescope
More information about the vtkusers