------------------------------------------------------------------------------
| 345 | |
| 346 | //------------------------------------------------------------------------------ |
| 347 | int vtkTableToGraph::RequestData( |
| 348 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 349 | { |
| 350 | // Check that the link graph is valid |
| 351 | if (!this->ValidateLinkGraph()) |
| 352 | { |
| 353 | return 0; |
| 354 | } |
| 355 | |
| 356 | // Extract edge table |
| 357 | vtkInformation* edgeTableInfo = inputVector[0]->GetInformationObject(0); |
| 358 | vtkTable* edgeTable = vtkTable::SafeDownCast(edgeTableInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 359 | |
| 360 | // Extract vertex table |
| 361 | vtkInformation* vertexTableInfo = inputVector[1]->GetInformationObject(0); |
| 362 | vtkTable* vertexTable = nullptr; |
| 363 | if (vertexTableInfo) |
| 364 | { |
| 365 | vertexTable = vtkTable::SafeDownCast(vertexTableInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 366 | } |
| 367 | |
| 368 | if (vtkArrayDownCast<vtkIntArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("active"))) |
| 369 | { |
| 370 | // Extract only the active link graph. |
| 371 | vtkSelection* activeSel = vtkSelection::New(); |
| 372 | vtkSelectionNode* activeSelNode = vtkSelectionNode::New(); |
| 373 | activeSel->AddNode(activeSelNode); |
| 374 | activeSelNode->SetContentType(vtkSelectionNode::VALUES); |
| 375 | activeSelNode->SetFieldType(vtkSelectionNode::VERTEX); |
| 376 | vtkIntArray* list = vtkIntArray::New(); |
| 377 | list->SetName("active"); |
| 378 | list->InsertNextValue(1); |
| 379 | activeSelNode->SetSelectionList(list); |
| 380 | vtkExtractSelectedGraph* extract = vtkExtractSelectedGraph::New(); |
| 381 | extract->SetInputData(0, this->LinkGraph); |
| 382 | extract->SetInputData(1, activeSel); |
| 383 | extract->Update(); |
| 384 | vtkGraph* g = extract->GetOutput(); |
| 385 | this->LinkGraph->ShallowCopy(g); |
| 386 | list->Delete(); |
| 387 | activeSel->Delete(); |
| 388 | activeSelNode->Delete(); |
| 389 | extract->Delete(); |
| 390 | } |
| 391 | |
| 392 | vtkStringArray* linkColumn = |
| 393 | vtkArrayDownCast<vtkStringArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("column")); |
| 394 | |
| 395 | if (!linkColumn) |
| 396 | { |
| 397 | vtkErrorMacro("The link graph must have a string array named \"column\"."); |
| 398 | return 0; |
| 399 | } |
| 400 | |
| 401 | vtkStringArray* linkDomain = |
| 402 | vtkArrayDownCast<vtkStringArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("domain")); |
| 403 | vtkBitArray* linkHidden = |
| 404 | vtkArrayDownCast<vtkBitArray>(this->LinkGraph->GetVertexData()->GetAbstractArray("hidden")); |
nothing calls this directly
no test coverage detected