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

Method RequestData

Infovis/Core/vtkTableToGraph.cxx:347–839  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

345
346//------------------------------------------------------------------------------
347int 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"));

Callers

nothing calls this directly

Calls 15

ValidateLinkGraphMethod · 0.95
GetInformationObjectMethod · 0.80
GetAbstractArrayMethod · 0.80
GetVertexDataMethod · 0.80
SetSelectionListMethod · 0.80
GetColumnByNameMethod · 0.80
SetValueByNameMethod · 0.80
InvokeEventMethod · 0.80
GetValueByNameMethod · 0.80
GetRowDataMethod · 0.80

Tested by

no test coverage detected