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=========================================================================*/
91
92#ifndef vtkSelectPolyData_h
93#define vtkSelectPolyData_h
94
95#include "vtkFiltersModelingModule.h" // For export macro
97
98#define VTK_INSIDE_SMALLEST_REGION 0
99#define VTK_INSIDE_LARGEST_REGION 1
100#define VTK_INSIDE_CLOSEST_POINT_REGION 2
101
102#define VTK_GREEDY_EDGE_SEARCH 0
103#define VTK_DIJKSTRA_EDGE_SEARCH 1
104
105class vtkCharArray;
106class vtkPoints;
107class vtkIdList;
108
109class VTKFILTERSMODELING_EXPORT vtkSelectPolyData : public vtkPolyDataAlgorithm
110{
111public:
118
120 void PrintSelf(ostream& os, vtkIndent indent) override;
121
123
134
136
140 vtkSetMacro(InsideOut, vtkTypeBool);
141 vtkGetMacro(InsideOut, vtkTypeBool);
142 vtkBooleanMacro(InsideOut, vtkTypeBool);
144
146
155 vtkGetMacro(EdgeSearchMode, int);
158 const char* GetEdgeSearchModeAsString();
160
162
166 virtual void SetLoop(vtkPoints*);
167 vtkGetObjectMacro(Loop, vtkPoints);
169
171
174 vtkSetVector3Macro(ClosestPoint, double);
175 vtkGetVector3Macro(ClosestPoint, double);
177
179
183 vtkGetMacro(SelectionMode, int);
190 const char* GetSelectionModeAsString();
192
194
202
208
214
219
220 // Overload GetMTime() because we depend on Loop
222
223protected:
226
228
229 // Compute point list that forms a continuous loop overy the mesh,
232
233 // Returns maximum front cell ID
235 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkIntArray* cellMarks);
236
237 // Get closest cell to a position that is not at the boundary
239
240 // Starting from maxFrontCell, without crossing the boundary, set all cell and point marks to -1.
241 void FillMarksInRegion(vtkPolyData* mesh, vtkIdList* edgePointIds, vtkIntArray* pointMarks,
242 vtkIntArray* cellMarks, vtkIdType cellIdInSelectedRegion);
243
244 void SetClippedResultToOutput(vtkPointData* originalPointData, vtkPolyData* mesh,
245 vtkIntArray* cellMarks, vtkPolyData* output);
246
247 void SetSelectionScalarsToOutput(vtkPointData* originalPointData, vtkCellData* originalCellData,
248 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkPolyData* output);
249
255 double ClosestPoint[3];
257
258private:
259 static void GetPointNeighbors(vtkPolyData* mesh, vtkIdType ptId, vtkIdList* nei);
260
261 // Helper function to check if the edge between pointId1 and pointId2 is present in the
262 // edgePointIds (as direct neighbors).
263 static bool IsBoundaryEdge(vtkIdType pointId1, vtkIdType pointId2, vtkIdList* edgePointIds);
264
265private:
266 vtkSelectPolyData(const vtkSelectPolyData&) = delete;
267 void operator=(const vtkSelectPolyData&) = delete;
268};
269
274{
276 {
277 return "InsideSmallestRegion";
278 }
280 {
281 return "InsideLargestRegion";
282 }
283 else
284 {
285 return "InsideClosestPointRegion";
286 }
287}
288
293{
295 {
296 return "GreedyEdgeSearch";
297 }
299 {
300 return "DijkstraEdgeSearch";
301 }
302 else
303 {
304 // This should never occur
305 return "Invalid";
306 }
307}
308
309#endif
Proxy object to connect input/output ports.
represent and manipulate cell attribute data
Definition vtkCellData.h:42
dynamic, self-adjusting array of char
list of point or cell ids
Definition vtkIdList.h:34
a simple class to control print indentation
Definition vtkIndent.h:40
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition vtkIntArray.h:46
represent and manipulate point attribute data
represent and manipulate 3D points
Definition vtkPoints.h:40
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition vtkPolyData.h:91
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