MCPcopy Create free account
hub / github.com/Kitware/VTK / SetInputDataObject

Method SetInputDataObject

Common/ExecutionModel/vtkAlgorithm.cxx:1994–2029  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

1992
1993//------------------------------------------------------------------------------
1994void vtkAlgorithm::SetInputDataObject(int port, vtkDataObject* input)
1995{
1996 if (input == nullptr)
1997 {
1998 // Setting a nullptr input removes the connection.
1999 this->SetInputConnection(port, nullptr);
2000 return;
2001 }
2002
2003 // We need to setup a trivial producer connection. However, we need to ensure
2004 // that the input is indeed different from what's currently setup otherwise
2005 // the algorithm will be modified unnecessarily. This will make it possible
2006 // for users to call SetInputData(..) with the same data-output and not have
2007 // the filter re-execute unless the data really changed.
2008
2009 if (!this->InputPortIndexInRange(port, "connect"))
2010 {
2011 return;
2012 }
2013
2014 if (this->GetNumberOfInputConnections(port) == 1)
2015 {
2016 vtkAlgorithmOutput* current = this->GetInputConnection(port, 0);
2017 vtkAlgorithm* producer = current ? current->GetProducer() : nullptr;
2018 if (vtkTrivialProducer::SafeDownCast(producer) && producer->GetOutputDataObject(0) == input)
2019 {
2020 // the data object is unchanged. Nothing to do here.
2021 return;
2022 }
2023 }
2024
2025 vtkTrivialProducer* tp = vtkTrivialProducer::New();
2026 tp->SetOutput(input);
2027 this->SetInputConnection(port, tp->GetOutputPort());
2028 tp->Delete();
2029}
2030
2031//------------------------------------------------------------------------------
2032void vtkAlgorithm::AddInputDataObject(int port, vtkDataObject* input)

Callers 15

RenderMethod · 0.45
TestFunction · 0.45
GetMinVolumeFunction · 0.45
TestGLTFWriterFunction · 0.45
WriteDataObjectMethod · 0.45
WriteTextureMethod · 0.45
WriteTextureLODSeriesMethod · 0.45
WritePolyLODSeriesMethod · 0.45
X3DTestFunction · 0.45
TestGDALRasterPaletteFunction · 0.45
TestGDALVectorReaderFunction · 0.45

Calls 10

SetInputConnectionMethod · 0.95
InputPortIndexInRangeMethod · 0.95
GetInputConnectionMethod · 0.95
GetProducerMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetOutputDataObjectMethod · 0.45
SetOutputMethod · 0.45
GetOutputPortMethod · 0.45

Tested by 15

RenderMethod · 0.36
TestFunction · 0.36
GetMinVolumeFunction · 0.36
TestGLTFWriterFunction · 0.36
X3DTestFunction · 0.36
TestGDALRasterPaletteFunction · 0.36
TestGDALVectorReaderFunction · 0.36
TestGDALRasterReaderFunction · 0.36
TestOMFReaderFunction · 0.36