------------------------------------------------------------------------------
| 331 | |
| 332 | //------------------------------------------------------------------------------ |
| 333 | void vtkSelectionNode::UnionSelectionList(vtkSelectionNode* other) |
| 334 | { |
| 335 | int type = this->Properties->Get(CONTENT_TYPE()); |
| 336 | switch (type) |
| 337 | { |
| 338 | case GLOBALIDS: |
| 339 | case PEDIGREEIDS: |
| 340 | case VALUES: |
| 341 | case INDICES: |
| 342 | case LOCATIONS: |
| 343 | case THRESHOLDS: |
| 344 | case BLOCKS: |
| 345 | case BLOCK_SELECTORS: |
| 346 | { |
| 347 | vtkDataSetAttributes* fd1 = this->GetSelectionData(); |
| 348 | vtkDataSetAttributes* fd2 = other->GetSelectionData(); |
| 349 | if (fd1->GetNumberOfArrays() != fd2->GetNumberOfArrays()) |
| 350 | { |
| 351 | vtkErrorMacro(<< "Cannot take the union where the number of arrays do not match."); |
| 352 | } |
| 353 | for (int i = 0; i < fd1->GetNumberOfArrays(); i++) |
| 354 | { |
| 355 | vtkAbstractArray* aa1 = fd1->GetAbstractArray(i); |
| 356 | vtkAbstractArray* aa2 = nullptr; |
| 357 | if (i == 0 && type != VALUES && type != THRESHOLDS) |
| 358 | { |
| 359 | aa2 = fd2->GetAbstractArray(i); |
| 360 | } |
| 361 | else |
| 362 | { |
| 363 | aa2 = fd2->GetAbstractArray(aa1->GetName()); |
| 364 | } |
| 365 | if (!aa2) |
| 366 | { |
| 367 | vtkErrorMacro(<< "Could not find array with name " << aa1->GetName() |
| 368 | << " in other selection."); |
| 369 | return; |
| 370 | } |
| 371 | if (aa1->GetDataType() != aa2->GetDataType()) |
| 372 | { |
| 373 | vtkErrorMacro(<< "Cannot take the union where selection list types " |
| 374 | << "do not match."); |
| 375 | return; |
| 376 | } |
| 377 | if (aa1->GetNumberOfComponents() != aa2->GetNumberOfComponents()) |
| 378 | { |
| 379 | vtkErrorMacro(<< "Cannot take the union where selection list number " |
| 380 | << "of components do not match."); |
| 381 | return; |
| 382 | } |
| 383 | // If it is the same array, we are done. |
| 384 | if (aa1 == aa2) |
| 385 | { |
| 386 | return; |
| 387 | } |
| 388 | int numComps = aa2->GetNumberOfComponents(); |
| 389 | vtkIdType numTuples = aa2->GetNumberOfTuples(); |
| 390 | for (vtkIdType j = 0; j < numTuples; j++) |
no test coverage detected