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

vtkLegendBoxActor.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkLegendBoxActor.h,v $
00005   Language:  C++
00006 
00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen 
00008   All rights reserved.
00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00010 
00011      This software is distributed WITHOUT ANY WARRANTY; without even 
00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00013      PURPOSE.  See the above copyright notice for more information.
00014 
00015 =========================================================================*/
00041 #ifndef __vtkLegendBoxActor_h
00042 #define __vtkLegendBoxActor_h
00043 
00044 #include "vtkActor2D.h"
00045 
00046 class vtkActor;
00047 class vtkFloatArray;
00048 class vtkPolyData;
00049 class vtkPolyDataMapper2D;
00050 class vtkPolyDataMapper;
00051 class vtkTextMapper;
00052 class vtkTextProperty;
00053 class vtkTransform;
00054 class vtkTransformPolyDataFilter;
00055 class vtkProperty2D;
00056 
00057 class VTK_HYBRID_EXPORT vtkLegendBoxActor : public vtkActor2D
00058 {
00059 public:
00060   vtkTypeRevisionMacro(vtkLegendBoxActor,vtkActor2D);
00061   void PrintSelf(ostream& os, vtkIndent indent);
00062 
00065   static vtkLegendBoxActor *New();
00066 
00068 
00069   void SetNumberOfEntries(int num);
00070   int GetNumberOfEntries()
00071     {return this->NumberOfEntries;}
00073 
00075 
00083   void SetEntry(int i, vtkPolyData *symbol, const char* string, float color[3]);
00084   void SetEntrySymbol(int i, vtkPolyData *symbol);
00085   void SetEntryString(int i, const char* string);
00086   void SetEntryColor(int i, float color[3]);
00087   void SetEntryColor(int i, float r, float g, float b);
00088   vtkPolyData *GetEntrySymbol(int i);
00089   const char* GetEntryString(int i);
00090   float *GetEntryColor(int i);
00092 
00094 
00095   virtual void SetEntryTextProperty(vtkTextProperty *p);
00096   vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
00098 
00099 #ifndef VTK_REMOVE_LEGACY_CODE
00100 
00101 
00105   virtual void SetFontFamily(int val);
00106   virtual int GetFontFamily();
00107   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
00108   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00109   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
00111 #endif
00112 
00113 #ifndef VTK_REMOVE_LEGACY_CODE
00114 
00115 
00118   virtual void SetBold(int val);
00119   virtual int GetBold();
00120   vtkBooleanMacro(Bold, int);
00122 #endif
00123 
00124 #ifndef VTK_REMOVE_LEGACY_CODE
00125 
00126 
00129   virtual void SetItalic(int val);
00130   virtual int GetItalic();
00131   vtkBooleanMacro(Italic, int);
00133 #endif
00134 
00135 #ifndef VTK_REMOVE_LEGACY_CODE
00136 
00137 
00140   virtual void SetShadow(int val);
00141   virtual int GetShadow();
00142   vtkBooleanMacro(Shadow, int);
00144 #endif
00145 
00147 
00149   vtkSetMacro(Border, int);
00150   vtkGetMacro(Border, int);
00151   vtkBooleanMacro(Border, int);
00153 
00155 
00161   vtkSetMacro(LockBorder, int);
00162   vtkGetMacro(LockBorder, int);
00163   vtkBooleanMacro(LockBorder, int);
00165 
00167 
00169   vtkSetMacro(Box, int);
00170   vtkGetMacro(Box, int);
00171   vtkBooleanMacro(Box, int);
00173 
00175   vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
00176 
00178 
00180   vtkSetClampMacro(Padding, int, 0, 50);
00181   vtkGetMacro(Padding, int);
00183 
00185 
00188   vtkSetMacro(ScalarVisibility,int);
00189   vtkGetMacro(ScalarVisibility,int);
00190   vtkBooleanMacro(ScalarVisibility,int);
00192 
00195   void ShallowCopy(vtkProp *prop);
00196 
00197 //BTX
00202   virtual void ReleaseGraphicsResources(vtkWindow *);
00203 
00205 
00208   int RenderOpaqueGeometry(vtkViewport* viewport);
00209   int RenderTranslucentGeometry(vtkViewport* ) {return 0;};
00210   int RenderOverlay(vtkViewport* viewport);
00212 //ETX
00213 
00214 protected:
00215   vtkLegendBoxActor();
00216   ~vtkLegendBoxActor();
00217 
00218   void InitializeEntries();
00219 
00220 
00221   int   Border;
00222   int   Box;
00223   int   Padding;
00224   int   LockBorder;
00225   int   ScalarVisibility;
00226   float BoxOpacity;
00227 
00228   // Internal actors, mappers, data to represent the legend
00229   int                        NumberOfEntries;
00230   int                        Size; //allocation size
00231   vtkFloatArray              *Colors;
00232   vtkTextMapper              **TextMapper;
00233   vtkActor2D                 **TextActor;
00234   vtkPolyData                **Symbol;
00235   vtkTransform               **Transform;
00236   vtkTransformPolyDataFilter **SymbolTransform;
00237   vtkPolyDataMapper2D        **SymbolMapper;
00238   vtkActor2D                 **SymbolActor;
00239   vtkPolyData                *BorderPolyData;
00240   vtkPolyDataMapper2D        *BorderMapper;
00241   vtkActor2D                 *BorderActor;
00242   vtkPolyData                *BoxPolyData;
00243   vtkPolyDataMapper2D        *BoxMapper;
00244   vtkActor2D                 *BoxActor;
00245   vtkTextProperty            *EntryTextProperty;
00246 
00247   // Used to control whether the stuff is recomputed
00248   int           LegendEntriesVisible;
00249   int           CachedSize[2];
00250   vtkTimeStamp  BuildTime;
00251 
00252 private:
00253   vtkLegendBoxActor(const vtkLegendBoxActor&);  // Not implemented.
00254   void operator=(const vtkLegendBoxActor&);  // Not implemented.
00255 };
00256 
00257 
00258 #endif
00259