VTK  9.2.6
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 =========================================================================*/
45 #ifndef vtkSelectionSource_h
46 #define vtkSelectionSource_h
47 
48 #include "vtkFiltersSourcesModule.h" // For export macro
49 #include "vtkSelectionAlgorithm.h"
50 #include "vtkSelectionNode.h" // For FieldType
51 
52 #include <memory> // for std::shared_ptr
53 #include <vector> // for std::vector
54 
55 class VTKFILTERSSOURCES_EXPORT vtkSelectionSource : public vtkSelectionAlgorithm
56 {
57 public:
58  static vtkSelectionSource* New();
60  void PrintSelf(ostream& os, vtkIndent indent) override;
61 
63 
68  void SetNumberOfNodes(unsigned int numberOfNodes);
69  unsigned int GetNumberOfNodes() { return static_cast<unsigned int>(this->NodesInfo.size()); }
71 
73 
76  void RemoveNode(unsigned int idx);
77  void RemoveNode(const char* name);
79 
83  virtual void RemoveAllNodes();
84 
86 
98  vtkSetStdStringFromCharMacro(Expression);
99  vtkGetCharFromStdStringMacro(Expression);
101 
103 
117  {
119  ELEMENT_TYPE
120  };
121  vtkSetClampMacro(FieldTypeOption, int, FIELD_TYPE, ELEMENT_TYPE);
122  virtual void SetFieldTypeOptionToFieldType() { this->SetFieldTypeOption(FIELD_TYPE); }
123  virtual void SetFieldTypeOptionToElementType() { this->SetFieldTypeOption(ELEMENT_TYPE); }
124  vtkGetMacro(FieldTypeOption, int);
126 
128 
135  vtkSetClampMacro(FieldType, int, vtkSelectionNode::CELL, vtkSelectionNode::ROW);
136  vtkGetMacro(FieldType, int);
138 
140 
148  vtkSetClampMacro(ElementType, int, vtkDataObject::POINT, vtkDataObject::ROW);
149  vtkGetMacro(ElementType, int);
151 
153 
159  vtkSetClampMacro(ProcessID, int, -1, VTK_INT_MAX);
160  vtkGetMacro(ProcessID, int);
162 
163  //------------------------------------------------------------------------------
164  // Functions to manipulate the information of each selection node.
165  //------------------------------------------------------------------------------
166 
168 
177  void SetNodeName(unsigned int nodeId, const char* name);
178  void SetNodeName(const char* name) { this->SetNodeName(0, name); }
179  const char* GetNodeName(unsigned int nodeId);
180  const char* GetNodeName() { return this->GetNodeName(0); }
182 
184 
189  void AddID(unsigned int nodeId, vtkIdType piece, vtkIdType id);
190  void AddID(vtkIdType piece, vtkIdType id) { this->AddID(0, piece, id); }
191  void AddStringID(unsigned int nodeId, vtkIdType piece, const char* id);
192  void AddStringID(vtkIdType piece, const char* id) { this->AddStringID(0, piece, id); }
194 
196 
199  void AddLocation(unsigned int nodeId, double x, double y, double z);
200  void AddLocation(double x, double y, double z) { this->AddLocation(0, x, y, z); }
202 
204 
207  void AddThreshold(unsigned int nodeId, double min, double max);
208  void AddThreshold(double min, double max) { this->AddThreshold(0, min, max); }
210 
212 
215  void SetFrustum(unsigned int nodeId, double* vertices);
216  void SetFrustum(double* vertices) { this->SetFrustum(0, vertices); }
218 
220 
223  void AddBlock(unsigned int nodeId, vtkIdType block);
224  void AddBlock(vtkIdType blockno) { this->AddBlock(0, blockno); }
226 
228 
232  void AddBlockSelector(unsigned int nodeId, const char* block);
233  void AddBlockSelector(const char* selector) { this->AddBlockSelector(0, selector); }
234  void RemoveAllBlockSelectors(unsigned int nodeId);
237 
239 
242  void RemoveAllIDs(unsigned int nodeId);
243  void RemoveAllIDs() { this->RemoveAllIDs(0); }
244  void RemoveAllStringIDs(unsigned int nodeId);
247 
249 
252  void RemoveAllThresholds(unsigned int nodeId);
255 
257 
260  void RemoveAllLocations(unsigned int nodeId);
263 
265 
268  void RemoveAllBlocks(unsigned int nodeId);
269  void RemoveAllBlocks() { this->RemoveAllBlocks(0); }
271 
273 
280  void SetContentType(unsigned int nodeId, int type);
281  void SetContentType(int contentType) { this->SetContentType(0, contentType); }
282  int GetContentTypeMinValue() { return vtkSelectionNode::SelectionContent::GLOBALIDS; }
283  int GetContentTypeMaxValue() { return vtkSelectionNode::SelectionContent::USER; }
284  int GetContentType(unsigned int nodeId);
285  int GetContentType() { return this->GetContentType(0); }
287 
289 
295  void SetContainingCells(unsigned int nodeId, vtkTypeBool containingCells);
296  void SetContainingCells(vtkTypeBool containingCells)
297  {
298  this->SetContainingCells(0, containingCells);
299  }
300  vtkTypeBool GetContainingCells(unsigned int nodeId);
303 
305 
310  void SetNumberOfLayers(unsigned int nodeId, int numberOfLayers);
311  void SetNumberOfLayers(int numberOfLayers) { this->SetNumberOfLayers(0, numberOfLayers); }
312  int GetNumberOfLayersMinValue() { return 0; }
314  int GetNumberOfLayers(unsigned int nodeId);
315  int GetNumberOfLayers() { return this->GetNumberOfLayers(0); }
317 
319 
324  void SetInverse(unsigned int nodeId, vtkTypeBool inverse);
325  void SetInverse(vtkTypeBool inverse) { this->SetInverse(0, inverse); }
326  vtkTypeBool GetInverse(unsigned int nodeId);
327  vtkTypeBool GetInverse() { return this->GetInverse(0); }
329 
331 
335  void SetArrayName(unsigned int nodeId, const char* name);
336  void SetArrayName(const char* name) { this->SetArrayName(0, name); }
337  const char* GetArrayName(unsigned int nodeId);
338  const char* GetArrayName() { return this->GetArrayName(0); }
340 
342 
347  void SetArrayComponent(unsigned int nodeId, int component);
348  void SetArrayComponent(int component) { this->SetArrayComponent(0, component); }
349  int GetArrayComponent(unsigned int nodeId);
350  int GetArrayComponent() { return this->GetArrayComponent(0); }
352 
354 
360  void SetCompositeIndex(unsigned int nodeId, int index);
361  void SetCompositeIndex(int compositeIndex) { this->SetCompositeIndex(0, compositeIndex); }
362  int GetCompositeIndex(unsigned int nodeId);
363  int GetCompositeIndex() { return this->GetCompositeIndex(0); }
365 
367 
374  void SetHierarchicalLevel(unsigned int nodeId, int level);
375  void SetHierarchicalLevel(int level) { this->SetHierarchicalLevel(0, level); }
376  int GetHierarchicalLevel(unsigned int nodeId);
377  int GetHierarchicalLevel() { return this->GetHierarchicalLevel(0); }
378  void SetHierarchicalIndex(unsigned int nodeId, int index);
379  void SetHierarchicalIndex(int index) { this->SetHierarchicalIndex(0, index); }
380  int GetHierarchicalIndex(unsigned int nodeId);
381  int GetHierarchicalIndex() { return this->GetHierarchicalIndex(0); }
383 
385 
390  void SetAssemblyName(unsigned int nodeId, const char* name);
391  void SetAssemblyName(const char* name) { this->SetAssemblyName(0, name); }
392  const char* GetAssemblyName(unsigned int nodeId);
393  const char* GetAssemblyName() { return this->GetAssemblyName(0); }
394  void AddSelector(unsigned int nodeId, const char* selector);
395  void AddSelector(const char* selector) { this->AddSelector(0, selector); }
396  void RemoveAllSelectors(unsigned int nodeId);
399 
401 
404  void SetQueryString(unsigned int nodeId, const char* queryString);
405  void SetQueryString(const char* query) { this->SetQueryString(0, query); }
406  const char* GetQueryString(unsigned int nodeId);
407  const char* GetQueryString() { return this->GetQueryString(0); }
409 
410 protected:
412  ~vtkSelectionSource() override;
413 
414  int RequestInformation(vtkInformation* request, vtkInformationVector** inputVector,
415  vtkInformationVector* outputVector) override;
416  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
417  vtkInformationVector* outputVector) override;
418 
424  struct NodeInformation;
425  std::vector<std::shared_ptr<NodeInformation>> NodesInfo;
426 
427 private:
428  vtkSelectionSource(const vtkSelectionSource&) = delete;
429  void operator=(const vtkSelectionSource&) = delete;
430 };
431 
432 #endif
void AddStringID(vtkIdType piece, const char *id)
Add a (piece, id) to the selection set.
void SetArrayComponent(int component)
Set/Get the component number for the array specified by ArrayName.
unsigned int GetNumberOfNodes()
Set/Get the number of nodes that will be created for the generated selection.
void RemoveAllStringIDs()
Removes all IDs.
void SetNumberOfLayers(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 * GetArrayName()
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
The selection data provided is cell-data.
int GetNumberOfLayersMaxValue()
Set/Get the number of layers to extract connected to the selected elements.
int GetHierarchicalLevel()
Set/Get the Hierarchical/HierarchicalIndex.
Store vtkAlgorithm input/output information.
const char * GetAssemblyName()
For selector-based selection qualification.
void SetQueryString(const char *query)
Set/Get the query expression string.
std::vector< std::shared_ptr< NodeInformation > > NodesInfo
int GetCompositeIndex()
Set/Get the CompositeIndex.
#define VTK_INT_MAX
Definition: vtkType.h:155
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetInverse(vtkTypeBool inverse)
Determines whether the selection describes what to include or exclude.
void AddSelector(const char *selector)
For selector-based selection qualification.
void RemoveAllIDs()
Removes all IDs.
const char * GetQueryString()
Set/Get the query expression string.
int vtkIdType
Definition: vtkType.h:332
std::pair< boost::graph_traits< vtkGraph * >::vertex_iterator, boost::graph_traits< vtkGraph * >::vertex_iterator > vertices(vtkGraph *g)
void RemoveAllSelectors()
For selector-based selection qualification.
void SetContainingCells(vtkTypeBool containingCells)
When extracting by points, extract the cells that contain the passing points.
int GetNumberOfLayers()
Set/Get the number of layers to extract connected to the selected elements.
void SetArrayName(const char *name)
Get/Set the name used for the SelectionList in the generated vtkSelectionNode.
void RemoveAllBlocks()
Remove all blocks added with AddBlock.
int vtkTypeBool
Definition: vtkABI.h:69
FieldTypeOptions
Set/Get FieldTypeOption which is used to specify the selection field type for the selection...
void RemoveAllThresholds()
Remove all thresholds added with AddThreshold.
void SetCompositeIndex(int compositeIndex)
Set/Get the CompositeIndex.
virtual void SetFieldTypeOptionToFieldType()
Set/Get FieldTypeOption which is used to specify the selection field type for the selection...
static vtkSelectionAlgorithm * New()
a simple class to control print indentation
Definition: vtkIndent.h:39
int GetHierarchicalIndex()
Set/Get the Hierarchical/HierarchicalIndex.
void SetHierarchicalIndex(int index)
Set/Get the Hierarchical/HierarchicalIndex.
virtual void SetFieldTypeOptionToElementType()
Set/Get FieldTypeOption which is used to specify the selection field type for the selection...
virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
void SetHierarchicalLevel(int level)
Set/Get the Hierarchical/HierarchicalIndex.
Generate selection from given set of ids.
int GetArrayComponent()
Set/Get the component number for the array specified by ArrayName.
Superclass for algorithms that produce only Selection as output.
vtkTypeBool GetContainingCells()
When extracting by points, extract the cells that contain the passing points.
void SetFrustum(double *vertices)
Set a frustum to choose within.
int GetNumberOfLayersMinValue()
Set/Get the number of layers to extract connected to the selected elements.
virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
This is called by the superclass.
void RemoveAllLocations()
Remove all locations added with AddLocation.
void AddID(vtkIdType piece, vtkIdType id)
Add a (piece, id) to the selection set.
void SetNodeName(const char *name)
Set/Get the node name.
The selection data provided is table row-data.
void AddBlock(vtkIdType blockno)
Add the flat-index/composite index for a block.
Store zero or more vtkInformation instances.
const char * GetNodeName()
Set/Get the node name.
void SetAssemblyName(const char *name)
For selector-based selection qualification.
int GetContentType()
Set/Get the content type.
int GetContentTypeMinValue()
Set/Get the content type.
vtkTypeBool GetInverse()
Determines whether the selection describes what to include or exclude.
void AddBlockSelector(const char *selector)
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...
int GetContentTypeMaxValue()
Set/Get the content type.
void SetContentType(int contentType)
Set/Get the content type.
void AddThreshold(double min, double max)
Add a value range to threshold within.
#define max(a, b)
void RemoveAllBlockSelectors()
Add/Remove block-selectors to make selections with vtkSelectionNode::BLOCK_SELECTORS as the content-t...