------------------------------------------------------------------------------
| 191 | |
| 192 | //------------------------------------------------------------------------------ |
| 193 | int vtkPassInputTypeAlgorithm::RequestDataObject( |
| 194 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 195 | { |
| 196 | if (this->GetNumberOfInputPorts() == 0 || this->GetNumberOfOutputPorts() == 0) |
| 197 | { |
| 198 | return 1; |
| 199 | } |
| 200 | |
| 201 | vtkInformation* inInfo = inputVector[0]->GetInformationObject(0); |
| 202 | if (!inInfo) |
| 203 | { |
| 204 | return 0; |
| 205 | } |
| 206 | vtkDataObject* input = inInfo->Get(vtkDataObject::DATA_OBJECT()); |
| 207 | |
| 208 | if (input) |
| 209 | { |
| 210 | // for each output |
| 211 | for (int i = 0; i < this->GetNumberOfOutputPorts(); ++i) |
| 212 | { |
| 213 | vtkInformation* info = outputVector->GetInformationObject(i); |
| 214 | vtkDataObject* output = info->Get(vtkDataObject::DATA_OBJECT()); |
| 215 | |
| 216 | if (!output || !output->IsA(input->GetClassName())) |
| 217 | { |
| 218 | vtkDataObject* newOutput = input->NewInstance(); |
| 219 | info->Set(vtkDataObject::DATA_OBJECT(), newOutput); |
| 220 | newOutput->Delete(); |
| 221 | } |
| 222 | } |
| 223 | return 1; |
| 224 | } |
| 225 | return 0; |
| 226 | } |
| 227 | |
| 228 | //------------------------------------------------------------------------------ |
| 229 | int vtkPassInputTypeAlgorithm::FillOutputPortInformation(int vtkNotUsed(port), vtkInformation* info) |
no test coverage detected