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

Method AddLinkVertex

Infovis/Core/vtkTableToGraph.cxx:120–172  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

118
119//------------------------------------------------------------------------------
120void vtkTableToGraph::AddLinkVertex(const char* column, const char* domain, int hidden)
121{
122 if (!column)
123 {
124 vtkErrorMacro("Column name cannot be null");
125 return;
126 }
127
128 vtkStdString domainStr;
129 if (domain)
130 {
131 domainStr = domain;
132 }
133
134 if (!this->ValidateLinkGraph())
135 {
136 return;
137 }
138
139 vtkStringArray* columnArr =
140 vtkArrayDownCast<vtkStringArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("column"));
141 vtkStringArray* domainArr =
142 vtkArrayDownCast<vtkStringArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("domain"));
143 vtkBitArray* hiddenArr =
144 vtkArrayDownCast<vtkBitArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("hidden"));
145 vtkIntArray* activeArr =
146 vtkArrayDownCast<vtkIntArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("active"));
147
148 vtkIdType index = -1;
149 for (vtkIdType i = 0; i < this->LinkGraph->GetNumberOfVertices(); i++)
150 {
151 if (column == columnArr->GetValue(i))
152 {
153 index = i;
154 break;
155 }
156 }
157 if (index >= 0)
158 {
159 domainArr->SetValue(index, domainStr);
160 hiddenArr->SetValue(index, hidden);
161 activeArr->SetValue(index, 1);
162 }
163 else
164 {
165 this->LinkGraph->AddVertex();
166 columnArr->InsertNextValue(column);
167 domainArr->InsertNextValue(domainStr);
168 hiddenArr->InsertNextValue(hidden);
169 activeArr->InsertNextValue(1);
170 }
171 this->Modified();
172}
173
174//------------------------------------------------------------------------------
175void vtkTableToGraph::ClearLinkVertices()

Callers 6

AddLinkEdgeMethod · 0.95
TestNetworkViewsFunction · 0.45
TestKCoreLayoutFunction · 0.45
TestStreamGraphFunction · 0.45
TestTableToGraphFunction · 0.45
TestMergeGraphsFunction · 0.45

Calls 9

ValidateLinkGraphMethod · 0.95
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
GetNumberOfVerticesMethod · 0.80
GetValueMethod · 0.45
SetValueMethod · 0.45
AddVertexMethod · 0.45
InsertNextValueMethod · 0.45
ModifiedMethod · 0.45

Tested by 5

TestNetworkViewsFunction · 0.36
TestKCoreLayoutFunction · 0.36
TestStreamGraphFunction · 0.36
TestTableToGraphFunction · 0.36
TestMergeGraphsFunction · 0.36