------------------------------------------------------------------------------
| 105 | |
| 106 | //------------------------------------------------------------------------------ |
| 107 | int vtkConvertSelection::SelectTableFromTable( |
| 108 | vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices) |
| 109 | { |
| 110 | std::set<vtkIdType> matching; |
| 111 | vtkNew<vtkIdList> list; |
| 112 | for (vtkIdType row = 0; row < selTable->GetNumberOfRows(); row++) |
| 113 | { |
| 114 | matching.clear(); |
| 115 | bool initialized = false; |
| 116 | for (vtkIdType col = 0; col < selTable->GetNumberOfColumns(); col++) |
| 117 | { |
| 118 | vtkAbstractArray* from = selTable->GetColumn(col); |
| 119 | vtkAbstractArray* to = dataTable->GetColumnByName(from->GetName()); |
| 120 | if (to) |
| 121 | { |
| 122 | to->LookupValue(selTable->GetValue(row, col), list); |
| 123 | if (!initialized) |
| 124 | { |
| 125 | matching.insert(list->GetPointer(0), list->GetPointer(0) + list->GetNumberOfIds()); |
| 126 | initialized = true; |
| 127 | } |
| 128 | else |
| 129 | { |
| 130 | std::set<vtkIdType> intersection; |
| 131 | std::sort(list->GetPointer(0), list->GetPointer(0) + list->GetNumberOfIds()); |
| 132 | std::set_intersection(matching.begin(), matching.end(), list->GetPointer(0), |
| 133 | list->GetPointer(0) + list->GetNumberOfIds(), |
| 134 | std::inserter(intersection, intersection.begin())); |
| 135 | matching = intersection; |
| 136 | } |
| 137 | } |
| 138 | } |
| 139 | for (const auto& match : matching) |
| 140 | { |
| 141 | indices->InsertNextValue(match); |
| 142 | } |
| 143 | if (row % 100 == 0) |
| 144 | { |
| 145 | double progress = 0.8 * row / selTable->GetNumberOfRows(); |
| 146 | this->InvokeEvent(vtkCommand::ProgressEvent, &progress); |
| 147 | } |
| 148 | } |
| 149 | return 1; |
| 150 | } |
| 151 | |
| 152 | //------------------------------------------------------------------------------ |
| 153 | int vtkConvertSelection::ConvertToIndexSelection( |
no test coverage detected