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 ----------------------------------------------------------------------------*/
36 #ifndef vtkConvertSelection_h
37 #define vtkConvertSelection_h
38 
39 #include "vtkFiltersExtractionModule.h" // For export macro
40 #include "vtkSelectionAlgorithm.h"
41 
43 class vtkGraph;
44 class vtkIdTypeArray;
45 class vtkSelection;
46 class vtkSelectionNode;
47 class vtkStringArray;
48 class vtkTable;
50 
51 class VTKFILTERSEXTRACTION_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm
52 {
53 public:
54  static vtkConvertSelection* New();
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
61  void SetDataObjectConnection(vtkAlgorithmOutput* in);
62 
64 
72  vtkSetMacro(InputFieldType, int);
73  vtkGetMacro(InputFieldType, int);
75 
77 
81  vtkSetMacro(OutputType, int);
82  vtkGetMacro(OutputType, int);
84 
86 
89  virtual void SetArrayName(const char*);
90  virtual const char* GetArrayName();
92 
94 
97  virtual void SetArrayNames(vtkStringArray*);
98  vtkGetObjectMacro(ArrayNames, vtkStringArray);
100 
102 
105  void AddArrayName(const char*);
106  void ClearArrayNames();
108 
110 
114  vtkSetMacro(MatchAnyValues, bool);
115  vtkGetMacro(MatchAnyValues, bool);
116  vtkBooleanMacro(MatchAnyValues, bool);
118 
120 
124  vtkSetMacro(AllowMissingArray, bool);
125  vtkGetMacro(AllowMissingArray, bool);
126  vtkBooleanMacro(AllowMissingArray, bool);
128 
130 
134  virtual void SetSelectionExtractor(vtkExtractSelection*);
135  vtkGetObjectMacro(SelectionExtractor, vtkExtractSelection);
137 
139 
144  static vtkSelection* ToIndexSelection(vtkSelection* input, vtkDataObject* data);
145  static vtkSelection* ToGlobalIdSelection(vtkSelection* input, vtkDataObject* data);
146  static vtkSelection* ToPedigreeIdSelection(vtkSelection* input, vtkDataObject* data);
147  static vtkSelection* ToValueSelection(
148  vtkSelection* input, vtkDataObject* data, const char* arrayName);
149  static vtkSelection* ToValueSelection(
150  vtkSelection* input, vtkDataObject* data, vtkStringArray* arrayNames);
152 
157  static void GetSelectedItems(
158  vtkSelection* input, vtkDataObject* data, int fieldType, vtkIdTypeArray* indices);
159 
161 
165  static void GetSelectedVertices(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
166  static void GetSelectedEdges(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
167  static void GetSelectedPoints(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
168  static void GetSelectedCells(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
169  static void GetSelectedRows(vtkSelection* input, vtkTable* data, vtkIdTypeArray* indices);
171 
176  static vtkSelection* ToSelectionType(vtkSelection* input, vtkDataObject* data, int type,
177  vtkStringArray* arrayNames = nullptr, int inputFieldType = -1, bool allowMissingArray = false);
178 
179 protected:
181  ~vtkConvertSelection() override;
182 
184 
185  int Convert(vtkSelection* input, vtkDataObject* data, vtkSelection* output);
186 
187  int ConvertCompositeDataSet(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
188 
189  int ConvertFromQueryNodeCompositeDataSet(
191 
192  int ConvertToIndexSelection(vtkSelectionNode* input, vtkDataSet* data, vtkSelectionNode* output);
193 
194  int SelectTableFromTable(vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices);
195 
196  int ConvertToBlockSelection(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
197 
198  int FillInputPortInformation(int port, vtkInformation* info) override;
199 
206 
207 private:
208  vtkConvertSelection(const vtkConvertSelection&) = delete;
209  void operator=(const vtkConvertSelection&) = delete;
210 };
211 
212 #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)