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

Method RequestData

IO/SQL/vtkSQLGraphReader.cxx:84–188  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82vtkCxxSetObjectMacro(vtkSQLGraphReader, EdgeQuery, vtkSQLQuery);
83
84int 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

Callers

nothing calls this directly

Calls 15

SetXCoordArrayNameMethod · 0.80
SetYCoordArrayNameMethod · 0.80
SetZCoordArrayNameMethod · 0.80
GetInformationObjectMethod · 0.80
DeleteMethod · 0.65
GetDataFunction · 0.50
NewFunction · 0.50
SetQueryMethod · 0.45
UpdateMethod · 0.45
SetInputConnectionMethod · 0.45
GetOutputPortMethod · 0.45
AddLinkVertexMethod · 0.45

Tested by

no test coverage detected