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

Nico Vermaas vermaas at astron.nl
Mon Apr 7 02:54:58 EDT 2003


Hi Shyam,

1: Yes I do... when the user makes a change I draw and render
everything again (from the event loop).
2: GetNumberOfActors() does not seem to exist. It doesn't compile and I
cannot find it in the online VTK documentation. (do you have it?) That's
why I wondered that the 'VisibleActorCount()' gives back exactly, the
total actor count?

Nico

>>> "R K Shyamprakash" <ramakrishna.prakash at quest-global.com> 04/07/03
08:48am >>>
Nico,
          I am not sure if the actors get overwritten. Give me some
time, I
will check and get back to you. I have point or two to check.
1. Do you call renWin->Render() every time after you add the
actor?(renWin
is RendererWindow.)
2. Instead of using renderer->VisibleActorCount() try using
actorCollection = renderer->GetActors();
actorCollection->InitTraversal();
actorCollection->GetNumberOfActors()

Check if the actor count increases.

Regards
Shyam

-----Original Message-----
From: vtkusers-admin at public.kitware.com 
[mailto:vtkusers-admin at public.kitware.com]On Behalf Of Nico Vermaas
Sent: Monday, April 07, 2003 11:36 AM
To: ramakrishna.prakash at quest-global.com 
Cc: vtkusers at public.kitware.com 
Subject: RE: [vtkusers] Removing al actors from a Renderer (I
getmultiple XYPlots inone renderer)


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 

_______________________________________________
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