------------------------------------------------------------------------------
| 359 | |
| 360 | //------------------------------------------------------------------------------ |
| 361 | void vtkVariantArray::InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) |
| 362 | { |
| 363 | |
| 364 | if (this->NumberOfComponents != source->GetNumberOfComponents()) |
| 365 | { |
| 366 | vtkWarningMacro("Input and output component sizes do not match."); |
| 367 | return; |
| 368 | } |
| 369 | |
| 370 | vtkIdType numIds = dstIds->GetNumberOfIds(); |
| 371 | if (srcIds->GetNumberOfIds() != numIds) |
| 372 | { |
| 373 | vtkWarningMacro("Input and output id array sizes do not match."); |
| 374 | return; |
| 375 | } |
| 376 | |
| 377 | if (vtkVariantArray* va = vtkArrayDownCast<vtkVariantArray>(source)) |
| 378 | { |
| 379 | for (vtkIdType idIndex = 0; idIndex < numIds; ++idIndex) |
| 380 | { |
| 381 | vtkIdType numComp = this->NumberOfComponents; |
| 382 | vtkIdType srcLoc = srcIds->GetId(idIndex) * this->NumberOfComponents; |
| 383 | vtkIdType dstLoc = dstIds->GetId(idIndex) * this->NumberOfComponents; |
| 384 | while (numComp-- > 0) |
| 385 | { |
| 386 | this->InsertValue(dstLoc++, va->GetValue(srcLoc++)); |
| 387 | } |
| 388 | } |
| 389 | } |
| 390 | else if (vtkDataArray* da = vtkDataArray::FastDownCast(source)) |
| 391 | { |
| 392 | for (vtkIdType idIndex = 0; idIndex < numIds; ++idIndex) |
| 393 | { |
| 394 | vtkIdType numComp = this->NumberOfComponents; |
| 395 | vtkIdType srcLoc = srcIds->GetId(idIndex) * this->NumberOfComponents; |
| 396 | vtkIdType dstLoc = dstIds->GetId(idIndex) * this->NumberOfComponents; |
| 397 | while (numComp-- > 0) |
| 398 | { |
| 399 | this->InsertValue(dstLoc++, da->GetVariantValue(srcLoc++)); |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | else if (vtkStringArray* sa = vtkArrayDownCast<vtkStringArray>(source)) |
| 404 | { |
| 405 | for (vtkIdType idIndex = 0; idIndex < numIds; ++idIndex) |
| 406 | { |
| 407 | vtkIdType numComp = this->NumberOfComponents; |
| 408 | vtkIdType srcLoc = srcIds->GetId(idIndex) * this->NumberOfComponents; |
| 409 | vtkIdType dstLoc = dstIds->GetId(idIndex) * this->NumberOfComponents; |
| 410 | while (numComp-- > 0) |
| 411 | { |
| 412 | this->InsertValue(dstLoc++, sa->GetVariantValue(srcLoc++)); |
| 413 | } |
| 414 | } |
| 415 | } |
| 416 | else |
| 417 | { |
| 418 | vtkWarningMacro("Unrecognized type is incompatible with vtkVariantArray."); |
nothing calls this directly
no test coverage detected