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

Method RequestData

Filters/Extraction/vtkExtractSelection.cxx:239–477  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

237
238//------------------------------------------------------------------------------
239int vtkExtractSelection::RequestData(vtkInformation* vtkNotUsed(request),
240 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
241{
242 vtkDataObject* input = vtkDataObject::GetData(inputVector[0], 0);
243 vtkSelection* selection = vtkSelection::GetData(inputVector[1], 0);
244 vtkDataObject* output = vtkDataObject::GetData(outputVector, 0);
245 vtkInformation* outInfo = outputVector->GetInformationObject(0);
246
247 // If no input, error
248 if (!input)
249 {
250 vtkErrorMacro(<< "No input specified");
251 return 0;
252 }
253
254 // If no selection, quietly select nothing
255 if (!selection)
256 {
257 return 1;
258 }
259
260 // preserve only nodes that their processId matches the current processId
261 if (outInfo->Has(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER()))
262 {
263 int processId = outInfo->Get(vtkStreamingDemandDrivenPipeline::UPDATE_PIECE_NUMBER());
264 vtkTrimSelection(selection, processId);
265 }
266
267 // check for empty selection
268 if (selection->GetNumberOfNodes() == 0)
269 {
270 return 1;
271 }
272
273 // check for select FieldType consistency right here and return failure
274 // if they are not consistent.
275 bool sane;
276 const auto assoc = this->GetAttributeTypeOfSelection(selection, sane);
277 if (!sane || assoc == vtkDataObject::NUMBER_OF_ATTRIBUTE_TYPES)
278 {
279 vtkErrorMacro("Selection has selection nodes with inconsistent field types.");
280 return 0;
281 }
282
283 // Create operators for each of vtkSelectionNode instances and initialize them.
284 std::map<std::string, vtkSmartPointer<vtkSelector>> selectors;
285 for (unsigned int cc = 0, max = selection->GetNumberOfNodes(); cc < max; ++cc)
286 {
287 auto node = selection->GetNode(cc);
288 auto name = selection->GetNodeNameAtIndex(cc);
289
290 if (auto anOperator = this->NewSelectionOperator(
291 static_cast<vtkSelectionNode::SelectionContent>(node->GetContentType())))
292 {
293 anOperator->SetInsidednessArrayName(name);
294 anOperator->Initialize(node);
295 selectors[name] = anOperator;
296 }

Callers

nothing calls this directly

Calls 15

NewSelectionOperatorMethod · 0.95
EvaluateSelectionMethod · 0.95
ExtractElementsMethod · 0.95
AddColorArrayOnObjectMethod · 0.95
vtkTrimSelectionFunction · 0.85
GetInformationObjectMethod · 0.80
GetNodeNameAtIndexMethod · 0.80
CheckAbortMethod · 0.80
GetDataFunction · 0.50
assertFunction · 0.50

Tested by

no test coverage detected