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

Method SetTable

Views/Infovis/vtkTreeHeatmapItem.cxx:70–136  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

68
69//------------------------------------------------------------------------------
70void vtkTreeHeatmapItem::SetTable(vtkTable* table)
71{
72 this->Heatmap->SetTable(table);
73 if (table == nullptr)
74 {
75 return;
76 }
77
78 if (this->Dendrogram->GetTree() != nullptr &&
79 this->Dendrogram->GetTree()->GetNumberOfVertices() != 0)
80 {
81 this->Dendrogram->SetDrawLabels(false);
82 }
83 this->Heatmap->SetVisible(true);
84
85 // rearrange our table to match the order of the leaf nodes in this tree.
86 if (this->GetTree() != nullptr && this->GetTree()->GetNumberOfVertices() != 0)
87 {
88 this->ReorderTable();
89 }
90
91 // add an array to this table's field data to keep track of collapsed rows
92 // (unless it already has the array)
93 vtkBitArray* existingRowsArray =
94 vtkArrayDownCast<vtkBitArray>(this->GetTable()->GetFieldData()->GetArray("collapsed rows"));
95 if (existingRowsArray)
96 {
97 for (vtkIdType row = 0; row < this->GetTable()->GetNumberOfRows(); ++row)
98 {
99 existingRowsArray->SetValue(row, 0);
100 }
101 }
102 else
103 {
104 vtkSmartPointer<vtkBitArray> collapsedRowsArray = vtkSmartPointer<vtkBitArray>::New();
105 collapsedRowsArray->SetNumberOfComponents(1);
106 collapsedRowsArray->SetName("collapsed rows");
107 for (vtkIdType row = 0; row < this->GetTable()->GetNumberOfRows(); ++row)
108 {
109 collapsedRowsArray->InsertNextValue(0);
110 }
111 this->GetTable()->GetFieldData()->AddArray(collapsedRowsArray);
112 }
113
114 // add an array to this table's field data to keep track of collapsed columns
115 // (unless it already has the array)
116 vtkBitArray* existingColumnsArray =
117 vtkArrayDownCast<vtkBitArray>(this->GetTable()->GetFieldData()->GetArray("collapsed columns"));
118 if (existingColumnsArray)
119 {
120 for (vtkIdType col = 0; col < this->GetTable()->GetNumberOfColumns(); ++col)
121 {
122 existingColumnsArray->SetValue(col, 0);
123 }
124 }
125 else
126 {
127 vtkSmartPointer<vtkBitArray> collapsedColumnsArray = vtkSmartPointer<vtkBitArray>::New();

Callers

nothing calls this directly

Calls 14

GetTreeMethod · 0.95
ReorderTableMethod · 0.95
GetTableMethod · 0.95
GetNumberOfVerticesMethod · 0.80
NewFunction · 0.50
GetArrayMethod · 0.45
GetFieldDataMethod · 0.45
GetNumberOfRowsMethod · 0.45
SetValueMethod · 0.45
SetNumberOfComponentsMethod · 0.45
SetNameMethod · 0.45
InsertNextValueMethod · 0.45

Tested by

no test coverage detected