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 ----------------------------------------------------------------------------*/
42 #ifndef vtkConvertSelection_h
43 #define vtkConvertSelection_h
44 
45 #include "vtkFiltersExtractionModule.h" // For export macro
46 #include "vtkSelectionAlgorithm.h"
47 
49 class vtkGraph;
50 class vtkIdTypeArray;
51 class vtkSelection;
52 class vtkSelectionNode;
53 class vtkStringArray;
54 class vtkTable;
56 
57 class VTKFILTERSEXTRACTION_EXPORT vtkConvertSelection : public vtkSelectionAlgorithm
58 {
59 public:
60  static vtkConvertSelection* New();
62  void PrintSelf(ostream& os, vtkIndent indent) override;
63 
67  void SetDataObjectConnection(vtkAlgorithmOutput* in);
68 
70 
78  vtkSetMacro(InputFieldType, int);
79  vtkGetMacro(InputFieldType, int);
81 
83 
87  vtkSetMacro(OutputType, int);
88  vtkGetMacro(OutputType, int);
90 
92 
95  virtual void SetArrayName(const char*);
96  virtual const char* GetArrayName();
98 
100 
103  virtual void SetArrayNames(vtkStringArray*);
104  vtkGetObjectMacro(ArrayNames, vtkStringArray);
106 
108 
111  void AddArrayName(const char*);
112  void ClearArrayNames();
114 
116 
120  vtkSetMacro(MatchAnyValues, bool);
121  vtkGetMacro(MatchAnyValues, bool);
122  vtkBooleanMacro(MatchAnyValues, bool);
124 
126 
130  vtkSetMacro(AllowMissingArray, bool);
131  vtkGetMacro(AllowMissingArray, bool);
132  vtkBooleanMacro(AllowMissingArray, bool);
134 
136 
140  virtual void SetSelectionExtractor(vtkExtractSelection*);
141  vtkGetObjectMacro(SelectionExtractor, vtkExtractSelection);
143 
145 
150  static vtkSelection* ToIndexSelection(vtkSelection* input, vtkDataObject* data);
151  static vtkSelection* ToGlobalIdSelection(vtkSelection* input, vtkDataObject* data);
152  static vtkSelection* ToPedigreeIdSelection(vtkSelection* input, vtkDataObject* data);
153  static vtkSelection* ToValueSelection(
154  vtkSelection* input, vtkDataObject* data, const char* arrayName);
155  static vtkSelection* ToValueSelection(
156  vtkSelection* input, vtkDataObject* data, vtkStringArray* arrayNames);
158 
163  static void GetSelectedItems(
164  vtkSelection* input, vtkDataObject* data, int fieldType, vtkIdTypeArray* indices);
165 
167 
171  static void GetSelectedVertices(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
172  static void GetSelectedEdges(vtkSelection* input, vtkGraph* data, vtkIdTypeArray* indices);
173  static void GetSelectedPoints(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
174  static void GetSelectedCells(vtkSelection* input, vtkDataSet* data, vtkIdTypeArray* indices);
175  static void GetSelectedRows(vtkSelection* input, vtkTable* data, vtkIdTypeArray* indices);
177 
182  static vtkSelection* ToSelectionType(vtkSelection* input, vtkDataObject* data, int type,
183  vtkStringArray* arrayNames = nullptr, int inputFieldType = -1, bool allowMissingArray = false);
184 
185 protected:
187  ~vtkConvertSelection() override;
188 
190 
191  int Convert(vtkSelection* input, vtkDataObject* data, vtkSelection* output);
192 
193  int ConvertCompositeDataSet(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
194 
195  int ConvertFromQueryNodeCompositeDataSet(
197 
198  int ConvertToIndexSelection(vtkSelectionNode* input, vtkDataSet* data, vtkSelectionNode* output);
199 
200  int SelectTableFromTable(vtkTable* selTable, vtkTable* dataTable, vtkIdTypeArray* indices);
201 
202  int ConvertToBlockSelection(vtkSelection* input, vtkCompositeDataSet* data, vtkSelection* output);
203 
204  int FillInputPortInformation(int port, vtkInformation* info) override;
205 
212 
213 private:
214  vtkConvertSelection(const vtkConvertSelection&) = delete;
215  void operator=(const vtkConvertSelection&) = delete;
216 };
217 
218 #endif
vtkConvertSelection::ArrayNames
vtkStringArray * ArrayNames
Definition: vtkConvertSelection.h:208
vtkSelectionNode
A node in a selection tree. Used to store selection results.
Definition: vtkSelectionNode.h:61
vtkX3D::type
@ type
Definition: vtkX3D.h:522
vtkX3D::data
@ data
Definition: vtkX3D.h:321
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkTable
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:62
vtkExtractSelection
extract a subset from a vtkDataSet.
Definition: vtkExtractSelection.h:51
tovtkm::Convert
VTKACCELERATORSVTKM_EXPORT vtkm::cont::Field Convert(vtkDataArray *input, int association)
vtkConvertSelection::OutputType
int OutputType
Definition: vtkConvertSelection.h:206
vtkSelectionAlgorithm::RequestData
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:57
vtkSelectionAlgorithm.h
vtkCompositeDataSet
abstract superclass for composite (multi-block or AMR) datasets
Definition: vtkCompositeDataSet.h:45
vtkSelectionAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkConvertSelection::InputFieldType
int InputFieldType
Definition: vtkConvertSelection.h:207
vtkConvertSelection::MatchAnyValues
bool MatchAnyValues
Definition: vtkConvertSelection.h:209
vtkConvertSelection::SelectionExtractor
vtkExtractSelection * SelectionExtractor
Definition: vtkConvertSelection.h:211
vtkSelectionAlgorithm::New
static vtkSelectionAlgorithm * New()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSelectionAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkConvertSelection::AllowMissingArray
bool AllowMissingArray
Definition: vtkConvertSelection.h:210
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkIdTypeArray
dynamic, self-adjusting array of vtkIdType
Definition: vtkIdTypeArray.h:35
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkStringArray
a vtkAbstractArray subclass for strings
Definition: vtkStringArray.h:36
vtkSelectionAlgorithm
Superclass for algorithms that produce only Selection as output.
Definition: vtkSelectionAlgorithm.h:46
vtkGraph
Base class for graph data types.
Definition: vtkGraph.h:289
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkConvertSelection
Convert a selection from one type to another.
Definition: vtkConvertSelection.h:57