VTK
dox/Rendering/vtkVisibleCellSelector.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkVisibleCellSelector.h
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 =========================================================================*/
00055 #ifndef __vtkVisibleCellSelector_h
00056 #define __vtkVisibleCellSelector_h
00057 
00058 #include "vtkObject.h"
00059 
00060 class vtkRenderer;
00061 class vtkIdTypeArray;
00062 class vtkIntArray;
00063 class vtkSelection;
00064 class vtkProp;
00065 class vtkIdentColoredPainter;
00066 
00067 class VTK_RENDERING_EXPORT vtkVisibleCellSelector  : public vtkObject
00068 {
00069 public:
00070   vtkTypeMacro(vtkVisibleCellSelector, vtkObject);
00071   void PrintSelf(ostream& os, vtkIndent indent);
00072   static vtkVisibleCellSelector *New();
00073 
00075   virtual void SetRenderer(vtkRenderer *);
00076 
00078 
00080   void SetArea(unsigned int x0, unsigned int y0,
00081                unsigned int x1, unsigned int y1);
00083 
00085 
00086   void GetArea(unsigned int &x0, unsigned int &y0,
00087                unsigned int &x1, unsigned int &y1);
00089 
00091 
00094   virtual void SetProcessorId(unsigned int pid);
00095   vtkGetMacro(ProcessorId, unsigned int);
00097 
00099 
00105   void SetRenderPasses(int DoProcessor, int DoActor, 
00106                        int DoCellIdHi, int DoCellIdMid, int DoCellIdLo,
00107                        int DoVertexId=0);
00109 
00111   void Select();
00112 
00117   void GetSelectedIds(vtkIdTypeArray *ToCopyInto);
00118 
00120   void GetSelectedIds(vtkSelection *ToCopyInto);
00121 
00123 
00132   void GetSelectedVertices(vtkIdTypeArray *VertexPointers,
00133                            vtkIdTypeArray *VertexIds);
00135 
00138   vtkProp* GetActorFromId(vtkIdType id);
00139 
00141   void PrintSelectedIds(vtkIdTypeArray *IdsToPrint);
00142 
00144 
00147   void GetPixelSelection( int displayPos[2],
00148                           vtkIdType & procId,
00149                           vtkIdType & cellId,
00150                           vtkIdType & vertId,
00151                           vtkProp  *& actorPtr );  
00153 
00154 protected:
00155   vtkVisibleCellSelector();
00156   ~vtkVisibleCellSelector();
00157 
00160   void SavePixelBuffer(int pass, unsigned char *src);
00161 
00164   void ComputeSelectedIds();
00165 
00167   void SetSelectMode(int mode);
00168 
00169   // Simply calls this->Renderer's method of the same name.
00170   void SetSelectConst(unsigned int constant);
00171 
00172   void SetIdentPainter(vtkIdentColoredPainter *);
00173 
00174   vtkRenderer *Renderer;
00175 
00176   int DoProcessor;
00177   int DoActor;
00178   int DoCellIdHi;
00179   int DoCellIdMid;
00180   int DoCellIdLo;
00181   int DoVertices;
00182 
00183   unsigned int ProcessorId;
00184 
00185   unsigned int X0;
00186   unsigned int Y0;
00187   unsigned int X1;
00188   unsigned int Y1;
00189 
00190   //buffer for id colored pixels
00191   unsigned char *PixBuffer[6];
00192 
00194 
00195   vtkIdTypeArray *SelectedIds;
00196   vtkIntArray *PixelCounts;
00197   vtkIdTypeArray *VertexPointers;
00198   vtkIdTypeArray *VertexLists;
00200 
00201   vtkIdentColoredPainter *IdentPainter;
00202 private:
00203   vtkVisibleCellSelector(const vtkVisibleCellSelector&); //Not implemented
00204   void operator=(const vtkVisibleCellSelector&); //Not implemented
00205 };
00206 
00207 #endif