[vtkusers] how to manage upstream change?

Dean Inglis dean.inglis at camris.ca
Fri May 13 12:55:25 EDT 2005


simple pipeline, post vtk4.4:

vtkPolyData => vtkIdFilter => vtkLabeledDataMapper => vtkActor2D

intialized like this:

void InitPipeline()
{
vtkLineSource* line =  vtkLineSource::New();
line->SetPoint1(0,0,0);
line->SetPoint2(1,1,1);

vtkPolyData* poly = vtkPolyData::New();
poly->DeepCopy(line->GetOutput());
line->Delete();

vtkIdFilter* filter =  vtkIdFilter::New();
filter->PointIdsOn();
filter->ReleaseDataFlagOff();
filter->SetInput( poly );

vtkLabeledDataMapper* mapper =  vtkLabeledDataMapper::New();
mapper->SetLabelModeTolabelIds();
mapper->SetInput( filter->GetOutput() );

vtkActor2D* myActor2D =  vtkActor2D::New();
myActor2D->SetMapper( mapper );
mapper->Delete();
filter->Delete();
}

and later I want to change the upstream vtkPolyData in a different
function call. With a mapper, I can do things like this:

(vtkLabeledDataMapper::SafeDownCast( myActor2D->GetMapper()))->Update();

which is one step upstream.  How do I retrieve the vtkIdFilter 
3 steps upstream to input a different vtkPolyData without 
maintaining a variable for the vtkIdFiler?

thanks,
Dean





More information about the vtkusers mailing list