VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkLegendBoxActor.h,v $ 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 =========================================================================*/ 00037 #ifndef __vtkLegendBoxActor_h 00038 #define __vtkLegendBoxActor_h 00039 00040 #include "vtkActor2D.h" 00041 00042 class vtkActor; 00043 class vtkDoubleArray; 00044 class vtkPolyData; 00045 class vtkPolyDataMapper2D; 00046 class vtkPolyDataMapper; 00047 class vtkTextMapper; 00048 class vtkTextProperty; 00049 class vtkTransform; 00050 class vtkTransformPolyDataFilter; 00051 class vtkProperty2D; 00052 00053 class VTK_HYBRID_EXPORT vtkLegendBoxActor : public vtkActor2D 00054 { 00055 public: 00056 vtkTypeRevisionMacro(vtkLegendBoxActor,vtkActor2D); 00057 void PrintSelf(ostream& os, vtkIndent indent); 00058 00061 static vtkLegendBoxActor *New(); 00062 00064 00065 void SetNumberOfEntries(int num); 00066 int GetNumberOfEntries() 00067 {return this->NumberOfEntries;} 00069 00071 00079 void SetEntry(int i, vtkPolyData *symbol, const char* string, double color[3]); 00080 void SetEntrySymbol(int i, vtkPolyData *symbol); 00081 void SetEntryString(int i, const char* string); 00082 void SetEntryColor(int i, double color[3]); 00083 void SetEntryColor(int i, double r, double g, double b); 00084 vtkPolyData *GetEntrySymbol(int i); 00085 const char* GetEntryString(int i); 00086 double *GetEntryColor(int i); 00088 00090 00091 virtual void SetEntryTextProperty(vtkTextProperty *p); 00092 vtkGetObjectMacro(EntryTextProperty,vtkTextProperty); 00094 00096 00098 vtkSetMacro(Border, int); 00099 vtkGetMacro(Border, int); 00100 vtkBooleanMacro(Border, int); 00102 00104 00110 vtkSetMacro(LockBorder, int); 00111 vtkGetMacro(LockBorder, int); 00112 vtkBooleanMacro(LockBorder, int); 00114 00116 00118 vtkSetMacro(Box, int); 00119 vtkGetMacro(Box, int); 00120 vtkBooleanMacro(Box, int); 00122 00124 vtkProperty2D* GetBoxProperty() { return this->BoxActor->GetProperty(); }; 00125 00127 00129 vtkSetClampMacro(Padding, int, 0, 50); 00130 vtkGetMacro(Padding, int); 00132 00134 00137 vtkSetMacro(ScalarVisibility,int); 00138 vtkGetMacro(ScalarVisibility,int); 00139 vtkBooleanMacro(ScalarVisibility,int); 00141 00144 void ShallowCopy(vtkProp *prop); 00145 00146 //BTX 00151 virtual void ReleaseGraphicsResources(vtkWindow *); 00152 00154 00157 int RenderOpaqueGeometry(vtkViewport* viewport); 00158 virtual int RenderTranslucentPolygonalGeometry(vtkViewport* ) {return 0;}; 00159 int RenderOverlay(vtkViewport* viewport); 00161 00163 virtual int HasTranslucentPolygonalGeometry(); 00164 //ETX 00165 00166 protected: 00167 vtkLegendBoxActor(); 00168 ~vtkLegendBoxActor(); 00169 00170 void InitializeEntries(); 00171 00172 00173 int Border; 00174 int Box; 00175 int Padding; 00176 int LockBorder; 00177 int ScalarVisibility; 00178 double BoxOpacity; 00179 00180 // Internal actors, mappers, data to represent the legend 00181 int NumberOfEntries; 00182 int Size; //allocation size 00183 vtkDoubleArray *Colors; 00184 vtkTextMapper **TextMapper; 00185 vtkActor2D **TextActor; 00186 vtkPolyData **Symbol; 00187 vtkTransform **Transform; 00188 vtkTransformPolyDataFilter **SymbolTransform; 00189 vtkPolyDataMapper2D **SymbolMapper; 00190 vtkActor2D **SymbolActor; 00191 vtkPolyData *BorderPolyData; 00192 vtkPolyDataMapper2D *BorderMapper; 00193 vtkActor2D *BorderActor; 00194 vtkPolyData *BoxPolyData; 00195 vtkPolyDataMapper2D *BoxMapper; 00196 vtkActor2D *BoxActor; 00197 vtkTextProperty *EntryTextProperty; 00198 00199 // Used to control whether the stuff is recomputed 00200 int LegendEntriesVisible; 00201 int CachedSize[2]; 00202 vtkTimeStamp BuildTime; 00203 00204 private: 00205 vtkLegendBoxActor(const vtkLegendBoxActor&); // Not implemented. 00206 void operator=(const vtkLegendBoxActor&); // Not implemented. 00207 }; 00208 00209 00210 #endif 00211