How can i Copy an vtkActor ( vtkMapper ) ?

Will Schroeder will.schroeder at kitware.com
Tue Sep 14 08:28:10 EDT 1999


Hi Harald-

At 11:01 AM 9/14/99 +0200, Luebeck, Harald wrote:

>How can create an exact copy of an vtkActor. I need an copy not an refrence
>because i want to modify some Properties without modifing the original
>Actor.

You're asking a timely question. We are in the middle of ditching operator= and the copy constructor because their usage is too ambiguous. In their place, we are adding ShallowCopy() and DeepCopy() methods which are much clearer in their meaning.

These will be available shortly in the nightly releases and within about a month in the release of vtk3.0. In the meantime, you'll probably want to manually create an actor and then copy selected ivars.


>At the moment i use the folloing code :
>
>// Copy Mapper through DataSet
>pDataSet->CopyStructure( pShapeActor->GetMapper()->GetInput() );
>// Set new mapper 
>pMapper->SetInput( pDataSet );
>pActor->SetMapper( pMapper );
>
>How can i copy the rest of the data. i.e TCoords, Scalars ... ?

Look at a filter like vtkWarpVector. It uses the PassData() methods to move the attributes from the input to the output of a visualization filter.

   output->GetPointData()->PassData(input->GetPointData());
   output->GetCellData()->PassData(input->GetCellData());

Will



-----------------------------------------------------------------------------
This is the private VTK discussion list.  Please keep messages on-topic.
Check the FAQ at: <http://www.automatrix.com/cgi-bin/vtkfaq>
To UNSUBSCRIBE, send message body containing "unsubscribe vtkusers" to
<majordomo at gsao.med.ge.com>.  For help, send message body containing
"info vtkusers" to the same address.     Live long and prosper.
-----------------------------------------------------------------------------





More information about the vtkusers mailing list