VTK
dox/Rendering/vtkIdentColoredPainter.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkIdentColoredPainter.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 =========================================================================*/
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 //BTX
00097   enum {COLORBYIDENT=0, COLORBYCONST, COLORBYVERTEX};
00098 //ETX
00099   int ColorMode;
00100 
00101   //three 24 bit-fields of the 72 bit increment counter.
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&); // Not implemented.
00115   void operator=(const vtkIdentColoredPainter&); // Not implemented.
00116 };
00117 
00118 #endif //__vtkIdentColoredPainter_h