------------------------------------------------------------------------------
| 48 | |
| 49 | //------------------------------------------------------------------------------ |
| 50 | int vtkStreamGraph::RequestData( |
| 51 | vtkInformation*, vtkInformationVector** inputVector, vtkInformationVector* outputVector) |
| 52 | { |
| 53 | vtkInformation* input_info = inputVector[0]->GetInformationObject(0); |
| 54 | vtkGraph* input = vtkGraph::SafeDownCast(input_info->Get(vtkDataObject::DATA_OBJECT())); |
| 55 | |
| 56 | // Copy structure into output graph. |
| 57 | vtkInformation* outputInfo = outputVector->GetInformationObject(0); |
| 58 | vtkGraph* output = vtkGraph::SafeDownCast(outputInfo->Get(vtkDataObject::DATA_OBJECT())); |
| 59 | |
| 60 | double progress = 0.1; |
| 61 | this->InvokeEvent(vtkCommand::ProgressEvent, &progress); |
| 62 | |
| 63 | // First pass: make a copy of the graph and we're done |
| 64 | if (!this->CurrentGraph->GetGraph()) |
| 65 | { |
| 66 | if (vtkDirectedGraph::SafeDownCast(input)) |
| 67 | { |
| 68 | vtkSmartPointer<vtkMutableDirectedGraph> g = vtkSmartPointer<vtkMutableDirectedGraph>::New(); |
| 69 | this->CurrentGraph->SetGraph(g); |
| 70 | } |
| 71 | else |
| 72 | { |
| 73 | vtkSmartPointer<vtkMutableUndirectedGraph> g = |
| 74 | vtkSmartPointer<vtkMutableUndirectedGraph>::New(); |
| 75 | this->CurrentGraph->SetGraph(g); |
| 76 | } |
| 77 | this->CurrentGraph->GetGraph()->DeepCopy(input); |
| 78 | if (!output->CheckedShallowCopy(input)) |
| 79 | { |
| 80 | vtkErrorMacro("Output graph format invalid."); |
| 81 | return 0; |
| 82 | } |
| 83 | return 1; |
| 84 | } |
| 85 | |
| 86 | progress = 0.2; |
| 87 | this->InvokeEvent(vtkCommand::ProgressEvent, &progress); |
| 88 | |
| 89 | this->MergeGraphs->SetUseEdgeWindow(this->UseEdgeWindow); |
| 90 | this->MergeGraphs->SetEdgeWindowArrayName(this->EdgeWindowArrayName); |
| 91 | this->MergeGraphs->SetEdgeWindow(this->EdgeWindow); |
| 92 | |
| 93 | if (!this->MergeGraphs->ExtendGraph(this->CurrentGraph, input)) |
| 94 | { |
| 95 | return 0; |
| 96 | } |
| 97 | |
| 98 | progress = 0.9; |
| 99 | this->InvokeEvent(vtkCommand::ProgressEvent, &progress); |
| 100 | |
| 101 | output->DeepCopy(this->CurrentGraph->GetGraph()); |
| 102 | |
| 103 | return 1; |
| 104 | } |
| 105 | |
| 106 | //------------------------------------------------------------------------------ |
| 107 | void vtkStreamGraph::PrintSelf(ostream& os, vtkIndent indent) |
nothing calls this directly
no test coverage detected