00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00067 #ifndef __vtkTextMapper_h
00068 #define __vtkTextMapper_h
00069
00070 #include "vtkMapper2D.h"
00071 #include "vtkWindow.h"
00072 #include "vtkViewport.h"
00073 #include "vtkActor2D.h"
00074 #include "vtkProperty2D.h"
00075
00076 #define VTK_ARIAL 0
00077 #define VTK_COURIER 1
00078 #define VTK_TIMES 2
00079
00080 #define VTK_TEXT_LEFT 0
00081 #define VTK_TEXT_CENTERED 1
00082 #define VTK_TEXT_RIGHT 2
00083
00084 #define VTK_TEXT_BOTTOM 0
00085 #define VTK_TEXT_TOP 2
00086
00087 class VTK_EXPORT vtkTextMapper : public vtkMapper2D
00088 {
00089 public:
00090 vtkTypeMacro(vtkTextMapper,vtkMapper2D);
00091 void PrintSelf(ostream& os, vtkIndent indent);
00092
00095 static vtkTextMapper *New();
00096
00099 virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
00100 int GetWidth(vtkViewport*);
00101 int GetHeight(vtkViewport*);
00102
00105 void SetInput(const char *inputString);
00106 vtkGetStringMacro(Input);
00107
00111 virtual void SetFontSize(int size);
00112
00116 vtkGetMacro(FontSize, int);
00117
00119 void SetBold(int val);
00120 vtkGetMacro(Bold, int);
00121 vtkBooleanMacro(Bold, int);
00122
00124 void SetItalic(int val);
00125 vtkGetMacro(Italic, int);
00126 vtkBooleanMacro(Italic, int);
00127
00129 void SetShadow(int val);
00130 vtkGetMacro(Shadow, int);
00131 vtkBooleanMacro(Shadow, int);
00132
00135 void SetFontFamily(int val);
00136 vtkGetMacro(FontFamily, int);
00137 void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00138 void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00139 void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00140
00143 vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00144 vtkGetMacro(Justification,int);
00145 void SetJustificationToLeft() {this->SetJustification(VTK_TEXT_LEFT);};
00146 void SetJustificationToCentered() {this->SetJustification(VTK_TEXT_CENTERED);};
00147 void SetJustificationToRight() {this->SetJustification(VTK_TEXT_RIGHT);};
00148
00151 vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00152 vtkGetMacro(VerticalJustification,int);
00153 void SetVerticalJustificationToBottom()
00154 {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00155 void SetVerticalJustificationToCentered()
00156 {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00157 void SetVerticalJustificationToTop()
00158 {this->SetVerticalJustification(VTK_TEXT_TOP);};
00159
00163 vtkSetMacro(LineOffset, float);
00164 vtkGetMacro(LineOffset, float);
00165 vtkSetMacro(LineSpacing, float);
00166 vtkGetMacro(LineSpacing, float);
00167 vtkGetMacro(NumberOfLines,int);
00168
00170 void ShallowCopy(vtkTextMapper *tm);
00171
00174 int GetNumberOfLines(const char *input);
00175
00176 protected:
00177 vtkTextMapper();
00178 ~vtkTextMapper();
00179 vtkTextMapper(const vtkTextMapper&) {};
00180 void operator=(const vtkTextMapper&) {};
00181
00182 int Italic;
00183 int Bold;
00184 int Shadow;
00185 int FontSize;
00186 int FontFamily;
00187 char* Input;
00188 int Justification;
00189 int VerticalJustification;
00190 vtkTimeStamp FontMTime;
00191
00192 int LineSize;
00193 float LineOffset;
00194 float LineSpacing;
00195 int NumberOfLines;
00196 int NumberOfLinesAllocated;
00197 vtkTextMapper **TextLines;
00198 char *NextLine(const char *input, int lineNum);
00199 void GetMultiLineSize(vtkViewport* viewport, int size[2]);
00200 void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00201 void RenderOpaqueGeometryMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00202
00203 };
00204
00205 #endif
00206