VTK  9.3.1
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
26 #ifndef vtkExtractSelection_h
27 #define vtkExtractSelection_h
28 
29 #include "vtkDataObjectAlgorithm.h"
30 #include "vtkFiltersExtractionModule.h" // For export macro
31 
32 #include "vtkSelectionNode.h" // for vtkSelectionNode::SelectionContent
33 #include "vtkSmartPointer.h" // for smart pointer
34 
35 VTK_ABI_NAMESPACE_BEGIN
37 class vtkSignedCharArray;
38 class vtkSelection;
39 class vtkSelectionNode;
40 class vtkSelector;
42 class vtkTable;
43 
44 class VTKFILTERSEXTRACTION_EXPORT vtkExtractSelection : public vtkDataObjectAlgorithm
45 {
46 public:
47  static vtkExtractSelection* New();
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
56  {
57  this->SetInputConnection(1, algOutput);
58  }
59 
61 
66  vtkSetMacro(PreserveTopology, bool);
67  vtkGetMacro(PreserveTopology, bool);
68  vtkBooleanMacro(PreserveTopology, bool);
70 
72 
78  vtkGetMacro(HyperTreeGridToUnstructuredGrid, bool);
79  vtkSetMacro(HyperTreeGridToUnstructuredGrid, bool);
80  vtkBooleanMacro(HyperTreeGridToUnstructuredGrid, bool);
82 
83 protected:
85  ~vtkExtractSelection() override;
86 
90  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
91  vtkInformationVector* outputVector) override;
92  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
93  vtkInformationVector* outputVector) override;
97  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
98  vtkInformationVector* outputVector) override;
99 
100  // Gets the attribute association of the selection. Currently we support ROW, POINT, and CELL.
101  // If the selection types are mismatched the boolean parameter will be set to false, otherwise
102  // it will be true after the function returns.
103  vtkDataObject::AttributeTypes GetAttributeTypeOfSelection(vtkSelection* sel, bool& sane);
104 
109  virtual vtkSmartPointer<vtkSelector> NewSelectionOperator(
111 
112  enum class EvaluationResult
113  {
114  INVALID,
115  NONE,
116  MIXED,
117  ALL
118  };
123  EvaluationResult EvaluateSelection(vtkDataObject* dataObject,
124  vtkDataObject::AttributeTypes association, vtkSelection* selection,
125  std::map<std::string, vtkSmartPointer<vtkSelector>>& selectors);
126 
135  vtkSmartPointer<vtkUnsignedCharArray> EvaluateColorArrayInSelection(
136  vtkDataObject* dataObject, vtkDataObject::AttributeTypes association, vtkSelection* selection);
137 
141  void AddColorArrayOnObject(vtkDataObject* dataObject, vtkUnsignedCharArray* colorArray);
142 
150  vtkSmartPointer<vtkDataObject> ExtractElements(vtkDataObject* inputBlock,
151  vtkDataObject::AttributeTypes elementType, EvaluationResult evaluationResult,
152  vtkDataObject* outputBlock);
153 
154  int FillInputPortInformation(int port, vtkInformation* info) override;
155 
160  void ExtractSelectedCells(vtkDataSet* input, vtkUnstructuredGrid* output,
161  vtkSignedCharArray* cellInside, bool extractAll);
167  void ExtractSelectedPoints(vtkDataSet* input, vtkUnstructuredGrid* output,
168  vtkSignedCharArray* pointInside, bool extractAll);
173  void ExtractSelectedRows(
174  vtkTable* input, vtkTable* output, vtkSignedCharArray* rowsInside, bool extractAll);
175 
176  bool PreserveTopology = false;
177 
178 private:
179  vtkExtractSelection(const vtkExtractSelection&) = delete;
180  void operator=(const vtkExtractSelection&) = delete;
181 
183  bool HyperTreeGridToUnstructuredGrid = false;
184 };
185 
186 VTK_ABI_NAMESPACE_END
187 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
a node in a vtkSelection the defines the selection criteria.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
static vtkDataObjectAlgorithm * New()
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:49
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:23
void SetSelectionConnection(vtkAlgorithmOutput *algOutput)
Convenience method to specify the selection connection (2nd input port)
Proxy object to connect input/output ports.
SelectionContent
Indicate the means by which data is selected.
a simple class to control print indentation
Definition: vtkIndent.h:28
dataset represents arbitrary combinations of all possible cell types
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
dynamic, self-adjusting array of signed char
dynamic, self-adjusting array of unsigned char
extract a subset from a vtkDataSet.
Superclass for algorithms that produce only data object as output.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
Store zero or more vtkInformation instances.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
general representation of visualization data
Definition: vtkDataObject.h:54
AttributeTypes
Possible attribute types.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.