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=========================================================================*/
88
89#ifndef vtkSelectPolyData_h
90#define vtkSelectPolyData_h
91
92#include "vtkFiltersModelingModule.h" // For export macro
94
95#define VTK_INSIDE_SMALLEST_REGION 0
96#define VTK_INSIDE_LARGEST_REGION 1
97#define VTK_INSIDE_CLOSEST_POINT_REGION 2
98
99#define VTK_GREEDY_EDGE_SEARCH 0
100#define VTK_DIJKSTRA_EDGE_SEARCH 1
101
102class vtkCharArray;
103class vtkPoints;
104class vtkIdList;
105
106class VTKFILTERSMODELING_EXPORT vtkSelectPolyData : public vtkPolyDataAlgorithm
107{
108public:
115
117 void PrintSelf(ostream& os, vtkIndent indent) override;
118
120
131
133
137 vtkSetMacro(InsideOut, vtkTypeBool);
138 vtkGetMacro(InsideOut, vtkTypeBool);
139 vtkBooleanMacro(InsideOut, vtkTypeBool);
141
143
152 vtkGetMacro(EdgeSearchMode, int);
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
180 vtkGetMacro(SelectionMode, int);
187 const char* GetSelectionModeAsString();
189
191
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, vtkPolyData* mesh,
242 vtkIntArray* cellMarks, vtkPolyData* output);
243
244 void SetSelectionScalarsToOutput(vtkPointData* originalPointData, vtkCellData* originalCellData,
245 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkPolyData* output);
246
252 double ClosestPoint[3];
254
255private:
256 static void GetPointNeighbors(vtkPolyData* mesh, vtkIdType ptId, vtkIdList* nei);
257
258 // Helper function to check if the edge between pointId1 and pointId2 is present in the
259 // edgePointIds (as direct neighbors).
260 static bool IsBoundaryEdge(vtkIdType pointId1, vtkIdType pointId2, vtkIdList* edgePointIds);
261
262private:
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
306#endif
Proxy object to connect input/output ports.
represent and manipulate cell attribute data
Definition vtkCellData.h:36
dynamic, self-adjusting array of char
list of point or cell ids
Definition vtkIdList.h:31
a simple class to control print indentation
Definition vtkIndent.h:34
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:40
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:34
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:85
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)
virtual void SetSelectionMode(int)
Control how inside/outside of loop is defined.
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.
virtual void SetEdgeSearchMode(int)
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