Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound 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 =========================================================================*/
00052 #ifndef __vtkLegendBoxActor_h
00053 #define __vtkLegendBoxActor_h
00054 
00055 #include "vtkActor2D.h"
00056 
00057 class vtkActor;
00058 class vtkFloatArray;
00059 class vtkPolyData;
00060 class vtkPolyDataMapper2D;
00061 class vtkPolyDataMapper;
00062 class vtkTextMapper;
00063 class vtkTextProperty;
00064 class vtkTransform;
00065 class vtkTransformPolyDataFilter;
00066 class vtkProperty2D;
00067 
00068 class VTK_HYBRID_EXPORT vtkLegendBoxActor : public vtkActor2D
00069 {
00070 public:
00071   vtkTypeRevisionMacro(vtkLegendBoxActor,vtkActor2D);
00072   void PrintSelf(ostream& os, vtkIndent indent);
00073 
00076   static vtkLegendBoxActor *New();
00077 
00079 
00080   void SetNumberOfEntries(int num);
00081   int GetNumberOfEntries()
00082     {return this->NumberOfEntries;}
00084 
00086 
00094   void SetEntry(int i, vtkPolyData *symbol, const char* string, float color[3]);
00095   void SetEntrySymbol(int i, vtkPolyData *symbol);
00096   void SetEntryString(int i, const char* string);
00097   void SetEntryColor(int i, float color[3]);
00098   void SetEntryColor(int i, float r, float g, float b);
00099   vtkPolyData *GetEntrySymbol(int i);
00100   const char* GetEntryString(int i);
00101   float *GetEntryColor(int i);
00103 
00105 
00106   virtual void SetEntryTextProperty(vtkTextProperty *p);
00107   vtkGetObjectMacro(EntryTextProperty,vtkTextProperty);
00109 
00110 #ifndef VTK_REMOVE_LEGACY_CODE
00111 
00112 
00116   virtual void SetFontFamily(int val);
00117   virtual int GetFontFamily();
00118   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
00119   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00120   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
00122 #endif
00123 
00124 #ifndef VTK_REMOVE_LEGACY_CODE
00125 
00126 
00129   virtual void SetBold(int val);
00130   virtual int GetBold();
00131   vtkBooleanMacro(Bold, int);
00133 #endif
00134 
00135 #ifndef VTK_REMOVE_LEGACY_CODE
00136 
00137 
00140   virtual void SetItalic(int val);
00141   virtual int GetItalic();
00142   vtkBooleanMacro(Italic, int);
00144 #endif
00145 
00146 #ifndef VTK_REMOVE_LEGACY_CODE
00147 
00148 
00151   virtual void SetShadow(int val);
00152   virtual int GetShadow();
00153   vtkBooleanMacro(Shadow, int);
00155 #endif
00156 
00158 
00160   vtkSetMacro(Border, int);
00161   vtkGetMacro(Border, int);
00162   vtkBooleanMacro(Border, int);
00164 
00166 
00172   vtkSetMacro(LockBorder, int);
00173   vtkGetMacro(LockBorder, int);
00174   vtkBooleanMacro(LockBorder, int);
00176 
00178 
00180   vtkSetMacro(Box, int);
00181   vtkGetMacro(Box, int);
00182   vtkBooleanMacro(Box, int);
00184 
00186   vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); };
00187 
00189 
00191   vtkSetClampMacro(Padding, int, 0, 50);
00192   vtkGetMacro(Padding, int);
00194 
00196 
00199   vtkSetMacro(ScalarVisibility,int);
00200   vtkGetMacro(ScalarVisibility,int);
00201   vtkBooleanMacro(ScalarVisibility,int);
00203 
00206   void ShallowCopy(vtkProp *prop);
00207 
00208 //BTX
00213   virtual void ReleaseGraphicsResources(vtkWindow *);
00214 
00216 
00219   int RenderOpaqueGeometry(vtkViewport* viewport);
00220   int RenderTranslucentGeometry(vtkViewport* ) {return 0;};
00221   int RenderOverlay(vtkViewport* viewport);
00223 //ETX
00224 
00225 protected:
00226   vtkLegendBoxActor();
00227   ~vtkLegendBoxActor();
00228 
00229   void InitializeEntries();
00230 
00231 
00232   int   Border;
00233   int   Box;
00234   int   Padding;
00235   int   LockBorder;
00236   int   ScalarVisibility;
00237   float BoxOpacity;
00238 
00239   // Internal actors, mappers, data to represent the legend
00240   int                        NumberOfEntries;
00241   int                        Size; //allocation size
00242   vtkFloatArray              *Colors;
00243   vtkTextMapper              **TextMapper;
00244   vtkActor2D                 **TextActor;
00245   vtkPolyData                **Symbol;
00246   vtkTransform               **Transform;
00247   vtkTransformPolyDataFilter **SymbolTransform;
00248   vtkPolyDataMapper2D        **SymbolMapper;
00249   vtkActor2D                 **SymbolActor;
00250   vtkPolyData                *BorderPolyData;
00251   vtkPolyDataMapper2D        *BorderMapper;
00252   vtkActor2D                 *BorderActor;
00253   vtkPolyData                *BoxPolyData;
00254   vtkPolyDataMapper2D        *BoxMapper;
00255   vtkActor2D                 *BoxActor;
00256   vtkTextProperty            *EntryTextProperty;
00257 
00258   // Used to control whether the stuff is recomputed
00259   int           LegendEntriesVisible;
00260   int           CachedSize[2];
00261   vtkTimeStamp  BuildTime;
00262 
00263 private:
00264   vtkLegendBoxActor(const vtkLegendBoxActor&);  // Not implemented.
00265   void operator=(const vtkLegendBoxActor&);  // Not implemented.
00266 };
00267 
00268 
00269 #endif
00270