VTK  9.2.5
vtkSelectionSource.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkSelectionSource.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 =========================================================================*/
64 #ifndef vtkSelectionSource_h
65 #define vtkSelectionSource_h
66 
67 #include "vtkFiltersSourcesModule.h" // For export macro
68 #include "vtkSelectionAlgorithm.h"
69 #include "vtkSelectionNode.h" // For FieldType
70 
71 #include <memory> // for std::shared_ptr
72 #include <vector> // for std::vector
73 
74 class VTKFILTERSSOURCES_EXPORT vtkSelectionSource : public vtkSelectionAlgorithm
75 {
76 public:
79  void PrintSelf(ostream& os, vtkIndent indent) override;
80 
82 
87  void SetNumberOfNodes(unsigned int numberOfNodes);
88  unsigned int GetNumberOfNodes() { return static_cast<unsigned int>(this->NodesInfo.size()); }
90 
92 
95  void RemoveNode(unsigned int idx);
96  void RemoveNode(const char* name);
98 
102  virtual void RemoveAllNodes();
103 
105 
120 
122 
136  {
138  ELEMENT_TYPE
139  };
140  vtkSetClampMacro(FieldTypeOption, int, FIELD_TYPE, ELEMENT_TYPE);
141  virtual void SetFieldTypeOptionToFieldType() { this->SetFieldTypeOption(FIELD_TYPE); }
142  virtual void SetFieldTypeOptionToElementType() { this->SetFieldTypeOption(ELEMENT_TYPE); }
143  vtkGetMacro(FieldTypeOption, int);
145 
147 
154  vtkSetClampMacro(FieldType, int, vtkSelectionNode::CELL, vtkSelectionNode::ROW);
155  vtkGetMacro(FieldType, int);
157 
159 
167  vtkSetClampMacro(ElementType, int, vtkDataObject::POINT, vtkDataObject::ROW);
168  vtkGetMacro(ElementType, int);
170 
172 
178  vtkSetClampMacro(ProcessID, int, -1, VTK_INT_MAX);
179  vtkGetMacro(ProcessID, int);
181 
182  //------------------------------------------------------------------------------
183  // Functions to manipulate the information of each selection node.
184  //------------------------------------------------------------------------------
185 
187 
196  void SetNodeName(unsigned int nodeId, const char* name);
197  void SetNodeName(const char* name) { this->SetNodeName(0, name); }
198  const char* GetNodeName(unsigned int nodeId);
199  const char* GetNodeName() { return this->GetNodeName(0); }
201 
203 
208  void AddID(unsigned int nodeId, vtkIdType piece, vtkIdType id);
209  void AddID(vtkIdType piece, vtkIdType id) { this->AddID(0, piece, id); }
210  void AddStringID(unsigned int nodeId, vtkIdType piece, const char* id);
211  void AddStringID(vtkIdType piece, const char* id) { this->AddStringID(0, piece, id); }
213 
215 
218  void AddLocation(unsigned int nodeId, double x, double y, double z);
219  void AddLocation(double x, double y, double z) { this->AddLocation(0, x, y, z); }
221 
223 
226  void AddThreshold(unsigned int nodeId, double min, double max);
227  void AddThreshold(double min, double max) { this->AddThreshold(0, min, max); }
229 
231 
234  void SetFrustum(unsigned int nodeId, double* vertices);
235  void SetFrustum(double* vertices) { this->SetFrustum(0, vertices); }
237 
239 
242  void AddBlock(unsigned int nodeId, vtkIdType block);
243  void AddBlock(vtkIdType blockno) { this->AddBlock(0, blockno); }
245 
247 
251  void AddBlockSelector(unsigned int nodeId, const char* block);
252  void AddBlockSelector(const char* selector) { this->AddBlockSelector(0, selector); }
253  void RemoveAllBlockSelectors(unsigned int nodeId);
256 
258 
261  void RemoveAllIDs(unsigned int nodeId);
262  void RemoveAllIDs() { this->RemoveAllIDs(0); }
263  void RemoveAllStringIDs(unsigned int nodeId);
266 
268 
271  void RemoveAllThresholds(unsigned int nodeId);
274 
276 
279  void RemoveAllLocations(unsigned int nodeId);
282 
284 
287  void RemoveAllBlocks(unsigned int nodeId);
288  void RemoveAllBlocks() { this->RemoveAllBlocks(0); }
290 
292 
299  void SetContentType(unsigned int nodeId, int type);
300  void SetContentType(int contentType) { this->SetContentType(0, contentType); }
301  int GetContentTypeMinValue() { return vtkSelectionNode::SelectionContent::GLOBALIDS; }
302  int GetContentTypeMaxValue() { return vtkSelectionNode::SelectionContent::USER; }
303  int GetContentType(unsigned int nodeId);
304  int GetContentType() { return this->GetContentType(0); }
306 
308 
314  void SetContainingCells(unsigned int nodeId, vtkTypeBool containingCells);
315  void SetContainingCells(vtkTypeBool containingCells)
316  {
317  this->SetContainingCells(0, containingCells);
318  }
319  vtkTypeBool GetContainingCells(unsigned int nodeId);
322 
324 
329  void SetNumberOfLayers(unsigned int nodeId, int numberOfLayers);
330  void SetNumberOfLayers(int numberOfLayers) { this->SetNumberOfLayers(0, numberOfLayers); }
331  int GetNumberOfLayersMinValue() { return 0; }
333  int GetNumberOfLayers(unsigned int nodeId);
334  int GetNumberOfLayers() { return this->GetNumberOfLayers(0); }
336 
338 
343  void SetInverse(unsigned int nodeId, vtkTypeBool inverse);
344  void SetInverse(vtkTypeBool inverse) { this->SetInverse(0, inverse); }
345  vtkTypeBool GetInverse(unsigned int nodeId);
346  vtkTypeBool GetInverse() { return this->GetInverse(0); }
348 
350 
354  void SetArrayName(unsigned int nodeId, const char* name);
355  void SetArrayName(const char* name) { this->SetArrayName(0, name); }
356  const char* GetArrayName(unsigned int nodeId);
357  const char* GetArrayName() { return this->GetArrayName(0); }
359 
361 
366  void SetArrayComponent(unsigned int nodeId, int component);
367  void SetArrayComponent(int component) { this->SetArrayComponent(0, component); }
368  int GetArrayComponent(unsigned int nodeId);
369  int GetArrayComponent() { return this->GetArrayComponent(0); }
371 
373 
379  void SetCompositeIndex(unsigned int nodeId, int index);
380  void SetCompositeIndex(int compositeIndex) { this->SetCompositeIndex(0, compositeIndex); }
381  int GetCompositeIndex(unsigned int nodeId);
382  int GetCompositeIndex() { return this->GetCompositeIndex(0); }
384 
386 
393  void SetHierarchicalLevel(unsigned int nodeId, int level);
394  void SetHierarchicalLevel(int level) { this->SetHierarchicalLevel(0, level); }
395  int GetHierarchicalLevel(unsigned int nodeId);
396  int GetHierarchicalLevel() { return this->GetHierarchicalLevel(0); }
397  void SetHierarchicalIndex(unsigned int nodeId, int index);
398  void SetHierarchicalIndex(int index) { this->SetHierarchicalIndex(0, index); }
399  int GetHierarchicalIndex(unsigned int nodeId);
400  int GetHierarchicalIndex() { return this->GetHierarchicalIndex(0); }
402 
404 
409  void SetAssemblyName(unsigned int nodeId, const char* name);
410  void SetAssemblyName(const char* name) { this->SetAssemblyName(0, name); }
411  const char* GetAssemblyName(unsigned int nodeId);
412  const char* GetAssemblyName() { return this->GetAssemblyName(0); }
413  void AddSelector(unsigned int nodeId, const char* selector);
414  void AddSelector(const char* selector) { this->AddSelector(0, selector); }
415  void RemoveAllSelectors(unsigned int nodeId);
418 
420 
423  void SetQueryString(unsigned int nodeId, const char* queryString);
424  void SetQueryString(const char* query) { this->SetQueryString(0, query); }
425  const char* GetQueryString(unsigned int nodeId);
426  const char* GetQueryString() { return this->GetQueryString(0); }
428 
429 protected:
432 
434  vtkInformationVector* outputVector) override;
435  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
436  vtkInformationVector* outputVector) override;
437 
443  struct NodeInformation;
444  std::vector<std::shared_ptr<NodeInformation>> NodesInfo;
445 
446 private:
447  vtkSelectionSource(const vtkSelectionSource&) = delete;
448  void operator=(const vtkSelectionSource&) = delete;
449 };
450 
451 #endif
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
Superclass for algorithms that produce only Selection as output.
@ CELL
The selection data provided is cell-data.
@ ROW
The selection data provided is table row-data.
Generate selection from given set of ids.
void AddID(unsigned int nodeId, vtkIdType piece, vtkIdType id)
Add a (piece, id) to the selection set.
void RemoveAllThresholds()
Remove all thresholds added with AddThreshold.
void SetFrustum(unsigned int nodeId, double *vertices)
Set a frustum to choose within.
void SetArrayComponent(unsigned int nodeId, int component)
Set/Get the component number for the array specified by ArrayName.
void SetCompositeIndex(int compositeIndex)
Set/Get the CompositeIndex.
int GetHierarchicalLevel(unsigned int nodeId)
Set/Get the Hierarchical/HierarchicalIndex.
void SetAssemblyName(const char *name)
For selector-based selection qualification.
void SetNumberOfLayers(int numberOfLayers)
Set/Get the number of layers to extract connected to the selected elements.
void SetNodeName(unsigned int nodeId, const char *name)
Set/Get the node name.
vtkTypeBool GetInverse(unsigned int nodeId)
Determines whether the selection describes what to include or exclude.
int GetHierarchicalLevel()
Set/Get the Hierarchical/HierarchicalIndex.
void SetArrayName(unsigned int nodeId, const char *name)
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
void SetNumberOfNodes(unsigned int numberOfNodes)
Set/Get the number of nodes that will be created for the generated selection.
const char * GetQueryString()
Set/Get the query expression string.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void AddBlock(unsigned int nodeId, vtkIdType block)
Add the flat-index/composite index for a block.
void AddStringID(unsigned int nodeId, vtkIdType piece, const char *id)
Add a (piece, id) to the selection set.
void SetContainingCells(unsigned int nodeId, vtkTypeBool containingCells)
When extracting by points, extract the cells that contain the passing points.
void SetContentType(unsigned int nodeId, int type)
Set/Get the content type.
const char * GetArrayName(unsigned int nodeId)
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
void SetInverse(unsigned int nodeId, vtkTypeBool inverse)
Determines whether the selection describes what to include or exclude.
void AddBlock(vtkIdType blockno)
Add the flat-index/composite index for a block.
const char * GetQueryString(unsigned int nodeId)
Set/Get the query expression string.
void SetContainingCells(vtkTypeBool containingCells)
When extracting by points, extract the cells that contain the passing points.
static vtkSelectionSource * New()
void AddBlockSelector(const char *selector)
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...
void AddLocation(unsigned int nodeId, double x, double y, double z)
Add a point in world space to probe at.
void AddStringID(vtkIdType piece, const char *id)
Add a (piece, id) to the selection set.
void RemoveAllSelectors()
For selector-based selection qualification.
void RemoveAllSelectors(unsigned int nodeId)
For selector-based selection qualification.
void SetContentType(int contentType)
Set/Get the content type.
int GetNumberOfLayersMinValue()
Set/Get the number of layers to extract connected to the selected elements.
void SetFrustum(double *vertices)
Set a frustum to choose within.
int GetContentType()
Set/Get the content type.
void RemoveNode(const char *name)
Remove a selection node.
int GetContentTypeMaxValue()
Set/Get the content type.
void SetHierarchicalIndex(int index)
Set/Get the Hierarchical/HierarchicalIndex.
int GetCompositeIndex(unsigned int nodeId)
Set/Get the CompositeIndex.
vtkGetCharFromStdStringMacro(Expression)
Set/Get the expression that defines the boolean expression to combine the selection nodes.
int GetContentTypeMinValue()
Set/Get the content type.
void SetHierarchicalIndex(unsigned int nodeId, int index)
Set/Get the Hierarchical/HierarchicalIndex.
void RemoveAllLocations(unsigned int nodeId)
Remove all locations added with AddLocation.
void SetArrayName(const char *name)
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
unsigned int GetNumberOfNodes()
Set/Get the number of nodes that will be created for the generated selection.
void SetInverse(vtkTypeBool inverse)
Determines whether the selection describes what to include or exclude.
void SetHierarchicalLevel(unsigned int nodeId, int level)
Set/Get the Hierarchical/HierarchicalIndex.
const char * GetNodeName(unsigned int nodeId)
const char * GetAssemblyName()
For selector-based selection qualification.
void SetNumberOfLayers(unsigned int nodeId, int numberOfLayers)
Set/Get the number of layers to extract connected to the selected elements.
void AddLocation(double x, double y, double z)
Add a point in world space to probe at.
const char * GetNodeName()
void RemoveAllBlocks(unsigned int nodeId)
Remove all blocks added with AddBlock.
int GetHierarchicalIndex()
Set/Get the Hierarchical/HierarchicalIndex.
void SetArrayComponent(int component)
Set/Get the component number for the array specified by ArrayName.
int GetNumberOfLayersMaxValue()
Set/Get the number of layers to extract connected to the selected elements.
void RemoveAllStringIDs()
Removes all IDs.
const char * GetAssemblyName(unsigned int nodeId)
For selector-based selection qualification.
void SetQueryString(const char *query)
Set/Get the query expression string.
int GetNumberOfLayers()
Set/Get the number of layers to extract connected to the selected elements.
void RemoveAllLocations()
Remove all locations added with AddLocation.
vtkTypeBool GetContainingCells()
When extracting by points, extract the cells that contain the passing points.
virtual void RemoveAllNodes()
Remove all selection nodes.
FieldTypeOptions
Set/Get FieldTypeOption which is used to specify the selection field type for the selection.
void SetNodeName(const char *name)
vtkTypeBool GetContainingCells(unsigned int nodeId)
When extracting by points, extract the cells that contain the passing points.
void AddSelector(unsigned int nodeId, const char *selector)
For selector-based selection qualification.
void RemoveAllIDs()
Removes all IDs.
int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
~vtkSelectionSource() override
int GetCompositeIndex()
Set/Get the CompositeIndex.
void RemoveAllStringIDs(unsigned int nodeId)
Removes all IDs.
vtkSetStdStringFromCharMacro(Expression)
Set/Get the expression that defines the boolean expression to combine the selection nodes.
const char * GetArrayName()
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
void SetCompositeIndex(unsigned int nodeId, int index)
Set/Get the CompositeIndex.
void SetHierarchicalLevel(int level)
Set/Get the Hierarchical/HierarchicalIndex.
void SetQueryString(unsigned int nodeId, const char *queryString)
Set/Get the query expression string.
int GetArrayComponent()
Set/Get the component number for the array specified by ArrayName.
virtual void SetFieldTypeOptionToFieldType()
Set/Get FieldTypeOption which is used to specify the selection field type for the selection.
void AddSelector(const char *selector)
For selector-based selection qualification.
int GetNumberOfLayers(unsigned int nodeId)
Set/Get the number of layers to extract connected to the selected elements.
void RemoveAllBlocks()
Remove all blocks added with AddBlock.
void RemoveAllThresholds(unsigned int nodeId)
Remove all thresholds added with AddThreshold.
void AddBlockSelector(unsigned int nodeId, const char *block)
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...
vtkTypeBool GetInverse()
Determines whether the selection describes what to include or exclude.
std::vector< std::shared_ptr< NodeInformation > > NodesInfo
void AddID(vtkIdType piece, vtkIdType id)
Add a (piece, id) to the selection set.
void RemoveAllIDs(unsigned int nodeId)
Removes all IDs.
void AddThreshold(unsigned int nodeId, double min, double max)
Add a value range to threshold within.
int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector) override
This is called by the superclass.
void RemoveAllBlockSelectors(unsigned int nodeId)
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...
virtual void SetFieldTypeOptionToElementType()
Set/Get FieldTypeOption which is used to specify the selection field type for the selection.
int GetArrayComponent(unsigned int nodeId)
Set/Get the component number for the array specified by ArrayName.
void RemoveAllBlockSelectors()
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...
void AddThreshold(double min, double max)
Add a value range to threshold within.
void SetAssemblyName(unsigned int nodeId, const char *name)
For selector-based selection qualification.
int GetContentType(unsigned int nodeId)
Set/Get the content type.
int GetHierarchicalIndex(unsigned int nodeId)
Set/Get the Hierarchical/HierarchicalIndex.
void RemoveNode(unsigned int idx)
Remove a selection node.
@ component
Definition: vtkX3D.h:181
@ level
Definition: vtkX3D.h:401
@ type
Definition: vtkX3D.h:522
@ name
Definition: vtkX3D.h:225
@ index
Definition: vtkX3D.h:252
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
int vtkIdType
Definition: vtkType.h:332
#define VTK_INT_MAX
Definition: vtkType.h:155
#define max(a, b)