------------------------------------------------------------------------------
| 454 | |
| 455 | //------------------------------------------------------------------------------ |
| 456 | vtkIdType vtkVariantArray::InsertNextTuple(vtkIdType j, vtkAbstractArray* source) |
| 457 | { |
| 458 | if (source->IsA("vtkVariantArray")) |
| 459 | { |
| 460 | vtkVariantArray* a = vtkArrayDownCast<vtkVariantArray>(source); |
| 461 | vtkIdType locj = j * a->GetNumberOfComponents(); |
| 462 | for (vtkIdType cur = 0; cur < this->NumberOfComponents; cur++) |
| 463 | { |
| 464 | this->InsertNextValue(a->GetValue(locj + cur)); |
| 465 | } |
| 466 | } |
| 467 | else if (source->IsA("vtkDataArray")) |
| 468 | { |
| 469 | vtkDataArray* a = vtkArrayDownCast<vtkDataArray>(source); |
| 470 | vtkIdType locj = j * a->GetNumberOfComponents(); |
| 471 | for (vtkIdType cur = 0; cur < this->NumberOfComponents; cur++) |
| 472 | { |
| 473 | vtkIdType tuple = (locj + cur) / a->GetNumberOfComponents(); |
| 474 | int component = static_cast<int>((locj + cur) % a->GetNumberOfComponents()); |
| 475 | this->InsertNextValue(ValueType(a->GetComponent(tuple, component))); |
| 476 | } |
| 477 | } |
| 478 | else if (source->IsA("vtkStringArray")) |
| 479 | { |
| 480 | vtkStringArray* a = vtkArrayDownCast<vtkStringArray>(source); |
| 481 | vtkIdType locj = j * a->GetNumberOfComponents(); |
| 482 | for (vtkIdType cur = 0; cur < this->NumberOfComponents; cur++) |
| 483 | { |
| 484 | this->InsertNextValue(ValueType(a->GetValue(locj + cur))); |
| 485 | } |
| 486 | } |
| 487 | else |
| 488 | { |
| 489 | vtkWarningMacro("Unrecognized type is incompatible with vtkVariantArray."); |
| 490 | return -1; |
| 491 | } |
| 492 | |
| 493 | this->DataChanged(); |
| 494 | return (this->GetNumberOfTuples() - 1); |
| 495 | } |
| 496 | |
| 497 | //------------------------------------------------------------------------------ |
| 498 | void* vtkVariantArray::GetVoidPointer(vtkIdType id) |
nothing calls this directly
no test coverage detected