VTK  9.0.1
vtkExtractSelection.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkExtractSelection.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 =========================================================================*/
35 #ifndef vtkExtractSelection_h
36 #define vtkExtractSelection_h
37 
38 #include "vtkDataObjectAlgorithm.h"
39 #include "vtkFiltersExtractionModule.h" // For export macro
40 
41 #include "vtkSelectionNode.h" // for vtkSelectionNode::SelectionContent
42 #include "vtkSmartPointer.h" // for smart pointer
43 
44 class vtkSignedCharArray;
45 class vtkSelection;
46 class vtkSelectionNode;
47 class vtkSelector;
49 class vtkTable;
50 
51 class VTKFILTERSEXTRACTION_EXPORT vtkExtractSelection : public vtkDataObjectAlgorithm
52 {
53 public:
54  static vtkExtractSelection* New();
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
63  {
64  this->SetInputConnection(1, algOutput);
65  }
66 
68 
73  vtkSetMacro(PreserveTopology, bool);
74  vtkGetMacro(PreserveTopology, bool);
75  vtkBooleanMacro(PreserveTopology, bool);
77 
78 protected:
80  ~vtkExtractSelection() override;
81 
85  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
86  vtkInformationVector* outputVector) override;
90  int RequestData(vtkInformation* request, vtkInformationVector** inputVector,
91  vtkInformationVector* outputVector) override;
92 
93  // Gets the attribute association of the selection. Currently we support ROW, POINT, and CELL.
94  // If the selection types are mismatched the boolean parameter will be set to false, otherwise
95  // it will be true after the function returns.
96  vtkDataObject::AttributeTypes GetAttributeTypeOfSelection(vtkSelection* sel, bool& sane);
97 
102  virtual vtkSmartPointer<vtkSelector> NewSelectionOperator(
104 
112  vtkSmartPointer<vtkDataObject> ExtractElements(vtkDataObject* block,
113  vtkDataObject::AttributeTypes elementType, vtkSignedCharArray* insidednessArray);
114 
115  int FillInputPortInformation(int port, vtkInformation* info) override;
116 
121  void ExtractSelectedCells(
122  vtkDataSet* input, vtkUnstructuredGrid* output, vtkSignedCharArray* cellInside);
128  void ExtractSelectedPoints(
129  vtkDataSet* input, vtkUnstructuredGrid* output, vtkSignedCharArray* pointInside);
134  void ExtractSelectedRows(vtkTable* input, vtkTable* output, vtkSignedCharArray* rowsInside);
135 
136  bool PreserveTopology = false;
137 
138 private:
139  vtkExtractSelection(const vtkExtractSelection&) = delete;
140  void operator=(const vtkExtractSelection&) = delete;
141 };
142 
143 #endif
vtkDataObjectAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkSelectionNode
A node in a selection tree. Used to store selection results.
Definition: vtkSelectionNode.h:61
vtkX3D::type
@ type
Definition: vtkX3D.h:522
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
vtkDataObjectAlgorithm
Superclass for algorithms that produce only data object as output.
Definition: vtkDataObjectAlgorithm.h:43
vtkExtractSelection
extract a subset from a vtkDataSet.
Definition: vtkExtractSelection.h:51
vtkSmartPointer
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
vtkSignedCharArray
dynamic, self-adjusting array of signed char
Definition: vtkSignedCharArray.h:35
vtkSelection
data object that represents a "selection" in VTK.
Definition: vtkSelection.h:57
vtkSelectionNode::SelectionContent
SelectionContent
Indicate the means by which data is selected.
Definition: vtkSelectionNode.h:127
vtkSelector
Definition: vtkSelector.h:38
vtkX3D::port
@ port
Definition: vtkX3D.h:453
vtkSelectionNode.h
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkSmartPointer.h
vtkExtractSelection::SetSelectionConnection
void SetSelectionConnection(vtkAlgorithmOutput *algOutput)
Convenience method to specify the selection connection (2nd input port)
Definition: vtkExtractSelection.h:62
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkAlgorithm::SetInputConnection
virtual void SetInputConnection(int port, vtkAlgorithmOutput *input)
Set the connection for the given input port index.
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:73
vtkX3D::info
@ info
Definition: vtkX3D.h:382
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:36
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Definition: vtkDataObjectAlgorithm.h:116
vtkUnstructuredGrid
dataset represents arbitrary combinations of all possible cell types
Definition: vtkUnstructuredGrid.h:92
vtkDataObjectAlgorithm.h
vtkDataObjectAlgorithm::FillInputPortInformation
int FillInputPortInformation(int port, vtkInformation *info) override
Fill the input port information objects for this algorithm.
vtkDataObjectAlgorithm::RequestDataObject
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkDataObjectAlgorithm.h:102
vtkDataObject
general representation of visualization data
Definition: vtkDataObject.h:59
vtkDataObject::AttributeTypes
AttributeTypes
Possible attribute types.
Definition: vtkDataObject.h:263