Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Graphics/vtkSelectPolyData.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkSelectPolyData.h,v $
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00080 #ifndef __vtkSelectPolyData_h
00081 #define __vtkSelectPolyData_h
00082 
00083 #include "vtkPolyDataToPolyDataFilter.h"
00084 
00085 #define VTK_INSIDE_SMALLEST_REGION 0
00086 #define VTK_INSIDE_LARGEST_REGION 1
00087 #define VTK_INSIDE_CLOSEST_POINT_REGION 2
00088 
00089 class vtkCharArray;
00090 class vtkPoints;
00091 class vtkIdList;
00092 
00093 class VTK_GRAPHICS_EXPORT vtkSelectPolyData : public vtkPolyDataToPolyDataFilter
00094 {
00095 public:
00099   static vtkSelectPolyData *New();
00100 
00101   vtkTypeRevisionMacro(vtkSelectPolyData,vtkPolyDataToPolyDataFilter);
00102   void PrintSelf(ostream& os, vtkIndent indent);
00103 
00105 
00110   vtkSetMacro(GenerateSelectionScalars,int);
00111   vtkGetMacro(GenerateSelectionScalars,int);
00112   vtkBooleanMacro(GenerateSelectionScalars,int);
00114 
00116 
00118   vtkSetMacro(InsideOut,int);
00119   vtkGetMacro(InsideOut,int);
00120   vtkBooleanMacro(InsideOut,int);
00122 
00124 
00126   virtual void SetLoop(vtkPoints*);
00127   vtkGetObjectMacro(Loop,vtkPoints);
00129 
00131 
00132   vtkSetClampMacro(SelectionMode,int,
00133              VTK_INSIDE_SMALLEST_REGION,VTK_INSIDE_CLOSEST_POINT_REGION);
00134   vtkGetMacro(SelectionMode,int);
00135   void SetSelectionModeToSmallestRegion()
00136     {this->SetSelectionMode(VTK_INSIDE_SMALLEST_REGION);};
00137   void SetSelectionModeToLargestRegion()
00138     {this->SetSelectionMode(VTK_INSIDE_LARGEST_REGION);};
00139   void SetSelectionModeToClosestPointRegion()
00140     {this->SetSelectionMode(VTK_INSIDE_CLOSEST_POINT_REGION);};
00141   const char *GetSelectionModeAsString();
00143 
00145 
00147   vtkSetMacro(GenerateUnselectedOutput,int);
00148   vtkGetMacro(GenerateUnselectedOutput,int);
00149   vtkBooleanMacro(GenerateUnselectedOutput,int);
00151 
00154   vtkPolyData *GetUnselectedOutput() {return this->UnselectedOutput;};
00155 
00157   vtkPolyData *GetSelectionEdges() {return this->SelectionEdges;};
00158 
00159   // Overload GetMTime() because we depend on Loop
00160   unsigned long int GetMTime();
00161 
00163   virtual void UnRegister(vtkObjectBase *o);
00164 
00166   virtual int InRegisterLoop(vtkObject *);
00167 
00168 protected:
00169   vtkSelectPolyData();
00170   ~vtkSelectPolyData();
00171 
00172   void Execute();
00173 
00174   int GenerateSelectionScalars;
00175   int InsideOut;
00176   vtkPoints *Loop;
00177   int SelectionMode;
00178   double ClosestPoint[3];
00179   int GenerateUnselectedOutput;
00180   vtkPolyData *UnselectedOutput;
00181   vtkPolyData *SelectionEdges;
00182 
00183 private:
00184   vtkPolyData *Mesh;
00185   void GetPointNeighbors (vtkIdType ptId, vtkIdList *nei);
00186 private:
00187   vtkSelectPolyData(const vtkSelectPolyData&);  // Not implemented.
00188   void operator=(const vtkSelectPolyData&);  // Not implemented.
00189 };
00190 
00192 inline const char *vtkSelectPolyData::GetSelectionModeAsString(void)
00193 {
00194   if ( this->SelectionMode == VTK_INSIDE_SMALLEST_REGION ) 
00195     {
00196     return "InsideSmallestRegion";
00197     }
00198   else if ( this->SelectionMode == VTK_INSIDE_LARGEST_REGION ) 
00199     {
00200     return "InsideLargestRegion";
00201     }
00202   else 
00203     {
00204     return "InsideClosestPointRegion";
00205     }
00206 }
00207 
00208 #endif
00209 
00210