------------------------------------------------------------------------------
| 296 | |
| 297 | //------------------------------------------------------------------------------ |
| 298 | void vtkTableToGraphFindVertices(vtkAbstractArray* arr, // The raw edge table column |
| 299 | vtkIdType size, // The size of the edge table column |
| 300 | std::map<std::pair<vtkStdString, vtkVariant>, vtkIdType, vtkTableToGraphCompare>& vertexMap, |
| 301 | // A map of domain-value pairs to graph id |
| 302 | vtkStringArray* domainArr, // The domain of each vertex |
| 303 | vtkStringArray* labelArr, // The label of each vertex |
| 304 | vtkVariantArray* idArr, // The pedigree id of each vertex |
| 305 | vtkIdType& curVertex, // The current vertex id |
| 306 | vtkTable* vertexTable, // An array that holds the actual value of each vertex |
| 307 | vtkStdString domain) // The domain of the array |
| 308 | { |
| 309 | for (vtkIdType i = 0; i < size; i++) |
| 310 | { |
| 311 | vtkVariant val = arr->GetVariantValue(i); |
| 312 | std::pair<vtkStdString, vtkVariant> value(domain, val); |
| 313 | if (vertexMap.count(value) == 0) |
| 314 | { |
| 315 | vtkIdType row = vertexTable->InsertNextBlankRow(); |
| 316 | vertexTable->SetValueByName(row, domain.c_str(), val); |
| 317 | vertexMap[value] = row; |
| 318 | domainArr->InsertNextValue(domain); |
| 319 | labelArr->InsertNextValue(val.ToString()); |
| 320 | idArr->InsertNextValue(val); |
| 321 | curVertex = row; |
| 322 | } |
| 323 | } |
| 324 | } |
| 325 | |
| 326 | //------------------------------------------------------------------------------ |
| 327 | void vtkTableToGraphFindHiddenVertices(vtkAbstractArray* arr, // The raw edge table column |
no test coverage detected