[vtkusers] Removing al actors from a Renderer (I get multiple XYPlots inone renderer)

Nico Vermaas vermaas at astron.nl
Mon Apr 7 02:06:10 EDT 2003


Hi,

Do you know what happens when I have 'yourActor' as a member and use
AddActor(yourActor) in a 
memberfunction that is called in a loop? I must be adding 'yourActor's'
continuesly to the renderer, but I do not see the NumberOfActors growing
when I use 'renderer->VisibleActorCount()'.
Do you think this leads to problems? Do I need to remove the actors or
will it overwrite the existing actor because I use the same vtkActor
every time?

Nico

>>> "R K Shyamprakash" <ramakrishna.prakash at quest-global.com> 04/04/03
12:28pm >>>
Hi,
      Make sure you call InitTraversal() on vtkActorCollection before
taking
the actor count. Else you can also use
yourRenderer->RemoveActor(yourActor).

regards
Shyam


-----Original Message-----
From: vtkusers-admin at public.kitware.com 
[mailto:vtkusers-admin at public.kitware.com]On Behalf Of Nico Vermaas
Sent: Friday, April 04, 2003 12:28 PM
To: vtkusers at public.kitware.com 
Subject: [vtkusers] Removing al actors from a Renderer (I get multiple
XYPlots inone renderer)


Hi,

I want to draw and update an XYPlotActor, but when I draw a new one
(by
addingAddActor2D(xyplot)) then the old one just also stays in there.
So
I need to delete the old one first.

I tried this... and I do get the right count that increases every time
I add an actor. But the Removing part  does not work.

vtkActorCollection *actors = vtkActorCollection::New();
int NumberOfActors = renderer->VisibleActorCount();

actors=this->renderer->GetActors();
for (int i=0; i<NumberOfActors; i++) {
   this->renderer->RemoveActor(actors->GetNextActor());
}

actors->Delete();


Q: How do I delete all actors from a renderer?

Nico

_______________________________________________
This is the private VTK discussion list.
Please keep messages on-topic. Check the FAQ at:
<http://public.kitware.com/cgi-bin/vtkfaq>
Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers 




More information about the vtkusers mailing list