VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/Annotation/vtkLegendBoxActor.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkLegendBoxActor.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 =========================================================================*/
00040 #ifndef vtkLegendBoxActor_h
00041 #define vtkLegendBoxActor_h
00042 
00043 #include "vtkRenderingAnnotationModule.h" // For export macro
00044 #include "vtkActor2D.h"
00045 
00046 class vtkActor;
00047 class vtkDoubleArray;
00048 class vtkImageData;
00049 class vtkPolyData;
00050 class vtkPolyDataMapper2D;
00051 class vtkPolyDataMapper;
00052 class vtkPlaneSource;
00053 class vtkTextMapper;
00054 class vtkTextProperty;
00055 class vtkTexturedActor2D;
00056 class vtkTransform;
00057 class vtkTransformPolyDataFilter;
00058 class vtkProperty2D;
00059 
00060 class VTKRENDERINGANNOTATION_EXPORT vtkLegendBoxActor : public vtkActor2D
00061 {
00062 public:
00063   vtkTypeMacro(vtkLegendBoxActor,vtkActor2D);
00064   void PrintSelf(ostream& os, vtkIndent indent);
00065 
00068   static vtkLegendBoxActor *New();
00069 
00071 
00072   void SetNumberOfEntries(int num);
00073   int GetNumberOfEntries()
00074     {return this->NumberOfEntries;}
00076 
00078 
00086   void SetEntry(int i, vtkPolyData *symbol, const char* string, double color[3]);
00087   void SetEntry(int i, vtkImageData *symbol, const char* string, double color[3]);
00088   void SetEntry(int i, vtkPolyData *symbol, vtkImageData *icon,
00089                 const char* string, double color[3]);
00091 
00092   void SetEntrySymbol (int i, vtkPolyData *symbol);
00093   void SetEntryIcon   (int i, vtkImageData *icon);
00094   void SetEntryString (int i, const char* string);
00095   void SetEntryColor  (int i, double color[3]);
00096   void SetEntryColor  (int i, double r, double g, double b);
00097 
00098   vtkPolyData*  GetEntrySymbol(int i);
00099   vtkImageData* GetEntryIcon(int i);
00100   const char*   GetEntryString(int i);
00101   double*       GetEntryColor(int i);
00102 
00104 
00105   virtual void SetEntryTextProperty(vtkTextProperty *p);
00106   vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
00108 
00110 
00112   vtkSetMacro(Border, int);
00113   vtkGetMacro(Border, int);
00114   vtkBooleanMacro(Border, int);
00116 
00118 
00124   vtkSetMacro(LockBorder, int);
00125   vtkGetMacro(LockBorder, int);
00126   vtkBooleanMacro(LockBorder, int);
00128 
00130 
00132   vtkSetMacro(Box, int);
00133   vtkGetMacro(Box, int);
00134   vtkBooleanMacro(Box, int);
00136 
00138   vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
00139 
00141 
00143   vtkSetClampMacro(Padding, int, 0, 50);
00144   vtkGetMacro(Padding, int);
00146 
00148 
00151   vtkSetMacro(ScalarVisibility,int);
00152   vtkGetMacro(ScalarVisibility,int);
00153   vtkBooleanMacro(ScalarVisibility,int);
00155 
00157 
00158   vtkSetMacro(UseBackground, int);
00159   vtkGetMacro(UseBackground, int);
00160   vtkBooleanMacro(UseBackground, int);
00162 
00164 
00165   vtkSetVector3Macro(BackgroundColor, double);
00166   vtkGetVector3Macro(BackgroundColor, double);
00168 
00170 
00171   vtkSetClampMacro(BackgroundOpacity, double, 0.0, 1.0);
00172   vtkGetMacro(BackgroundOpacity, double);
00174 
00177   void ShallowCopy(vtkProp *prop);
00178 
00179 //BTX
00184   virtual void ReleaseGraphicsResources(vtkWindow *);
00185 
00187 
00190   int RenderOpaqueGeometry(vtkViewport* viewport);
00191   virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) {return 0;};
00192   int RenderOverlay(vtkViewport* viewport);
00194 
00196 
00197   virtual int HasTranslucentPolygonalGeometry();
00198 //ETX
00200 
00201 protected:
00202   vtkLegendBoxActor();
00203   ~vtkLegendBoxActor();
00204 
00205   void InitializeEntries();
00206 
00207   vtkPolyData createTexturedPlane();
00208 
00209   int   Border;
00210   int   Box;
00211   int   Padding;
00212   int   LockBorder;
00213   int   ScalarVisibility;
00214   double BoxOpacity;
00215 
00216   // Internal actors, mappers, data to represent the legend
00217   int                        NumberOfEntries;
00218   int                        Size; //allocation size
00219   vtkDoubleArray              *Colors;
00220   vtkTextMapper              **TextMapper;
00221   vtkActor2D                 **TextActor;
00222 
00223   vtkPolyData                **Symbol;
00224   vtkTransform               **Transform;
00225   vtkTransformPolyDataFilter **SymbolTransform;
00226   vtkPolyDataMapper2D        **SymbolMapper;
00227   vtkActor2D                 **SymbolActor;
00228 
00229   vtkPlaneSource             **Icon;
00230   vtkTransform               **IconTransform;
00231   vtkTransformPolyDataFilter **IconTransformFilter;
00232   vtkPolyDataMapper2D        **IconMapper;
00233   vtkTexturedActor2D         **IconActor;
00234   vtkImageData               **IconImage;
00235 
00236   vtkPolyData                *BorderPolyData;
00237   vtkPolyDataMapper2D        *BorderMapper;
00238   vtkActor2D                 *BorderActor;
00239   vtkPolyData                *BoxPolyData;
00240   vtkPolyDataMapper2D        *BoxMapper;
00241   vtkActor2D                 *BoxActor;
00242   vtkTextProperty            *EntryTextProperty;
00243 
00244   // Background plane.
00245   int                         UseBackground;
00246   double                      BackgroundOpacity;
00247   double                      BackgroundColor[3];
00248   vtkPlaneSource             *Background;
00249 
00250   // May use texture.
00251   vtkTexturedActor2D         *BackgroundActor;
00252   vtkPolyDataMapper2D        *BackgroundMapper;
00253 
00254   // Used to control whether the stuff is recomputed
00255   int           LegendEntriesVisible;
00256   int           CachedSize[2];
00257   vtkTimeStamp  BuildTime;
00258 
00259 private:
00260   vtkLegendBoxActor(const vtkLegendBoxActor&);  // Not implemented.
00261   void operator=(const vtkLegendBoxActor&);  // Not implemented.
00262 };
00263 
00264 
00265 #endif
00266