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=========================================================================*/
111#ifndef vtkSelectPolyData_h
112#define vtkSelectPolyData_h
113
114#include "vtkFiltersModelingModule.h" // For export macro
115#include "vtkPolyDataAlgorithm.h"
116
117#define VTK_INSIDE_SMALLEST_REGION 0
118#define VTK_INSIDE_LARGEST_REGION 1
119#define VTK_INSIDE_CLOSEST_POINT_REGION 2
120
121#define VTK_GREEDY_EDGE_SEARCH 0
122#define VTK_DIJKSTRA_EDGE_SEARCH 1
123
124class vtkCharArray;
125class vtkPoints;
126class vtkIdList;
127
128class VTKFILTERSMODELING_EXPORT vtkSelectPolyData : public vtkPolyDataAlgorithm
129{
130public:
137
139 void PrintSelf(ostream& os, vtkIndent indent) override;
140
142
149 vtkSetMacro(GenerateSelectionScalars, vtkTypeBool);
150 vtkGetMacro(GenerateSelectionScalars, vtkTypeBool);
151 vtkBooleanMacro(GenerateSelectionScalars, vtkTypeBool);
153
155
159 vtkSetMacro(InsideOut, vtkTypeBool);
160 vtkGetMacro(InsideOut, vtkTypeBool);
161 vtkBooleanMacro(InsideOut, vtkTypeBool);
163
165
173 vtkSetClampMacro(EdgeSearchMode, int, VTK_GREEDY_EDGE_SEARCH, VTK_DIJKSTRA_EDGE_SEARCH);
174 vtkGetMacro(EdgeSearchMode, int);
175 void SetEdgeSearchModeToGreedy() { this->SetEdgeSearchMode(VTK_GREEDY_EDGE_SEARCH); }
176 void SetEdgeSearchModeToDijkstra() { this->SetEdgeSearchMode(VTK_DIJKSTRA_EDGE_SEARCH); }
177 const char* GetEdgeSearchModeAsString();
179
181
185 virtual void SetLoop(vtkPoints*);
186 vtkGetObjectMacro(Loop, vtkPoints);
188
190
193 vtkSetVector3Macro(ClosestPoint, double);
194 vtkGetVector3Macro(ClosestPoint, double);
196
198
201 vtkSetClampMacro(SelectionMode, int, VTK_INSIDE_SMALLEST_REGION, VTK_INSIDE_CLOSEST_POINT_REGION);
202 vtkGetMacro(SelectionMode, int);
206 {
207 this->SetSelectionMode(VTK_INSIDE_CLOSEST_POINT_REGION);
208 }
209 const char* GetSelectionModeAsString();
211
213
217 vtkSetMacro(GenerateUnselectedOutput, vtkTypeBool);
218 vtkGetMacro(GenerateUnselectedOutput, vtkTypeBool);
219 vtkBooleanMacro(GenerateUnselectedOutput, vtkTypeBool);
221
227
233
238
239 // Overload GetMTime() because we depend on Loop
241
242protected:
245
247
248 // Compute point list that forms a continuous loop overy the mesh,
251
252 // Returns maximum front cell ID
254 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkIntArray* cellMarks);
255
256 // Get closest cell to a position that is not at the boundary
258
259 // Starting from maxFrontCell, without crossing the boundary, set all cell and point marks to -1.
260 void FillMarksInRegion(vtkPolyData* mesh, vtkIdList* edgePointIds, vtkIntArray* pointMarks,
261 vtkIntArray* cellMarks, vtkIdType cellIdInSelectedRegion);
262
263 void SetClippedResultToOutput(vtkPointData* originalPointData, vtkPolyData* mesh,
264 vtkIntArray* cellMarks, vtkPolyData* output);
265
266 void SetSelectionScalarsToOutput(vtkPointData* originalPointData, vtkCellData* originalCellData,
267 vtkPolyData* mesh, vtkIdList* edgeIds, vtkIntArray* pointMarks, vtkPolyData* output);
268
274 double ClosestPoint[3];
276
277private:
278 static void GetPointNeighbors(vtkPolyData* mesh, vtkIdType ptId, vtkIdList* nei);
279
280 // Helper function to check if the edge between pointId1 and pointId2 is present in the
281 // edgePointIds (as direct neighbors).
282 static bool IsBoundaryEdge(vtkIdType pointId1, vtkIdType pointId2, vtkIdList* edgePointIds);
283
284private:
285 vtkSelectPolyData(const vtkSelectPolyData&) = delete;
286 void operator=(const vtkSelectPolyData&) = delete;
287};
288
293{
295 {
296 return "InsideSmallestRegion";
297 }
299 {
300 return "InsideLargestRegion";
301 }
302 else
303 {
304 return "InsideClosestPointRegion";
305 }
306}
307
312{
314 {
315 return "GreedyEdgeSearch";
316 }
318 {
319 return "DijkstraEdgeSearch";
320 }
321 else
322 {
323 // This should never occur
324 return "Invalid";
325 }
326}
327
328#endif
Proxy object to connect input/output ports.
represent and manipulate cell attribute data
Definition: vtkCellData.h:151
dynamic, self-adjusting array of char
Definition: vtkCharArray.h:71
list of point or cell ids
Definition: vtkIdList.h:143
a simple class to control print indentation
Definition: vtkIndent.h:119
Store zero or more vtkInformation instances.
Store vtkAlgorithm input/output information.
dynamic, self-adjusting array of int
Definition: vtkIntArray.h:155
represent and manipulate point attribute data
Definition: vtkPointData.h:151
represent and manipulate 3D points
Definition: vtkPoints.h:149
Superclass for algorithms that produce only polydata as output.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
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