00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00045 #ifndef __vtkIdentColoredPainter_h
00046 #define __vtkIdentColoredPainter_h
00047 
00048 #include "vtkPolyDataPainter.h"
00049 
00050 class vtkCellArray;
00051 class vtkIdTypeArray;
00052 class vtkProp;
00053 
00054 class VTK_RENDERING_EXPORT vtkIdentColoredPainter : public vtkPolyDataPainter
00055 {
00056 public:
00057   vtkTypeMacro(vtkIdentColoredPainter, vtkPolyDataPainter);
00058   virtual void PrintSelf(ostream &os, vtkIndent indent);
00059   static vtkIdentColoredPainter *New();
00060 
00062   void ResetCurrentId();
00063 
00065   void ColorByConstant(unsigned int constant);
00066   
00070   void ColorByIncreasingIdent(unsigned int plane);
00071 
00073   void ColorByActorId(vtkProp *ActorId);
00074 
00076   void ColorByVertex();
00077 
00079   void MakeActorLookupTable(vtkProp **Props, vtkIdTypeArray *IdsForProps);
00080 
00082   vtkProp* GetActorFromId(vtkIdType id);
00083   
00084 protected:
00085   vtkIdentColoredPainter();
00086   ~vtkIdentColoredPainter();
00087   
00088   virtual void RenderInternal(vtkRenderer* renderer, vtkActor* actor,
00089                               unsigned long typeflags,bool forceCompileOnly);
00090 
00091   void DrawCells(int mode, vtkCellArray *connectivity,
00092     vtkIdType startCellId, vtkRenderer *renderer);
00093 
00094   vtkIdType TotalCells;
00095 
00096 
00097   enum {COLORBYIDENT=0, COLORBYCONST, COLORBYVERTEX};
00098 
00099   int ColorMode;
00100 
00101   
00102   unsigned int Plane;
00103   unsigned int CurrentIdPlane0;
00104   unsigned int CurrentIdPlane1;
00105   unsigned int CurrentIdPlane2;
00106 
00107   void IncrementCurrentId();
00108   void GetCurrentColor(unsigned char *RGB);
00109 
00110   vtkIdTypeArray *ActorIds;
00111   vtkProp **PropAddrs;
00112 
00113 private:
00114   vtkIdentColoredPainter(const vtkIdentColoredPainter&); 
00115   void operator=(const vtkIdentColoredPainter&); 
00116 };
00117 
00118 #endif //__vtkIdentColoredPainter_h