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

Rendering/vtkTextProperty.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkTextProperty.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 =========================================================================*/
00047 #ifndef __vtkTextProperty_h
00048 #define __vtkTextProperty_h
00049 
00050 #include "vtkObject.h"
00051 
00052 class VTK_RENDERING_EXPORT vtkTextProperty : public vtkObject
00053 {
00054 public:
00055   vtkTypeRevisionMacro(vtkTextProperty,vtkObject);
00056   void PrintSelf(ostream& os, vtkIndent indent);
00057 
00060   static vtkTextProperty *New();
00061 
00063 
00064   vtkSetVector3Macro(Color,float);
00065   vtkGetVectorMacro(Color,float,3);
00067 
00069 
00071   vtkSetMacro(Opacity,float);
00072   vtkGetMacro(Opacity,float);
00074 
00076 
00078   vtkSetClampMacro(FontFamily,int,VTK_ARIAL,VTK_TIMES);
00079   vtkGetMacro(FontFamily, int);
00080   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
00081   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00082   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
00083   char *GetFontFamilyAsString();
00085 
00087 
00088   vtkSetClampMacro(FontSize,int,0,VTK_LARGE_INTEGER);
00089   vtkGetMacro(FontSize, int);
00091 
00093 
00094   vtkSetMacro(Bold, int);
00095   vtkGetMacro(Bold, int);
00096   vtkBooleanMacro(Bold, int);
00098 
00100 
00101   vtkSetMacro(Italic, int);
00102   vtkGetMacro(Italic, int);
00103   vtkBooleanMacro(Italic, int);
00105 
00107 
00108   vtkSetMacro(Shadow, int);
00109   vtkGetMacro(Shadow, int);
00110   vtkBooleanMacro(Shadow, int);
00112   
00114 
00115   vtkSetMacro(AntiAliasing, int);
00116   vtkGetMacro(AntiAliasing, int);
00117   vtkBooleanMacro(AntiAliasing, int);
00119 
00121 
00125   static int GetGlobalAntiAliasing();
00126   static void SetGlobalAntiAliasing(int val);
00127   static void SetGlobalAntiAliasingToSome() 
00128     { vtkTextProperty::SetGlobalAntiAliasing(VTK_TEXT_GLOBAL_ANTIALIASING_SOME); };
00129   static void SetGlobalAntiAliasingToNone() 
00130     { vtkTextProperty::SetGlobalAntiAliasing(VTK_TEXT_GLOBAL_ANTIALIASING_NONE); };
00131   static void SetGlobalAntiAliasingToAll()  
00132     { vtkTextProperty::SetGlobalAntiAliasing(VTK_TEXT_GLOBAL_ANTIALIASING_ALL); };
00134     
00136 
00138   vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00139   vtkGetMacro(Justification,int);
00140   void SetJustificationToLeft()     
00141     { this->SetJustification(VTK_TEXT_LEFT);};
00142   void SetJustificationToCentered() 
00143     { this->SetJustification(VTK_TEXT_CENTERED);};
00144   void SetJustificationToRight()    
00145     { this->SetJustification(VTK_TEXT_RIGHT);};
00146   char *GetJustificationAsString();
00148     
00150 
00152   vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00153   vtkGetMacro(VerticalJustification,int);
00154   void SetVerticalJustificationToBottom() 
00155     {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00156   void SetVerticalJustificationToCentered() 
00157     {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00158   void SetVerticalJustificationToTop() 
00159     {this->SetVerticalJustification(VTK_TEXT_TOP);};
00160   char *GetVerticalJustificationAsString();
00162     
00164 
00168   vtkSetMacro(LineOffset, float);
00169   vtkGetMacro(LineOffset, float);
00170   vtkSetMacro(LineSpacing, float);
00171   vtkGetMacro(LineSpacing, float);
00173   
00175   void ShallowCopy(vtkTextProperty *tprop);
00176   
00178 
00180   void SetFaceFileName(const char *);
00181   vtkGetStringMacro(FaceFileName);
00183 
00184 protected:
00185   vtkTextProperty();
00186   ~vtkTextProperty();
00187 
00188   float Color[3];
00189   float Opacity;
00190   int   FontFamily;
00191   int   FontSize;
00192   int   Bold;
00193   int   Italic;
00194   int   Shadow;
00195   int   AntiAliasing;
00196   int   Justification;
00197   int   VerticalJustification;
00198   float LineOffset;
00199   float LineSpacing;
00200   char  *FaceFileName;
00201   
00202 private:
00203   vtkTextProperty(const vtkTextProperty&);  // Not implemented.
00204   void operator=(const vtkTextProperty&);  // Not implemented.
00205 };
00206 
00207 inline char *vtkTextProperty::GetFontFamilyAsString(void)
00208 {
00209   if (this->FontFamily == VTK_ARIAL)
00210     {
00211     return (char *)"Arial";
00212     }
00213   else if (this->FontFamily == VTK_COURIER) 
00214     {
00215     return (char *)"Courier";
00216     }
00217   else if (this->FontFamily == VTK_TIMES) 
00218     {
00219     return (char *)"Times";
00220     }
00221   return (char *)"Unknown";
00222 }
00223 
00224 inline char *vtkTextProperty::GetJustificationAsString(void)
00225 {
00226   if (this->Justification == VTK_TEXT_LEFT)
00227     {
00228     return (char *)"Left";
00229     }
00230   else if (this->Justification == VTK_TEXT_CENTERED) 
00231     {
00232     return (char *)"Centered";
00233     }
00234   else if (this->Justification == VTK_TEXT_RIGHT) 
00235     {
00236     return (char *)"Right";
00237     }
00238   return (char *)"Unknown";
00239 }
00240 
00241 inline char *vtkTextProperty::GetVerticalJustificationAsString(void)
00242 {
00243   if (this->VerticalJustification == VTK_TEXT_BOTTOM)
00244     {
00245     return (char *)"Bottom";
00246     }
00247   else if (this->VerticalJustification == VTK_TEXT_CENTERED) 
00248     {
00249     return (char *)"Centered";
00250     }
00251   else if (this->VerticalJustification == VTK_TEXT_TOP) 
00252     {
00253     return (char *)"Top";
00254     }
00255   return (char *)"Unknown";
00256 }
00257 
00258 #endif