VTK  9.2.6
vtkConvertSelection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkConvertSelection.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
15 /*----------------------------------------------------------------------------
16  Copyright (c) Sandia Corporation
17  See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.
18 ----------------------------------------------------------------------------*/
39 #ifndef vtkConvertSelection_h
40 #define vtkConvertSelection_h
41 
42 #include "vtkFiltersExtractionModule.h" // For export macro
43 #include "vtkSelectionAlgorithm.h"
44 
46 class vtkGraph;
47 class vtkIdTypeArray;
48 class vtkSelection;
49 class vtkSelectionNode;
50 class vtkStringArray;
51 class vtkTable;
53 
54 class VTKFILTERSEXTRACTION_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm
55 {
56 public:
57  static vtkConvertSelection* New();
59  void PrintSelf(ostream& os, vtkIndent indent) override;
60 
64  void SetDataObjectConnection(vtkAlgorithmOutput* in);
65 
67 
75  vtkSetMacro(InputFieldType, int);
76  vtkGetMacro(InputFieldType, int);
78 
80 
84  vtkSetMacro(OutputType, int);
85  vtkGetMacro(OutputType, int);
87 
89 
92  virtual void SetArrayName(const char*);
93  virtual const char* GetArrayName();
95 
97 
100  virtual void SetArrayNames(vtkStringArray*);
101  vtkGetObjectMacro(ArrayNames, vtkStringArray);
103 
105 
108  void AddArrayName(const char*);
109  void ClearArrayNames();
111 
113 
117  vtkSetMacro(MatchAnyValues, bool);
118  vtkGetMacro(MatchAnyValues, bool);
119  vtkBooleanMacro(MatchAnyValues, bool);
121 
123 
127  vtkSetMacro(AllowMissingArray, bool);
128  vtkGetMacro(AllowMissingArray, bool);
129  vtkBooleanMacro(AllowMissingArray, bool);
131 
133 
137  virtual void SetSelectionExtractor(vtkExtractSelection*);
138  vtkGetObjectMacro(SelectionExtractor, vtkExtractSelection);
140 
142 
147  static vtkSelection* ToIndexSelection(vtkSelection* input, vtkDataObject* data);
148  static vtkSelection* ToGlobalIdSelection(vtkSelection* input, vtkDataObject* data);
149  static vtkSelection* ToPedigreeIdSelection(vtkSelection* input, vtkDataObject* data);
150  static vtkSelection* ToValueSelection(
151  vtkSelection* input, vtkDataObject* data, const char* arrayName);
152  static vtkSelection* ToValueSelection(
153  vtkSelection* input, vtkDataObject* data, vtkStringArray* arrayNames);
155 
160  static void GetSelectedItems(
161  vtkSelection* input, vtkDataObject* data, int fieldType, vtkIdTypeArray* indices);
162 
164 
168  static void GetSelectedVertices(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
169  static void GetSelectedEdges(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
170  static void GetSelectedPoints(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
171  static void GetSelectedCells(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
172  static void GetSelectedRows(vtkSelection* input, vtkTable* data, vtkIdTypeArray* indices);
174 
179  static vtkSelection* ToSelectionType(vtkSelection* input, vtkDataObject* data, int type,
180  vtkStringArray* arrayNames = nullptr, int inputFieldType = -1, bool allowMissingArray = false);
181 
182 protected:
184  ~vtkConvertSelection() override;
185 
187 
188  int Convert(vtkSelection* input, vtkDataObject* data, vtkSelection* output);
189 
190  int ConvertCompositeDataSet(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
191 
192  int ConvertFromQueryAndBlockSelectionNodeCompositeDataSet(
194 
195  int ConvertToIndexSelection(vtkSelectionNode* input, vtkDataSet* data, vtkSelectionNode* output);
196 
197  int SelectTableFromTable(vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices);
198 
199  int ConvertToBlockSelection(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
200 
201  int FillInputPortInformation(int port, vtkInformation* info) override;
202 
209 
210 private:
211  vtkConvertSelection(const vtkConvertSelection&) = delete;
212  void operator=(const vtkConvertSelection&) = delete;
213 };
214 
215 #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:62
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:59
dynamic, self-adjusting array of vtkIdType
Proxy object to connect input/output ports.
Base class for graph data types.
Definition: vtkGraph.h:295
abstract superclass for composite (multi-block or AMR) datasets
static vtkSelectionAlgorithm * New()
a simple class to control print indentation
Definition: vtkIndent.h:39
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:73
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:65