VTK  9.0.1
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 ----------------------------------------------------------------------------*/
33 #ifndef vtkConvertSelection_h
34 #define vtkConvertSelection_h
35 
36 #include "vtkFiltersExtractionModule.h" // For export macro
37 #include "vtkSelectionAlgorithm.h"
38 
40 class vtkGraph;
41 class vtkIdTypeArray;
42 class vtkSelection;
43 class vtkSelectionNode;
44 class vtkStringArray;
45 class vtkTable;
47 
48 class VTKFILTERSEXTRACTION_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm
49 {
50 public:
51  static vtkConvertSelection* New();
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
58  void SetDataObjectConnection(vtkAlgorithmOutput* in);
59 
61 
69  vtkSetMacro(InputFieldType, int);
70  vtkGetMacro(InputFieldType, int);
72 
74 
78  vtkSetMacro(OutputType, int);
79  vtkGetMacro(OutputType, int);
81 
83 
86  virtual void SetArrayName(const char*);
87  virtual const char* GetArrayName();
89 
91 
94  virtual void SetArrayNames(vtkStringArray*);
95  vtkGetObjectMacro(ArrayNames, vtkStringArray);
97 
99 
102  void AddArrayName(const char*);
103  void ClearArrayNames();
105 
107 
111  vtkSetMacro(MatchAnyValues, bool);
112  vtkGetMacro(MatchAnyValues, bool);
113  vtkBooleanMacro(MatchAnyValues, bool);
115 
117 
121  vtkSetMacro(AllowMissingArray, bool);
122  vtkGetMacro(AllowMissingArray, bool);
123  vtkBooleanMacro(AllowMissingArray, bool);
125 
127 
131  virtual void SetSelectionExtractor(vtkExtractSelection*);
132  vtkGetObjectMacro(SelectionExtractor, vtkExtractSelection);
134 
136 
141  static vtkSelection* ToIndexSelection(vtkSelection* input, vtkDataObject* data);
142  static vtkSelection* ToGlobalIdSelection(vtkSelection* input, vtkDataObject* data);
143  static vtkSelection* ToPedigreeIdSelection(vtkSelection* input, vtkDataObject* data);
144  static vtkSelection* ToValueSelection(
145  vtkSelection* input, vtkDataObject* data, const char* arrayName);
146  static vtkSelection* ToValueSelection(
147  vtkSelection* input, vtkDataObject* data, vtkStringArray* arrayNames);
149 
154  static void GetSelectedItems(
155  vtkSelection* input, vtkDataObject* data, int fieldType, vtkIdTypeArray* indices);
156 
158 
162  static void GetSelectedVertices(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
163  static void GetSelectedEdges(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
164  static void GetSelectedPoints(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
165  static void GetSelectedCells(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
166  static void GetSelectedRows(vtkSelection* input, vtkTable* data, vtkIdTypeArray* indices);
168 
173  static vtkSelection* ToSelectionType(vtkSelection* input, vtkDataObject* data, int type,
174  vtkStringArray* arrayNames = nullptr, int inputFieldType = -1, bool allowMissingArray = false);
175 
176 protected:
178  ~vtkConvertSelection() override;
179 
181 
182  int Convert(vtkSelection* input, vtkDataObject* data, vtkSelection* output);
183 
184  int ConvertCompositeDataSet(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
185 
186  int ConvertFromQueryNodeCompositeDataSet(
188 
189  int ConvertToIndexSelection(vtkSelectionNode* input, vtkDataSet* data, vtkSelectionNode* output);
190 
191  int SelectTableFromTable(vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices);
192 
193  int ConvertToBlockSelection(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
194 
195  int FillInputPortInformation(int port, vtkInformation* info) override;
196 
203 
204 private:
205  vtkConvertSelection(const vtkConvertSelection&) = delete;
206  void operator=(const vtkConvertSelection&) = delete;
207 };
208 
209 #endif
A node in a selection tree.
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:56
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:57
dynamic, self-adjusting array of vtkIdType
Proxy object to connect input/output ports.
Base class for graph data types.
Definition: vtkGraph.h:289
abstract superclass for composite (multi-block or AMR) datasets
static vtkSelectionAlgorithm * New()
a simple class to control print indentation
Definition: vtkIndent.h:33
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:62
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:59
VTKACCELERATORSVTKM_EXPORT vtkm::cont::Field Convert(vtkDataArray *input, int association)