MCPcopy Create free account
hub / github.com/Kitware/VTK / InsertNextTuple

Method InsertNextTuple

Common/Core/vtkVariantArray.cxx:456–495  ·  view source on GitHub ↗

------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

454
455//------------------------------------------------------------------------------
456vtkIdType 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//------------------------------------------------------------------------------
498void* vtkVariantArray::GetVoidPointer(vtkIdType id)

Callers

nothing calls this directly

Calls 8

InsertNextValueMethod · 0.95
DataChangedMethod · 0.95
IsAMethod · 0.80
ValueTypeEnum · 0.50
GetNumberOfComponentsMethod · 0.45
GetValueMethod · 0.45
GetComponentMethod · 0.45
GetNumberOfTuplesMethod · 0.45

Tested by

no test coverage detected