------------------------------------------------------------------------------ Specify the input data or filter.
| 63 | //------------------------------------------------------------------------------ |
| 64 | // Specify the input data or filter. |
| 65 | void vtkExtractVectorComponents::SetInputData(vtkDataSet* input) |
| 66 | { |
| 67 | if (this->GetNumberOfInputConnections(0) > 0 && this->GetInput(0) == input) |
| 68 | { |
| 69 | return; |
| 70 | } |
| 71 | |
| 72 | this->Superclass::SetInputData(0, input); |
| 73 | |
| 74 | if (input == nullptr) |
| 75 | { |
| 76 | return; |
| 77 | } |
| 78 | |
| 79 | vtkDataSet* output; |
| 80 | if (!this->OutputsInitialized) |
| 81 | { |
| 82 | output = input->NewInstance(); |
| 83 | this->GetExecutive()->SetOutputData(0, output); |
| 84 | output->Delete(); |
| 85 | output = input->NewInstance(); |
| 86 | this->GetExecutive()->SetOutputData(1, output); |
| 87 | output->Delete(); |
| 88 | output = input->NewInstance(); |
| 89 | this->GetExecutive()->SetOutputData(2, output); |
| 90 | output->Delete(); |
| 91 | this->OutputsInitialized = 1; |
| 92 | return; |
| 93 | } |
| 94 | |
| 95 | // since the input has changed we might need to create a new output |
| 96 | // It seems that output 0 is the correct type as a result of the call to |
| 97 | // the superclass's SetInput. Check the type of output 1 instead. |
| 98 | if (strcmp(this->GetOutput(1)->GetClassName(), input->GetClassName()) != 0) |
| 99 | { |
| 100 | output = input->NewInstance(); |
| 101 | this->GetExecutive()->SetOutputData(0, output); |
| 102 | output->Delete(); |
| 103 | output = input->NewInstance(); |
| 104 | this->GetExecutive()->SetOutputData(1, output); |
| 105 | output->Delete(); |
| 106 | output = input->NewInstance(); |
| 107 | this->GetExecutive()->SetOutputData(2, output); |
| 108 | output->Delete(); |
| 109 | vtkWarningMacro(<< " a new output had to be created since the input type changed."); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | //------------------------------------------------------------------------------ |
| 114 | namespace |