VTK  9.3.0
vtkSelectPolyData.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
80#ifndef vtkSelectPolyData_h
81#define vtkSelectPolyData_h
82
83#include "vtkFiltersModelingModule.h" // For export macro
85
86#define VTK_INSIDE_SMALLEST_REGION 0
87#define VTK_INSIDE_LARGEST_REGION 1
88#define VTK_INSIDE_CLOSEST_POINT_REGION 2
89
90#define VTK_GREEDY_EDGE_SEARCH 0
91#define VTK_DIJKSTRA_EDGE_SEARCH 1
92
93VTK_ABI_NAMESPACE_BEGIN
94class vtkCharArray;
95class vtkPoints;
96class vtkIdList;
97
98class VTKFILTERSMODELING_EXPORT vtkSelectPolyData : public vtkPolyDataAlgorithm
99{
100public:
107
109 void PrintSelf(ostream& os, vtkIndent indent) override;
110
112
119 vtkSetMacro(GenerateSelectionScalars, vtkTypeBool);
120 vtkGetMacro(GenerateSelectionScalars, vtkTypeBool);
121 vtkBooleanMacro(GenerateSelectionScalars, vtkTypeBool);
123
125
128 vtkSetStringMacro(SelectionScalarsArrayName);
129 vtkGetStringMacro(SelectionScalarsArrayName);
131
133
137 vtkSetMacro(InsideOut, vtkTypeBool);
138 vtkGetMacro(InsideOut, vtkTypeBool);
139 vtkBooleanMacro(InsideOut, vtkTypeBool);
141
143
151 vtkSetClampMacro(EdgeSearchMode, int, VTK_GREEDY_EDGE_SEARCH, VTK_DIJKSTRA_EDGE_SEARCH);
152 vtkGetMacro(EdgeSearchMode, int);
153 void SetEdgeSearchModeToGreedy() { this->SetEdgeSearchMode(VTK_GREEDY_EDGE_SEARCH); }
154 void SetEdgeSearchModeToDijkstra() { this->SetEdgeSearchMode(VTK_DIJKSTRA_EDGE_SEARCH); }
155 const char* GetEdgeSearchModeAsString();
157
159
163 virtual void SetLoop(vtkPoints*);
164 vtkGetObjectMacro(Loop, vtkPoints);
166
168
171 vtkSetVector3Macro(ClosestPoint, double);
172 vtkGetVector3Macro(ClosestPoint, double);
174
176
179 vtkSetClampMacro(SelectionMode, int, VTK_INSIDE_SMALLEST_REGION, VTK_INSIDE_CLOSEST_POINT_REGION);
180 vtkGetMacro(SelectionMode, int);
184 {
185 this->SetSelectionMode(VTK_INSIDE_CLOSEST_POINT_REGION);
186 }
187 const char* GetSelectionModeAsString();
189
191
195 vtkSetMacro(GenerateUnselectedOutput, vtkTypeBool);
196 vtkGetMacro(GenerateUnselectedOutput, vtkTypeBool);
197 vtkBooleanMacro(GenerateUnselectedOutput, vtkTypeBool);
199
205
211
216
217 // Overload GetMTime() because we depend on Loop
219
220protected:
223
225
226 // Compute point list that forms a continuous loop overy the mesh,
229
230 // Returns maximum front cell ID
232 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkIntArray* cellMarks);
233
234 // Get closest cell to a position that is not at the boundary
236
237 // Starting from maxFrontCell, without crossing the boundary, set all cell and point marks to -1.
238 void FillMarksInRegion(vtkPolyData* mesh, vtkIdList* edgePointIds, vtkIntArray* pointMarks,
239 vtkIntArray* cellMarks, vtkIdType cellIdInSelectedRegion);
240
241 void SetClippedResultToOutput(vtkPointData* originalPointData, vtkCellData* originalCellData,
242 vtkPolyData* mesh, vtkIntArray* cellMarks, vtkPolyData* output);
243
244 void SetSelectionScalarsToOutput(vtkPointData* originalPointData, vtkCellData* originalCellData,
245 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkPolyData* output);
246
253 double ClosestPoint[3];
255
256private:
257 static void GetPointNeighbors(vtkPolyData* mesh, vtkIdType ptId, vtkIdList* nei);
258
259 // Helper function to check if the edge between pointId1 and pointId2 is present in the
260 // edgePointIds (as direct neighbors).
261 static bool IsBoundaryEdge(vtkIdType pointId1, vtkIdType pointId2, vtkIdList* edgePointIds);
262
263 vtkSelectPolyData(const vtkSelectPolyData&) = delete;
264 void operator=(const vtkSelectPolyData&) = delete;
265};
266
271{
273 {
274 return "InsideSmallestRegion";
275 }
277 {
278 return "InsideLargestRegion";
279 }
280 else
281 {
282 return "InsideClosestPointRegion";
283 }
284}
285
290{
292 {
293 return "GreedyEdgeSearch";
294 }
296 {
297 return "DijkstraEdgeSearch";
298 }
299 else
300 {
301 // This should never occur
302 return "Invalid";
303 }
304}
305
306VTK_ABI_NAMESPACE_END
307#endif
Proxy object to connect input/output ports.
represent and manipulate cell attribute data
Definition vtkCellData.h:31
dynamic, self-adjusting array of char
list of point or cell ids
Definition vtkIdList.h:23
a simple class to control print indentation
Definition vtkIndent.h:29
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:35
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:29
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:80
select portion of polygonal mesh; generate selection scalars
virtual void SetLoop(vtkPoints *)
Set/Get the array of point coordinates defining the loop.
vtkPolyData * GetSelectionEdges()
Return the (mesh) edges of the selection region.
vtkIdType ComputeTopologicalDistance(vtkPolyData *mesh, vtkIdList *edgeIds, vtkIntArray *pointMarks, vtkIntArray *cellMarks)
void SetSelectionScalarsToOutput(vtkPointData *originalPointData, vtkCellData *originalCellData, vtkPolyData *mesh, vtkIdList *edgeIds, vtkIntArray *pointMarks, vtkPolyData *output)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetSelectionModeToSmallestRegion()
Control how inside/outside of loop is defined.
void SetEdgeSearchModeToGreedy()
Set the edge search mode.
static vtkSelectPolyData * New()
Instantiate object with InsideOut turned off, and GenerateSelectionScalars turned off.
void SetSelectionModeToLargestRegion()
Control how inside/outside of loop is defined.
vtkTypeBool GenerateUnselectedOutput
int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
This is called by the superclass.
vtkIdType GetClosestCellId(vtkPolyData *mesh, vtkIntArray *pointMarks)
void SetClippedResultToOutput(vtkPointData *originalPointData, vtkCellData *originalCellData, vtkPolyData *mesh, vtkIntArray *cellMarks, vtkPolyData *output)
void DijkstraEdgeSearch(vtkPolyData *mesh, vtkIdList *edgeIds)
const char * GetSelectionModeAsString()
Return the method of determining in/out of loop as a string.
const char * GetEdgeSearchModeAsString()
Return the edge search mode as a string.
vtkTypeBool GenerateSelectionScalars
void SetSelectionModeToClosestPointRegion()
Control how inside/outside of loop is defined.
vtkAlgorithmOutput * GetUnselectedOutputPort()
Return output port that hasn't been selected (if GenreateUnselectedOutput is enabled).
void FillMarksInRegion(vtkPolyData *mesh, vtkIdList *edgePointIds, vtkIntArray *pointMarks, vtkIntArray *cellMarks, vtkIdType cellIdInSelectedRegion)
void SetEdgeSearchModeToDijkstra()
Set the edge search mode.
vtkMTimeType GetMTime() override
Return this object's modified time.
void GreedyEdgeSearch(vtkPolyData *mesh, vtkIdList *edgeIds)
~vtkSelectPolyData() override
vtkPolyData * GetUnselectedOutput()
Return output that hasn't been selected (if GenreateUnselectedOutput is enabled).
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INSIDE_SMALLEST_REGION
#define VTK_DIJKSTRA_EDGE_SEARCH
#define VTK_INSIDE_LARGEST_REGION
#define VTK_GREEDY_EDGE_SEARCH
#define VTK_INSIDE_CLOSEST_POINT_REGION
int vtkIdType
Definition vtkType.h:315
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270