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

Hybrid/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 =========================================================================*/
00053 #ifndef __vtkLegendBoxActor_h
00054 #define __vtkLegendBoxActor_h
00055 
00056 #include "vtkActor2D.h"
00057 
00058 class vtkActor;
00059 class vtkFloatArray;
00060 class vtkPolyData;
00061 class vtkPolyDataMapper2D;
00062 class vtkPolyDataMapper;
00063 class vtkTextMapper;
00064 class vtkTextProperty;
00065 class vtkTransform;
00066 class vtkTransformPolyDataFilter;
00067 class vtkProperty2D;
00068 
00069 class VTK_HYBRID_EXPORT vtkLegendBoxActor : public vtkActor2D
00070 {
00071 public:
00072   vtkTypeRevisionMacro(vtkLegendBoxActor,vtkActor2D);
00073   void PrintSelf(ostream& os, vtkIndent indent);
00074 
00077   static vtkLegendBoxActor *New();
00078 
00080 
00081   void SetNumberOfEntries(int num);
00082   int GetNumberOfEntries()
00083     {return this->NumberOfEntries;}
00085 
00087 
00095   void SetEntry(int i, vtkPolyData *symbol, const char* string, float color[3]);
00096   void SetEntrySymbol(int i, vtkPolyData *symbol);
00097   void SetEntryString(int i, const char* string);
00098   void SetEntryColor(int i, float color[3]);
00099   void SetEntryColor(int i, float r, float g, float b);
00100   vtkPolyData *GetEntrySymbol(int i);
00101   const char* GetEntryString(int i);
00102   float *GetEntryColor(int i);
00104 
00106 
00107   virtual void SetEntryTextProperty(vtkTextProperty *p);
00108   vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
00110 
00111 #ifndef VTK_REMOVE_LEGACY_CODE
00112 
00113 
00117   virtual void SetFontFamily(int val);
00118   virtual int GetFontFamily();
00119   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
00120   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00121   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
00123 #endif
00124 
00125 #ifndef VTK_REMOVE_LEGACY_CODE
00126 
00127 
00130   virtual void SetBold(int val);
00131   virtual int GetBold();
00132   vtkBooleanMacro(Bold, int);
00134 #endif
00135 
00136 #ifndef VTK_REMOVE_LEGACY_CODE
00137 
00138 
00141   virtual void SetItalic(int val);
00142   virtual int GetItalic();
00143   vtkBooleanMacro(Italic, int);
00145 #endif
00146 
00147 #ifndef VTK_REMOVE_LEGACY_CODE
00148 
00149 
00152   virtual void SetShadow(int val);
00153   virtual int GetShadow();
00154   vtkBooleanMacro(Shadow, int);
00156 #endif
00157 
00159 
00161   vtkSetMacro(Border, int);
00162   vtkGetMacro(Border, int);
00163   vtkBooleanMacro(Border, int);
00165 
00167 
00173   vtkSetMacro(LockBorder, int);
00174   vtkGetMacro(LockBorder, int);
00175   vtkBooleanMacro(LockBorder, int);
00177 
00179 
00181   vtkSetMacro(Box, int);
00182   vtkGetMacro(Box, int);
00183   vtkBooleanMacro(Box, int);
00185 
00187   vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
00188 
00190 
00192   vtkSetClampMacro(Padding, int, 0, 50);
00193   vtkGetMacro(Padding, int);
00195 
00197 
00200   vtkSetMacro(ScalarVisibility,int);
00201   vtkGetMacro(ScalarVisibility,int);
00202   vtkBooleanMacro(ScalarVisibility,int);
00204 
00207   void ShallowCopy(vtkProp *prop);
00208 
00209 //BTX
00214   virtual void ReleaseGraphicsResources(vtkWindow *);
00215 
00217 
00220   int RenderOpaqueGeometry(vtkViewport* viewport);
00221   int RenderTranslucentGeometry(vtkViewport* ) {return 0;};
00222   int RenderOverlay(vtkViewport* viewport);
00224 //ETX
00225 
00226 protected:
00227   vtkLegendBoxActor();
00228   ~vtkLegendBoxActor();
00229 
00230   void InitializeEntries();
00231 
00232 
00233   int   Border;
00234   int   Box;
00235   int   Padding;
00236   int   LockBorder;
00237   int   ScalarVisibility;
00238   float BoxOpacity;
00239 
00240   // Internal actors, mappers, data to represent the legend
00241   int                        NumberOfEntries;
00242   int                        Size; //allocation size
00243   vtkFloatArray              *Colors;
00244   vtkTextMapper              **TextMapper;
00245   vtkActor2D                 **TextActor;
00246   vtkPolyData                **Symbol;
00247   vtkTransform               **Transform;
00248   vtkTransformPolyDataFilter **SymbolTransform;
00249   vtkPolyDataMapper2D        **SymbolMapper;
00250   vtkActor2D                 **SymbolActor;
00251   vtkPolyData                *BorderPolyData;
00252   vtkPolyDataMapper2D        *BorderMapper;
00253   vtkActor2D                 *BorderActor;
00254   vtkPolyData                *BoxPolyData;
00255   vtkPolyDataMapper2D        *BoxMapper;
00256   vtkActor2D                 *BoxActor;
00257   vtkTextProperty            *EntryTextProperty;
00258 
00259   // Used to control whether the stuff is recomputed
00260   int           LegendEntriesVisible;
00261   int           CachedSize[2];
00262   vtkTimeStamp  BuildTime;
00263 
00264 private:
00265   vtkLegendBoxActor(const vtkLegendBoxActor&);  // Not implemented.
00266   void operator=(const vtkLegendBoxActor&);  // Not implemented.
00267 };
00268 
00269 
00270 #endif
00271