| 82 | vtkCxxSetObjectMacro(vtkSQLGraphReader, EdgeQuery, vtkSQLQuery); |
| 83 | |
| 84 | int vtkSQLGraphReader::RequestData( |
| 85 | vtkInformation*, vtkInformationVector**, vtkInformationVector* outputVector) |
| 86 | { |
| 87 | // Check for valid inputs |
| 88 | if (this->EdgeQuery == nullptr) |
| 89 | { |
| 90 | vtkErrorMacro("The EdgeQuery must be defined"); |
| 91 | return 0; |
| 92 | } |
| 93 | if (this->SourceField == nullptr) |
| 94 | { |
| 95 | vtkErrorMacro("The SourceField must be defined"); |
| 96 | return 0; |
| 97 | } |
| 98 | if (this->TargetField == nullptr) |
| 99 | { |
| 100 | vtkErrorMacro("The TargetField must be defined"); |
| 101 | return 0; |
| 102 | } |
| 103 | if (this->VertexQuery != nullptr) |
| 104 | { |
| 105 | if (this->VertexIdField == nullptr) |
| 106 | { |
| 107 | vtkErrorMacro("The VertexIdField must be defined when using a VertexQuery"); |
| 108 | return 0; |
| 109 | } |
| 110 | if (this->XField != nullptr && this->YField == nullptr) |
| 111 | { |
| 112 | vtkErrorMacro("The YField must be defined if the XField is defined"); |
| 113 | return 0; |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | vtkGraph* output = vtkGraph::GetData(outputVector); |
| 118 | |
| 119 | vtkTableToGraph* filter = vtkTableToGraph::New(); |
| 120 | filter->SetDirected(this->Directed); |
| 121 | |
| 122 | // Set up the internal filter to use the edge table |
| 123 | vtkSmartPointer<vtkRowQueryToTable> edgeReader = vtkSmartPointer<vtkRowQueryToTable>::New(); |
| 124 | edgeReader->SetQuery(this->EdgeQuery); |
| 125 | edgeReader->Update(); |
| 126 | |
| 127 | const char* domain = "default"; |
| 128 | if (this->VertexIdField) |
| 129 | { |
| 130 | domain = this->VertexIdField; |
| 131 | } |
| 132 | |
| 133 | filter->SetInputConnection(edgeReader->GetOutputPort()); |
| 134 | filter->AddLinkVertex(this->SourceField, domain); |
| 135 | filter->AddLinkVertex(this->TargetField, domain); |
| 136 | filter->AddLinkEdge(this->SourceField, this->TargetField); |
| 137 | |
| 138 | vtkSmartPointer<vtkAssignCoordinates> assign = vtkSmartPointer<vtkAssignCoordinates>::New(); |
| 139 | assign->SetInputConnection(filter->GetOutputPort()); |
| 140 | |
| 141 | // Set up the internal filter to use the vertex table |
nothing calls this directly
no test coverage detected