VTK  9.3.1
vtkConvertSelection.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3 // SPDX-License-Identifier: BSD-3-Clause
24 #ifndef vtkConvertSelection_h
25 #define vtkConvertSelection_h
26 
27 #include "vtkFiltersExtractionModule.h" // For export macro
28 #include "vtkSelectionAlgorithm.h"
29 
30 VTK_ABI_NAMESPACE_BEGIN
32 class vtkGraph;
33 class vtkIdTypeArray;
34 class vtkSelection;
35 class vtkSelectionNode;
36 class vtkStringArray;
37 class vtkTable;
39 
40 class VTKFILTERSEXTRACTION_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm
41 {
42 public:
43  static vtkConvertSelection* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  void SetDataObjectConnection(vtkAlgorithmOutput* in);
51 
53 
61  vtkSetMacro(InputFieldType, int);
62  vtkGetMacro(InputFieldType, int);
64 
66 
70  vtkSetMacro(OutputType, int);
71  vtkGetMacro(OutputType, int);
73 
75 
78  virtual void SetArrayName(const char*);
79  virtual const char* GetArrayName();
81 
83 
86  virtual void SetArrayNames(vtkStringArray*);
87  vtkGetObjectMacro(ArrayNames, vtkStringArray);
89 
91 
94  void AddArrayName(const char*);
95  void ClearArrayNames();
97 
99 
103  vtkSetMacro(MatchAnyValues, bool);
104  vtkGetMacro(MatchAnyValues, bool);
105  vtkBooleanMacro(MatchAnyValues, bool);
107 
109 
113  vtkSetMacro(AllowMissingArray, bool);
114  vtkGetMacro(AllowMissingArray, bool);
115  vtkBooleanMacro(AllowMissingArray, bool);
117 
119 
123  virtual void SetSelectionExtractor(vtkExtractSelection*);
124  vtkGetObjectMacro(SelectionExtractor, vtkExtractSelection);
126 
128 
133  static vtkSelection* ToIndexSelection(vtkSelection* input, vtkDataObject* data);
134  static vtkSelection* ToGlobalIdSelection(vtkSelection* input, vtkDataObject* data);
135  static vtkSelection* ToPedigreeIdSelection(vtkSelection* input, vtkDataObject* data);
136  static vtkSelection* ToValueSelection(
137  vtkSelection* input, vtkDataObject* data, const char* arrayName);
138  static vtkSelection* ToValueSelection(
139  vtkSelection* input, vtkDataObject* data, vtkStringArray* arrayNames);
141 
146  static void GetSelectedItems(
147  vtkSelection* input, vtkDataObject* data, int fieldType, vtkIdTypeArray* indices);
148 
150 
154  static void GetSelectedVertices(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
155  static void GetSelectedEdges(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
156  static void GetSelectedPoints(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
157  static void GetSelectedCells(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
158  static void GetSelectedRows(vtkSelection* input, vtkTable* data, vtkIdTypeArray* indices);
160 
165  static vtkSelection* ToSelectionType(vtkSelection* input, vtkDataObject* data, int type,
166  vtkStringArray* arrayNames = nullptr, int inputFieldType = -1, bool allowMissingArray = false);
167 
168 protected:
170  ~vtkConvertSelection() override;
171 
173 
174  int Convert(vtkSelection* input, vtkDataObject* data, vtkSelection* output);
175 
176  int ConvertCompositeDataSet(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
177 
178  int ConvertFromQueryAndBlockSelectionNodeCompositeDataSet(
180 
181  int ConvertToIndexSelection(vtkSelectionNode* input, vtkDataSet* data, vtkSelectionNode* output);
182 
183  int SelectTableFromTable(vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices);
184 
185  int ConvertToBlockSelection(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
186 
187  int FillInputPortInformation(int port, vtkInformation* info) override;
188 
195 
196 private:
197  vtkConvertSelection(const vtkConvertSelection&) = delete;
198  void operator=(const vtkConvertSelection&) = delete;
199 };
200 
201 VTK_ABI_NAMESPACE_END
202 #endif
a node in a vtkSelection the defines the selection criteria.
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkExtractSelection * SelectionExtractor
a vtkAbstractArray subclass for strings
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:49
dynamic, self-adjusting array of vtkIdType
Proxy object to connect input/output ports.
Base class for graph data types.
Definition: vtkGraph.h:280
abstract superclass for composite (multi-block or AMR) datasets
static vtkSelectionAlgorithm * New()
a simple class to control print indentation
Definition: vtkIndent.h:28
VTKACCELERATORSVTKMCORE_EXPORT vtkDataArray * Convert(const vtkm::cont::Field &input)
Superclass for algorithms that produce only Selection as output.
vtkStringArray * ArrayNames
extract a subset from a vtkDataSet.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:58
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
Store zero or more vtkInformation instances.
Convert a selection from one type to another.
general representation of visualization data
Definition: vtkDataObject.h:54