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

vtkTextProperty.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkTextProperty.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 =========================================================================*/
00042 #ifndef __vtkTextProperty_h
00043 #define __vtkTextProperty_h
00044 
00045 #include "vtkObject.h"
00046 
00047 class VTK_RENDERING_EXPORT vtkTextProperty : public vtkObject
00048 {
00049 public:
00050   vtkTypeRevisionMacro(vtkTextProperty,vtkObject);
00051   void PrintSelf(ostream& os, vtkIndent indent);
00052 
00055   static vtkTextProperty *New();
00056 
00058 
00059   vtkSetVector3Macro(Color,double);
00060   vtkGetVectorMacro(Color,double,3);
00062 
00064 
00066   vtkSetMacro(Opacity,double);
00067   vtkGetMacro(Opacity,double);
00069 
00071 
00073   vtkSetClampMacro(FontFamily,int,VTK_ARIAL,VTK_TIMES);
00074   vtkGetMacro(FontFamily, int);
00075   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
00076   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00077   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
00078   char *GetFontFamilyAsString();
00080 
00082 
00083   vtkSetClampMacro(FontSize,int,0,VTK_LARGE_INTEGER);
00084   vtkGetMacro(FontSize, int);
00086 
00088 
00089   vtkSetMacro(Bold, int);
00090   vtkGetMacro(Bold, int);
00091   vtkBooleanMacro(Bold, int);
00093 
00095 
00096   vtkSetMacro(Italic, int);
00097   vtkGetMacro(Italic, int);
00098   vtkBooleanMacro(Italic, int);
00100 
00102 
00103   vtkSetMacro(Shadow, int);
00104   vtkGetMacro(Shadow, int);
00105   vtkBooleanMacro(Shadow, int);
00107 
00109 
00111   vtkSetVector2Macro(ShadowOffset,int);
00112   vtkGetVectorMacro(ShadowOffset,int,2);
00114 
00116   void GetShadowColor(double color[3]);
00117   
00119 
00121   vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00122   vtkGetMacro(Justification,int);
00123   void SetJustificationToLeft()     
00124     { this->SetJustification(VTK_TEXT_LEFT);};
00125   void SetJustificationToCentered() 
00126     { this->SetJustification(VTK_TEXT_CENTERED);};
00127   void SetJustificationToRight()    
00128     { this->SetJustification(VTK_TEXT_RIGHT);};
00129   char *GetJustificationAsString();
00131     
00133 
00135   vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00136   vtkGetMacro(VerticalJustification,int);
00137   void SetVerticalJustificationToBottom() 
00138     {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00139   void SetVerticalJustificationToCentered() 
00140     {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00141   void SetVerticalJustificationToTop() 
00142     {this->SetVerticalJustification(VTK_TEXT_TOP);};
00143   char *GetVerticalJustificationAsString();
00145     
00147 
00148   vtkSetMacro(Orientation,double);
00149   vtkGetMacro(Orientation,double);
00151 
00153 
00155   vtkSetMacro(LineSpacing, double);
00156   vtkGetMacro(LineSpacing, double);
00158   
00160 
00161   vtkSetMacro(LineOffset, double);
00162   vtkGetMacro(LineOffset, double);
00164   
00166   void ShallowCopy(vtkTextProperty *tprop);
00167   
00168 protected:
00169   vtkTextProperty();
00170   ~vtkTextProperty() {};
00171 
00172   double Color[3];
00173   double Opacity;
00174   int   FontFamily;
00175   int   FontSize;
00176   int   Bold;
00177   int   Italic;
00178   int   Shadow;
00179   int   ShadowOffset[2];
00180   int   Justification;
00181   int   VerticalJustification;
00182   double Orientation;
00183   double LineOffset;
00184   double LineSpacing;
00185   
00186 private:
00187   vtkTextProperty(const vtkTextProperty&);  // Not implemented.
00188   void operator=(const vtkTextProperty&);  // Not implemented.
00189 };
00190 
00191 inline char *vtkTextProperty::GetFontFamilyAsString(void)
00192 {
00193   if (this->FontFamily == VTK_ARIAL)
00194     {
00195     return (char *)"Arial";
00196     }
00197   else if (this->FontFamily == VTK_COURIER) 
00198     {
00199     return (char *)"Courier";
00200     }
00201   else if (this->FontFamily == VTK_TIMES) 
00202     {
00203     return (char *)"Times";
00204     }
00205   return (char *)"Unknown";
00206 }
00207 
00208 inline char *vtkTextProperty::GetJustificationAsString(void)
00209 {
00210   if (this->Justification == VTK_TEXT_LEFT)
00211     {
00212     return (char *)"Left";
00213     }
00214   else if (this->Justification == VTK_TEXT_CENTERED) 
00215     {
00216     return (char *)"Centered";
00217     }
00218   else if (this->Justification == VTK_TEXT_RIGHT) 
00219     {
00220     return (char *)"Right";
00221     }
00222   return (char *)"Unknown";
00223 }
00224 
00225 inline char *vtkTextProperty::GetVerticalJustificationAsString(void)
00226 {
00227   if (this->VerticalJustification == VTK_TEXT_BOTTOM)
00228     {
00229     return (char *)"Bottom";
00230     }
00231   else if (this->VerticalJustification == VTK_TEXT_CENTERED) 
00232     {
00233     return (char *)"Centered";
00234     }
00235   else if (this->VerticalJustification == VTK_TEXT_TOP) 
00236     {
00237     return (char *)"Top";
00238     }
00239   return (char *)"Unknown";
00240 }
00241 
00242 #endif