VTK  9.2.6
vtkSelectPolyData.h
Go to the documentation of this file.
1/*=========================================================================
2
3 Program: Visualization Toolkit
4 Module: vtkSelectPolyData.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=========================================================================*/
101#ifndef vtkSelectPolyData_h
102#define vtkSelectPolyData_h
103
104#include "vtkFiltersModelingModule.h" // For export macro
105#include "vtkPolyDataAlgorithm.h"
106
107#define VTK_INSIDE_SMALLEST_REGION 0
108#define VTK_INSIDE_LARGEST_REGION 1
109#define VTK_INSIDE_CLOSEST_POINT_REGION 2
110
111#define VTK_GREEDY_EDGE_SEARCH 0
112#define VTK_DIJKSTRA_EDGE_SEARCH 1
113
114class vtkCharArray;
115class vtkPoints;
116class vtkIdList;
117
118class VTKFILTERSMODELING_EXPORT vtkSelectPolyData : public vtkPolyDataAlgorithm
119{
120public:
127
129 void PrintSelf(ostream& os, vtkIndent indent) override;
130
132
139 vtkSetMacro(GenerateSelectionScalars, vtkTypeBool);
140 vtkGetMacro(GenerateSelectionScalars, vtkTypeBool);
141 vtkBooleanMacro(GenerateSelectionScalars, vtkTypeBool);
143
145
149 vtkSetMacro(InsideOut, vtkTypeBool);
150 vtkGetMacro(InsideOut, vtkTypeBool);
151 vtkBooleanMacro(InsideOut, vtkTypeBool);
153
155
163 vtkSetClampMacro(EdgeSearchMode, int, VTK_GREEDY_EDGE_SEARCH, VTK_DIJKSTRA_EDGE_SEARCH);
164 vtkGetMacro(EdgeSearchMode, int);
165 void SetEdgeSearchModeToGreedy() { this->SetEdgeSearchMode(VTK_GREEDY_EDGE_SEARCH); }
166 void SetEdgeSearchModeToDijkstra() { this->SetEdgeSearchMode(VTK_DIJKSTRA_EDGE_SEARCH); }
167 const char* GetEdgeSearchModeAsString();
169
171
175 virtual void SetLoop(vtkPoints*);
176 vtkGetObjectMacro(Loop, vtkPoints);
178
180
183 vtkSetVector3Macro(ClosestPoint, double);
184 vtkGetVector3Macro(ClosestPoint, double);
186
188
191 vtkSetClampMacro(SelectionMode, int, VTK_INSIDE_SMALLEST_REGION, VTK_INSIDE_CLOSEST_POINT_REGION);
192 vtkGetMacro(SelectionMode, int);
196 {
197 this->SetSelectionMode(VTK_INSIDE_CLOSEST_POINT_REGION);
198 }
199 const char* GetSelectionModeAsString();
201
203
207 vtkSetMacro(GenerateUnselectedOutput, vtkTypeBool);
208 vtkGetMacro(GenerateUnselectedOutput, vtkTypeBool);
209 vtkBooleanMacro(GenerateUnselectedOutput, vtkTypeBool);
211
217
223
228
229 // Overload GetMTime() because we depend on Loop
231
232protected:
235
237
238 // Compute point list that forms a continuous loop overy the mesh,
241
242 // Returns maximum front cell ID
244 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkIntArray* cellMarks);
245
246 // Get closest cell to a position that is not at the boundary
248
249 // Starting from maxFrontCell, without crossing the boundary, set all cell and point marks to -1.
250 void FillMarksInRegion(vtkPolyData* mesh, vtkIdList* edgePointIds, vtkIntArray* pointMarks,
251 vtkIntArray* cellMarks, vtkIdType cellIdInSelectedRegion);
252
253 void SetClippedResultToOutput(vtkPointData* originalPointData, vtkPolyData* mesh,
254 vtkIntArray* cellMarks, vtkPolyData* output);
255
256 void SetSelectionScalarsToOutput(vtkPointData* originalPointData, vtkCellData* originalCellData,
257 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkPolyData* output);
258
264 double ClosestPoint[3];
266
267private:
268 static void GetPointNeighbors(vtkPolyData* mesh, vtkIdType ptId, vtkIdList* nei);
269
270 // Helper function to check if the edge between pointId1 and pointId2 is present in the
271 // edgePointIds (as direct neighbors).
272 static bool IsBoundaryEdge(vtkIdType pointId1, vtkIdType pointId2, vtkIdList* edgePointIds);
273
274private:
275 vtkSelectPolyData(const vtkSelectPolyData&) = delete;
276 void operator=(const vtkSelectPolyData&) = delete;
277};
278
283{
285 {
286 return "InsideSmallestRegion";
287 }
289 {
290 return "InsideLargestRegion";
291 }
292 else
293 {
294 return "InsideClosestPointRegion";
295 }
296}
297
302{
304 {
305 return "GreedyEdgeSearch";
306 }
308 {
309 return "DijkstraEdgeSearch";
310 }
311 else
312 {
313 // This should never occur
314 return "Invalid";
315 }
316}
317
318#endif
Proxy object to connect input/output ports.
represent and manipulate cell attribute data
Definition vtkCellData.h:51
dynamic, self-adjusting array of char
list of point or cell ids
Definition vtkIdList.h:43
a simple class to control print indentation
Definition vtkIndent.h:49
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:55
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:49
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
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, 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:69
#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:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287