VTK  9.3.20240418
vtkExtractSelection.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
144 #ifndef vtkExtractSelection_h
145 #define vtkExtractSelection_h
146 
147 #include "vtkDataObjectAlgorithm.h"
148 #include "vtkFiltersExtractionModule.h" // For export macro
149 
150 #include "vtkSelectionNode.h" // for vtkSelectionNode::SelectionContent
151 #include "vtkSmartPointer.h" // for smart pointer
152 
153 VTK_ABI_NAMESPACE_BEGIN
155 class vtkSignedCharArray;
156 class vtkSelection;
157 class vtkSelectionNode;
158 class vtkSelector;
159 class vtkUnstructuredGrid;
160 class vtkTable;
161 
162 class VTKFILTERSEXTRACTION_EXPORT vtkExtractSelection : public vtkDataObjectAlgorithm
163 {
164 public:
167  void PrintSelf(ostream& os, vtkIndent indent) override;
168 
174  {
175  this->SetInputConnection(1, algOutput);
176  }
177 
179 
184  vtkSetMacro(PreserveTopology, bool);
185  vtkGetMacro(PreserveTopology, bool);
186  vtkBooleanMacro(PreserveTopology, bool);
188 
190 
196  vtkGetMacro(HyperTreeGridToUnstructuredGrid, bool);
197  vtkSetMacro(HyperTreeGridToUnstructuredGrid, bool);
198  vtkBooleanMacro(HyperTreeGridToUnstructuredGrid, bool);
200 
201 protected:
204 
209  vtkInformationVector* outputVector) override;
211  vtkInformationVector* outputVector) override;
215  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
216  vtkInformationVector* outputVector) override;
217 
218  // Gets the attribute association of the selection. Currently we support ROW, POINT, and CELL.
219  // If the selection types are mismatched the boolean parameter will be set to false, otherwise
220  // it will be true after the function returns.
222 
229 
230  enum class EvaluationResult
231  {
232  INVALID,
233  NONE,
234  MIXED,
235  ALL
236  };
242  vtkDataObject::AttributeTypes association, vtkSelection* selection,
243  std::map<std::string, vtkSmartPointer<vtkSelector>>& selectors);
244 
254  vtkDataObject* dataObject, vtkDataObject::AttributeTypes association, vtkSelection* selection);
255 
260 
269  vtkDataObject::AttributeTypes elementType, EvaluationResult evaluationResult,
270  vtkDataObject* outputBlock);
271 
273 
279  vtkSignedCharArray* cellInside, bool extractAll);
286  vtkSignedCharArray* pointInside, bool extractAll);
292  vtkTable* input, vtkTable* output, vtkSignedCharArray* rowsInside, bool extractAll);
293 
294  bool PreserveTopology = false;
295 
296 private:
297  vtkExtractSelection(const vtkExtractSelection&) = delete;
298  void operator=(const vtkExtractSelection&) = delete;
299 
301  bool HyperTreeGridToUnstructuredGrid = false;
302 };
303 
304 VTK_ABI_NAMESPACE_END
305 #endif
Proxy object to connect input/output ports.
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
Superclass for algorithms that produce only data object as output.
general representation of visualization data
AttributeTypes
Possible attribute types.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
extract a subset from a vtkDataSet.
vtkDataObject::AttributeTypes GetAttributeTypeOfSelection(vtkSelection *sel, bool &sane)
EvaluationResult EvaluateSelection(vtkDataObject *dataObject, vtkDataObject::AttributeTypes association, vtkSelection *selection, std::map< std::string, vtkSmartPointer< vtkSelector >> &selectors)
Evaluates the selection for the given content type for a data object and returns the evaluation resul...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
~vtkExtractSelection() override
void SetSelectionConnection(vtkAlgorithmOutput *algOutput)
Convenience method to specify the selection connection (2nd input port)
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
static vtkExtractSelection * New()
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Sets up empty output dataset.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
virtual vtkSmartPointer< vtkSelector > NewSelectionOperator(vtkSelectionNode::SelectionContent type)
Creates a new vtkSelector for the given content type.
int RequestDataObject(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
Sets up empty output dataset.
void ExtractSelectedRows(vtkTable *input, vtkTable *output, vtkSignedCharArray *rowsInside, bool extractAll)
Given an input vtkTable and an array of which rows to extract, this populates the output table with t...
void ExtractSelectedPoints(vtkDataSet *input, vtkUnstructuredGrid *output, vtkSignedCharArray *pointInside, bool extractAll)
Given a vtkDataSet and an array of which points to extract, the populates the given vtkUnstructuredGr...
vtkSmartPointer< vtkDataObject > ExtractElements(vtkDataObject *inputBlock, vtkDataObject::AttributeTypes elementType, EvaluationResult evaluationResult, vtkDataObject *outputBlock)
Given a non-composite input data object (either a block of a larger composite or the whole input),...
void AddColorArrayOnObject(vtkDataObject *dataObject, vtkUnsignedCharArray *colorArray)
Add colorArray has cell array on the dataObject.
vtkSmartPointer< vtkUnsignedCharArray > EvaluateColorArrayInSelection(vtkDataObject *dataObject, vtkDataObject::AttributeTypes association, vtkSelection *selection)
Initialize and populate outputColorArray as cell array depending on vtkSelectionData available in the...
void ExtractSelectedCells(vtkDataSet *input, vtkUnstructuredGrid *output, vtkSignedCharArray *cellInside, bool extractAll)
Given a vtkDataSet and an array of which cells to extract, this populates the given vtkUnstructuredGr...
a simple class to control print indentation
Definition: vtkIndent.h:108
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
a node in a vtkSelection the defines the selection criteria.
SelectionContent
Indicate the means by which data is selected.
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:159
dynamic, self-adjusting array of signed char
Hold a reference to a vtkObjectBase instance.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:168
dynamic, self-adjusting array of unsigned char
dataset represents arbitrary combinations of all possible cell types
@ info
Definition: vtkX3D.h:376
@ port
Definition: vtkX3D.h:447
@ type
Definition: vtkX3D.h:516
@ string
Definition: vtkX3D.h:490