00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00032 #ifndef __vtkTextProperty_h
00033 #define __vtkTextProperty_h
00034
00035 #include "vtkObject.h"
00036
00037 class VTK_RENDERING_EXPORT vtkTextProperty : public vtkObject
00038 {
00039 public:
00040 vtkTypeRevisionMacro(vtkTextProperty,vtkObject);
00041 void PrintSelf(ostream& os, vtkIndent indent);
00042
00045 static vtkTextProperty *New();
00046
00048
00049 vtkSetVector3Macro(Color,double);
00050 vtkGetVector3Macro(Color,double);
00052
00054
00056 vtkSetMacro(Opacity,double);
00057 vtkGetMacro(Opacity,double);
00059
00061
00063 vtkSetClampMacro(FontFamily,int,VTK_ARIAL,VTK_TIMES);
00064 vtkGetMacro(FontFamily, int);
00065 void SetFontFamilyToArial() { this->SetFontFamily(VTK_ARIAL); };
00066 void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
00067 void SetFontFamilyToTimes() { this->SetFontFamily(VTK_TIMES); };
00068 static int GetFontFamilyFromString( const char *f );
00069 const char *GetFontFamilyAsString();
00070 static const char *GetFontFamilyAsString( int f );
00072
00074
00075 vtkSetClampMacro(FontSize,int,0,VTK_LARGE_INTEGER);
00076 vtkGetMacro(FontSize, int);
00078
00080
00081 vtkSetMacro(Bold, int);
00082 vtkGetMacro(Bold, int);
00083 vtkBooleanMacro(Bold, int);
00085
00087
00088 vtkSetMacro(Italic, int);
00089 vtkGetMacro(Italic, int);
00090 vtkBooleanMacro(Italic, int);
00092
00094
00095 vtkSetMacro(Shadow, int);
00096 vtkGetMacro(Shadow, int);
00097 vtkBooleanMacro(Shadow, int);
00099
00101
00103 vtkSetVector2Macro(ShadowOffset,int);
00104 vtkGetVectorMacro(ShadowOffset,int,2);
00106
00108 void GetShadowColor(double color[3]);
00109
00111
00113 vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00114 vtkGetMacro(Justification,int);
00115 void SetJustificationToLeft()
00116 { this->SetJustification(VTK_TEXT_LEFT);};
00117 void SetJustificationToCentered()
00118 { this->SetJustification(VTK_TEXT_CENTERED);};
00119 void SetJustificationToRight()
00120 { this->SetJustification(VTK_TEXT_RIGHT);};
00121 const char *GetJustificationAsString();
00123
00125
00127 vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00128 vtkGetMacro(VerticalJustification,int);
00129 void SetVerticalJustificationToBottom()
00130 {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00131 void SetVerticalJustificationToCentered()
00132 {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00133 void SetVerticalJustificationToTop()
00134 {this->SetVerticalJustification(VTK_TEXT_TOP);};
00135 const char *GetVerticalJustificationAsString();
00137
00139
00140 vtkSetMacro(Orientation,double);
00141 vtkGetMacro(Orientation,double);
00143
00145
00147 vtkSetMacro(LineSpacing, double);
00148 vtkGetMacro(LineSpacing, double);
00150
00152
00153 vtkSetMacro(LineOffset, double);
00154 vtkGetMacro(LineOffset, double);
00156
00158 void ShallowCopy(vtkTextProperty *tprop);
00159
00160 protected:
00161 vtkTextProperty();
00162 ~vtkTextProperty() {};
00163
00164 double Color[3];
00165 double Opacity;
00166 int FontFamily;
00167 int FontSize;
00168 int Bold;
00169 int Italic;
00170 int Shadow;
00171 int ShadowOffset[2];
00172 int Justification;
00173 int VerticalJustification;
00174 double Orientation;
00175 double LineOffset;
00176 double LineSpacing;
00177
00178 private:
00179 vtkTextProperty(const vtkTextProperty&);
00180 void operator=(const vtkTextProperty&);
00181 };
00182
00183 inline const char *vtkTextProperty::GetFontFamilyAsString( int f )
00184 {
00185 if ( f == VTK_ARIAL )
00186 {
00187 return "Arial";
00188 }
00189 else if ( f == VTK_COURIER )
00190 {
00191 return "Courier";
00192 }
00193 else if ( f == VTK_TIMES )
00194 {
00195 return "Times";
00196 }
00197 return "Unknown";
00198 }
00199
00200 inline int vtkTextProperty::GetFontFamilyFromString( const char *f )
00201 {
00202 if ( strcmp( f, GetFontFamilyAsString( VTK_ARIAL ) ) == 0 )
00203 {
00204 return VTK_ARIAL;
00205 }
00206 else if ( strcmp( f, GetFontFamilyAsString( VTK_COURIER ) ) == 0 )
00207 {
00208 return VTK_COURIER;
00209 }
00210 else if ( strcmp( f, GetFontFamilyAsString( VTK_TIMES ) ) == 0 )
00211 {
00212 return VTK_TIMES;
00213 }
00214 return VTK_UNKNOWN_FONT;
00215 }
00216
00217 inline const char *vtkTextProperty::GetFontFamilyAsString(void)
00218 {
00219 return vtkTextProperty::GetFontFamilyAsString( this->GetFontFamily() );
00220 }
00221
00222 inline const char *vtkTextProperty::GetJustificationAsString(void)
00223 {
00224 if (this->Justification == VTK_TEXT_LEFT)
00225 {
00226 return "Left";
00227 }
00228 else if (this->Justification == VTK_TEXT_CENTERED)
00229 {
00230 return "Centered";
00231 }
00232 else if (this->Justification == VTK_TEXT_RIGHT)
00233 {
00234 return "Right";
00235 }
00236 return "Unknown";
00237 }
00238
00239 inline const char *vtkTextProperty::GetVerticalJustificationAsString(void)
00240 {
00241 if (this->VerticalJustification == VTK_TEXT_BOTTOM)
00242 {
00243 return "Bottom";
00244 }
00245 else if (this->VerticalJustification == VTK_TEXT_CENTERED)
00246 {
00247 return "Centered";
00248 }
00249 else if (this->VerticalJustification == VTK_TEXT_TOP)
00250 {
00251 return "Top";
00252 }
00253 return "Unknown";
00254 }
00255
00256 #endif