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

Method RequestData

Views/Core/vtkConvertSelectionDomain.cxx:195–305  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

193
194//------------------------------------------------------------------------------
195int vtkConvertSelectionDomain::RequestData(vtkInformation* vtkNotUsed(request),
196 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
197{
198 // Retrieve the input and output.
199 vtkInformation* inInfo = inputVector[0]->GetInformationObject(0);
200 vtkDataObject* input = inInfo->Get(vtkDataObject::DATA_OBJECT());
201 vtkAnnotationLayers* inputAnn = vtkAnnotationLayers::SafeDownCast(input);
202
203 vtkInformation* outInfo = outputVector->GetInformationObject(0);
204 vtkDataObject* output = outInfo->Get(vtkDataObject::DATA_OBJECT());
205 vtkAnnotationLayers* outputAnn = vtkAnnotationLayers::SafeDownCast(output);
206
207 outInfo = outputVector->GetInformationObject(1);
208 vtkSelection* outputCurrentSel =
209 vtkSelection::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
210
211 // If we have no mapping table, we are done.
212 vtkInformation* mapInfo = inputVector[1]->GetInformationObject(0);
213 vtkInformation* dataInfo = inputVector[2]->GetInformationObject(0);
214 if (!dataInfo || !mapInfo)
215 {
216 output->ShallowCopy(input);
217 return 1;
218 }
219
220 // If the input is instead a vtkSelection, wrap it in a vtkAnnotationLayers
221 // object so it can be used uniformly in the function.
222 bool createdInput = false;
223 if (!inputAnn)
224 {
225 vtkSelection* inputSel = vtkSelection::SafeDownCast(input);
226 inputAnn = vtkAnnotationLayers::New();
227 inputAnn->SetCurrentSelection(inputSel);
228 vtkSelection* outputSel = vtkSelection::SafeDownCast(output);
229 outputAnn = vtkAnnotationLayers::New();
230 outputAnn->SetCurrentSelection(outputSel);
231 createdInput = true;
232 }
233
234 vtkMultiBlockDataSet* maps =
235 vtkMultiBlockDataSet::SafeDownCast(mapInfo->Get(vtkDataObject::DATA_OBJECT()));
236 vtkDataObject* data = dataInfo->Get(vtkDataObject::DATA_OBJECT());
237
238 vtkDataSetAttributes* dsa1 = nullptr;
239 int fieldType1 = 0;
240 vtkDataSetAttributes* dsa2 = nullptr;
241 int fieldType2 = 0;
242 if (vtkDataSet::SafeDownCast(data))
243 {
244 dsa1 = vtkDataSet::SafeDownCast(data)->GetPointData();
245 fieldType1 = vtkSelectionNode::POINT;
246 dsa2 = vtkDataSet::SafeDownCast(data)->GetCellData();
247 fieldType2 = vtkSelectionNode::CELL;
248 }
249 else if (vtkGraph::SafeDownCast(data))
250 {
251 dsa1 = vtkGraph::SafeDownCast(data)->GetVertexData();
252 fieldType1 = vtkSelectionNode::VERTEX;

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
GetVertexDataMethod · 0.80
GetEdgeDataMethod · 0.80
GetRowDataMethod · 0.80
AddAnnotationMethod · 0.80
DeleteMethod · 0.65
NewFunction · 0.50
GetMethod · 0.45
ShallowCopyMethod · 0.45

Tested by

no test coverage detected