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