[vtkusers] vtkContourWidget modif
    Dean Inglis 
    dean.inglis at camris.ca
       
    Wed Jan 31 10:27:31 EST 2007
    
    
  
Hi Karthik,
I took your advice and locally modified my
vtkContourWidget source to include the following
method to init the widget from user supplied
polydata.  My point in bringing this up again
is that it would be convenient to be able
to clear the content of the contour representation 
programatically. Code below only works for
vtkOrientedGlyphContourRepresentation but if I get
time I may look at the other reps to make this more
generic.
Dean
//----------------------------------------------------------------------
void vtkContourWidget::InitializeFromUserSuppliedPolyData(vtkPolyData* pd)
{
  if ( pd == NULL )
    {
    vtkContourRepresentation *rep =
       vtkContourRepresentation::SafeDownCast(this->WidgetRep);
      
    while( rep->DeleteLastNode() );
    rep->ClosedLoopOff();
      
    this->WidgetState = vtkContourWidget::Start;
    
    return;
    }
  if ( pd->GetPoints()->GetNumberOfPoints() <= 0 )
    {
    return; // Yeah right.. build from nothing !
    }
  vtkOrientedGlyphContourRepresentation* rep = 
     vtkOrientedGlyphContourRepresentation::SafeDownCast(this->WidgetRep);
  if ( rep )
    {
    rep->BuildRepresentationFromUserSuppliedPolydata(pd);
    this->WidgetState = vtkContourWidget::Manipulate;
    }
} 
    
    
More information about the vtkusers
mailing list