[vtkusers] How to make a filter operate on either mutable directed or mutable undirected graph

David Doria daviddoria+vtk at gmail.com
Tue Mar 30 11:47:01 EDT 2010


I want am trying to make a filter that computes and adds a weight
array to either a vtkMutableUndirectedGraph or a
vtkMutableDirectedGraph. The filter derives from vtkGraphAlgorithm. It
seems like in the RequestDataObject I need to decide the type of the
output:

int vtkEuclideanWeightFilter::RequestDataObject(vtkInformation
*vtkNotUsed(request),
                                         vtkInformationVector **inputVector,
                                         vtkInformationVector *outputVector)
{
  vtkMutableUndirectedGraph* output = 0;
  output = vtkMutableUndirectedGraph::New();

  this->GetExecutive()->SetOutputData(0, output);
  output->Delete();

  return 1;
}

So then in the RequestData function, any logic to determine which type
the input is doesn't matter because the output type has already been
defined. Is there a way to make the output type match the input type?
Or would I need a vtkEuclideanWeightFilterUndirected which takes and
outputs a vtkMutableUndirectedGraph and a
vtkEucludeanWeightFilterDIrected which takes and outputs a
vtkMutableDirectedGraph?

Thanks,

David



More information about the vtkusers mailing list