------------------------------------------------------------------------------
| 77 | |
| 78 | //------------------------------------------------------------------------------ |
| 79 | int vtkCellDistanceSelector::RequestData(vtkInformation* vtkNotUsed(request), |
| 80 | vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 81 | { |
| 82 | |
| 83 | // Retrieve input mesh as composite object |
| 84 | vtkInformation* inDataObjectInfo = inputVector[INPUT_MESH]->GetInformationObject(0); |
| 85 | vtkCompositeDataSet* compositeInput = |
| 86 | vtkCompositeDataSet::SafeDownCast(inDataObjectInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 87 | |
| 88 | // Retrieve input selection |
| 89 | vtkInformation* inSelectionInfo = inputVector[INPUT_SELECTION]->GetInformationObject(0); |
| 90 | vtkSelection* inputSelection = |
| 91 | vtkSelection::SafeDownCast(inSelectionInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 92 | |
| 93 | // Retrieve output selection |
| 94 | vtkInformation* outInfo = outputVector->GetInformationObject(0); |
| 95 | vtkSelection* output = vtkSelection::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 96 | |
| 97 | if (!compositeInput) |
| 98 | { |
| 99 | vtkErrorMacro(<< "Missing input data object"); |
| 100 | return 0; |
| 101 | } |
| 102 | |
| 103 | if (!inputSelection) |
| 104 | { |
| 105 | vtkErrorMacro(<< "Missing input selection"); |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | std::map<int, std::vector<vtkSelectionNode*>> partSelections; |
| 110 | int nSelNodes = inputSelection->GetNumberOfNodes(); |
| 111 | for (int i = 0; i < nSelNodes; ++i) |
| 112 | { |
| 113 | vtkSelectionNode* sn = inputSelection->GetNode(i); |
| 114 | int composite_index = sn->GetProperties()->Get(vtkSelectionNode::COMPOSITE_INDEX()); |
| 115 | partSelections[composite_index].push_back(sn); |
| 116 | } |
| 117 | |
| 118 | vtkCompositeDataIterator* inputIterator = compositeInput->NewIterator(); |
| 119 | inputIterator->SkipEmptyNodesOn(); |
| 120 | inputIterator->InitTraversal(); |
| 121 | inputIterator->GoToFirstItem(); |
| 122 | while (!inputIterator->IsDoneWithTraversal()) |
| 123 | { |
| 124 | vtkDataSet* input = vtkDataSet::SafeDownCast(inputIterator->GetCurrentDataObject()); |
| 125 | // NB: composite indices start at 1 |
| 126 | int composite_index = inputIterator->GetCurrentFlatIndex(); |
| 127 | inputIterator->GoToNextItem(); |
| 128 | |
| 129 | std::vector<vtkSelectionNode*>::iterator selNodeIt = partSelections[composite_index].begin(); |
| 130 | while (selNodeIt != partSelections[composite_index].end()) |
| 131 | { |
| 132 | vtkSelectionNode* selectionNode = *selNodeIt; |
| 133 | ++selNodeIt; |
| 134 | |
| 135 | vtkDataArray* selectionList = |
| 136 | vtkArrayDownCast<vtkDataArray>(selectionNode->GetSelectionList()); |
nothing calls this directly
no test coverage detected