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

Method RequestData

Filters/Extraction/vtkExtractSelectedRows.cxx:106–228  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

104
105//------------------------------------------------------------------------------
106int vtkExtractSelectedRows::RequestData(vtkInformation* vtkNotUsed(request),
107 vtkInformationVector** inputVector, vtkInformationVector* outputVector)
108{
109 vtkTable* input = vtkTable::GetData(inputVector[0]);
110 vtkSelection* inputSelection = vtkSelection::GetData(inputVector[1]);
111 vtkAnnotationLayers* inputAnnotations = vtkAnnotationLayers::GetData(inputVector[2]);
112 vtkInformation* outInfo = outputVector->GetInformationObject(0);
113 vtkTable* output = vtkTable::SafeDownCast(outInfo->Get(vtkDataObject::DATA_OBJECT()));
114
115 if (!inputSelection && !inputAnnotations)
116 {
117 vtkErrorMacro("No vtkSelection or vtkAnnotationLayers provided as input.");
118 return 0;
119 }
120
121 vtkSmartPointer<vtkSelection> selection = vtkSmartPointer<vtkSelection>::New();
122 int numSelections = 0;
123 if (inputSelection)
124 {
125 selection->DeepCopy(inputSelection);
126 numSelections++;
127 }
128
129 // If input annotations are provided, extract their selections only if
130 // they are enabled and not hidden.
131 if (inputAnnotations)
132 {
133 for (unsigned int i = 0; i < inputAnnotations->GetNumberOfAnnotations(); ++i)
134 {
135 vtkAnnotation* a = inputAnnotations->GetAnnotation(i);
136 if ((a->GetInformation()->Has(vtkAnnotation::ENABLE()) &&
137 a->GetInformation()->Get(vtkAnnotation::ENABLE()) == 0) ||
138 (a->GetInformation()->Has(vtkAnnotation::ENABLE()) &&
139 a->GetInformation()->Get(vtkAnnotation::ENABLE()) == 1 &&
140 a->GetInformation()->Has(vtkAnnotation::HIDE()) &&
141 a->GetInformation()->Get(vtkAnnotation::HIDE()) == 1))
142 {
143 continue;
144 }
145 selection->Union(a->GetSelection());
146 numSelections++;
147 }
148 }
149
150 // Handle case where there was no input selection and no enabled, non-hidden
151 // annotations
152 if (numSelections == 0)
153 {
154 output->ShallowCopy(input);
155 return 1;
156 }
157
158 // Convert the selection to an INDICES selection
159 vtkSmartPointer<vtkSelection> converted;
160 converted.TakeReference(vtkConvertSelection::ToSelectionType(
161 selection, input, vtkSelectionNode::INDICES, nullptr, vtkSelectionNode::ROW));
162 if (!converted)
163 {

Callers

nothing calls this directly

Calls 15

GetInformationObjectMethod · 0.80
GetRowDataMethod · 0.80
CheckAbortMethod · 0.80
GetSelectionListMethod · 0.80
InsertNextRowMethod · 0.80
GetRowMethod · 0.80
ExecuteFunction · 0.70
DeleteMethod · 0.65
GetDataFunction · 0.50
NewFunction · 0.50
minFunction · 0.50

Tested by

no test coverage detected