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

Method SetValue

Common/DataModel/vtkTable.cxx:554–628  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

552
553//------------------------------------------------------------------------------
554void vtkTable::SetValue(vtkIdType row, vtkIdType col, vtkVariant value)
555{
556 vtkAbstractArray* arr = this->GetColumn(col);
557 if (!arr)
558 {
559 return;
560 }
561 int comps = arr->GetNumberOfComponents();
562 if (vtkArrayDownCast<vtkDataArray>(arr))
563 {
564 vtkDataArray* data = vtkArrayDownCast<vtkDataArray>(arr);
565 if (comps == 1)
566 {
567 data->SetVariantValue(row, value);
568 }
569 else
570 {
571 if (value.IsArray() && vtkArrayDownCast<vtkDataArray>(value.ToArray()) &&
572 value.ToArray()->GetNumberOfComponents() == comps)
573 {
574 data->SetTuple(row, vtkArrayDownCast<vtkDataArray>(value.ToArray())->GetTuple(0));
575 }
576 else
577 {
578 vtkWarningMacro("Cannot assign this variant type to multi-component data array.");
579 return;
580 }
581 }
582 }
583 else if (vtkArrayDownCast<vtkStringArray>(arr))
584 {
585 vtkStringArray* data = vtkArrayDownCast<vtkStringArray>(arr);
586 if (comps == 1)
587 {
588 data->SetValue(row, value.ToString());
589 }
590 else
591 {
592 if (value.IsArray() && vtkArrayDownCast<vtkStringArray>(value.ToArray()) &&
593 value.ToArray()->GetNumberOfComponents() == comps)
594 {
595 data->SetTuple(row, 0, vtkArrayDownCast<vtkStringArray>(value.ToArray()));
596 }
597 else
598 {
599 vtkWarningMacro("Cannot assign this variant type to multi-component string array.");
600 return;
601 }
602 }
603 }
604 else if (vtkArrayDownCast<vtkVariantArray>(arr))
605 {
606 vtkVariantArray* data = vtkArrayDownCast<vtkVariantArray>(arr);
607 if (comps == 1)
608 {
609 data->SetValue(row, value);
610 }
611 else

Callers 15

SetRowMethod · 0.95
InsertNextRowMethod · 0.95
SetValueByNameMethod · 0.95
SubdivideMethod · 0.45
ContourMethod · 0.45
ClipMethod · 0.45
GetEdgeMethod · 0.45
GetFaceMethod · 0.45
ContourMethod · 0.45
ClipMethod · 0.45
ContourMethod · 0.45

Calls 8

GetColumnMethod · 0.95
IsArrayMethod · 0.80
GetNumberOfComponentsMethod · 0.45
SetVariantValueMethod · 0.45
ToArrayMethod · 0.45
SetTupleMethod · 0.45
GetTupleMethod · 0.45
ToStringMethod · 0.45

Tested by

no test coverage detected