VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/Core/vtkTextProperty.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkTextProperty.h
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 =========================================================================*/
00032 #ifndef vtkTextProperty_h
00033 #define vtkTextProperty_h
00034 
00035 #include "vtkRenderingCoreModule.h" // For export macro
00036 #include "vtkObject.h"
00037 
00038 class VTKRENDERINGCORE_EXPORT vtkTextProperty : public vtkObject
00039 {
00040 public:
00041   vtkTypeMacro(vtkTextProperty,vtkObject);
00042   void PrintSelf(ostream& os, vtkIndent indent);
00043 
00046   static vtkTextProperty *New();
00047 
00049 
00050   vtkSetVector3Macro(Color,double);
00051   vtkGetVector3Macro(Color,double);
00053 
00055 
00057   vtkSetMacro(Opacity,double);
00058   vtkGetMacro(Opacity,double);
00060 
00062 
00063   vtkSetVector3Macro(BackgroundColor, double);
00064   vtkGetVector3Macro(BackgroundColor, double);
00066 
00068 
00070   vtkSetMacro(BackgroundOpacity, double);
00071   vtkGetMacro(BackgroundOpacity, double);
00073 
00075 
00079   vtkGetStringMacro(FontFamilyAsString);
00080   vtkSetStringMacro(FontFamilyAsString);
00081   void SetFontFamily(int t);
00082   int GetFontFamily();
00083   int GetFontFamilyMinValue() { return VTK_ARIAL; };
00084   void SetFontFamilyToArial();
00085   void SetFontFamilyToCourier();
00086   void SetFontFamilyToTimes();
00087   static int GetFontFamilyFromString( const char *f );
00088   static const char *GetFontFamilyAsString( int f );
00090 
00092 
00095   vtkGetStringMacro(FontFile)
00096   vtkSetStringMacro(FontFile)
00098 
00100 
00101   vtkSetClampMacro(FontSize,int,0,VTK_INT_MAX);
00102   vtkGetMacro(FontSize, int);
00104 
00106 
00107   vtkSetMacro(Bold, int);
00108   vtkGetMacro(Bold, int);
00109   vtkBooleanMacro(Bold, int);
00111 
00113 
00114   vtkSetMacro(Italic, int);
00115   vtkGetMacro(Italic, int);
00116   vtkBooleanMacro(Italic, int);
00118 
00120 
00121   vtkSetMacro(Shadow, int);
00122   vtkGetMacro(Shadow, int);
00123   vtkBooleanMacro(Shadow, int);
00125 
00127 
00129   vtkSetVector2Macro(ShadowOffset,int);
00130   vtkGetVectorMacro(ShadowOffset,int,2);
00132 
00134   void GetShadowColor(double color[3]);
00135 
00137 
00139   vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00140   vtkGetMacro(Justification,int);
00141   void SetJustificationToLeft()
00142     { this->SetJustification(VTK_TEXT_LEFT);};
00143   void SetJustificationToCentered()
00144     { this->SetJustification(VTK_TEXT_CENTERED);};
00145   void SetJustificationToRight()
00146     { this->SetJustification(VTK_TEXT_RIGHT);};
00147   const char *GetJustificationAsString();
00149 
00151 
00153   vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00154   vtkGetMacro(VerticalJustification,int);
00155   void SetVerticalJustificationToBottom()
00156     {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00157   void SetVerticalJustificationToCentered()
00158     {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00159   void SetVerticalJustificationToTop()
00160     {this->SetVerticalJustification(VTK_TEXT_TOP);};
00161   const char *GetVerticalJustificationAsString();
00163 
00165 
00166   vtkSetMacro(Orientation,double);
00167   vtkGetMacro(Orientation,double);
00169 
00171 
00173   vtkSetMacro(LineSpacing, double);
00174   vtkGetMacro(LineSpacing, double);
00176 
00178 
00179   vtkSetMacro(LineOffset, double);
00180   vtkGetMacro(LineOffset, double);
00182 
00184   void ShallowCopy(vtkTextProperty *tprop);
00185 
00186 protected:
00187   vtkTextProperty();
00188   ~vtkTextProperty();
00189 
00190   double Color[3];
00191   double Opacity;
00192   double BackgroundColor[3];
00193   double BackgroundOpacity;
00194   char* FontFamilyAsString;
00195   char* FontFile;
00196   int   FontSize;
00197   int   Bold;
00198   int   Italic;
00199   int   Shadow;
00200   int   ShadowOffset[2];
00201   int   Justification;
00202   int   VerticalJustification;
00203   double Orientation;
00204   double LineOffset;
00205   double LineSpacing;
00206 
00207 private:
00208   vtkTextProperty(const vtkTextProperty&);  // Not implemented.
00209   void operator=(const vtkTextProperty&);  // Not implemented.
00210 };
00211 
00212 inline const char *vtkTextProperty::GetFontFamilyAsString( int f )
00213 {
00214   if ( f == VTK_ARIAL )
00215     {
00216     return "Arial";
00217     }
00218   else if ( f == VTK_COURIER )
00219     {
00220     return "Courier";
00221     }
00222   else if ( f == VTK_TIMES )
00223     {
00224     return "Times";
00225     }
00226   else if ( f == VTK_FONT_FILE )
00227     {
00228     return "File";
00229     }
00230   return "Unknown";
00231 }
00232 
00233 inline void vtkTextProperty::SetFontFamily( int t )
00234 {
00235   this->SetFontFamilyAsString( this->GetFontFamilyAsString( t ) );
00236 }
00237 
00238 inline void vtkTextProperty::SetFontFamilyToArial()
00239 {
00240   this->SetFontFamily(VTK_ARIAL);
00241 }
00242 
00243 inline void vtkTextProperty::SetFontFamilyToCourier()
00244 {
00245   this->SetFontFamily(VTK_COURIER);
00246 }
00247 
00248 inline void vtkTextProperty::SetFontFamilyToTimes()
00249 {
00250   this->SetFontFamily(VTK_TIMES);
00251 }
00252 
00253 inline int vtkTextProperty::GetFontFamilyFromString( const char *f )
00254 {
00255   if ( strcmp( f, GetFontFamilyAsString( VTK_ARIAL ) ) == 0 )
00256     {
00257     return VTK_ARIAL;
00258     }
00259   else if ( strcmp( f, GetFontFamilyAsString( VTK_COURIER ) ) == 0 )
00260     {
00261     return VTK_COURIER;
00262     }
00263   else if ( strcmp( f, GetFontFamilyAsString( VTK_TIMES ) ) == 0 )
00264     {
00265     return VTK_TIMES;
00266     }
00267   else if ( strcmp( f, GetFontFamilyAsString( VTK_FONT_FILE) ) == 0 )
00268     {
00269     return VTK_FONT_FILE;
00270     }
00271   return VTK_UNKNOWN_FONT;
00272 }
00273 
00274 inline int vtkTextProperty::GetFontFamily()
00275 {
00276   return GetFontFamilyFromString( this->FontFamilyAsString );
00277 }
00278 
00279 inline const char *vtkTextProperty::GetJustificationAsString(void)
00280 {
00281   if (this->Justification == VTK_TEXT_LEFT)
00282     {
00283     return "Left";
00284     }
00285   else if (this->Justification == VTK_TEXT_CENTERED)
00286     {
00287     return "Centered";
00288     }
00289   else if (this->Justification == VTK_TEXT_RIGHT)
00290     {
00291     return "Right";
00292     }
00293   return "Unknown";
00294 }
00295 
00296 inline const char *vtkTextProperty::GetVerticalJustificationAsString(void)
00297 {
00298   if (this->VerticalJustification == VTK_TEXT_BOTTOM)
00299     {
00300     return "Bottom";
00301     }
00302   else if (this->VerticalJustification == VTK_TEXT_CENTERED)
00303     {
00304     return "Centered";
00305     }
00306   else if (this->VerticalJustification == VTK_TEXT_TOP)
00307     {
00308     return "Top";
00309     }
00310   return "Unknown";
00311 }
00312 
00313 #endif