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
00071 #ifndef __vtkTextMapper_h
00072 #define __vtkTextMapper_h
00073
00074 #include "vtkMapper2D.h"
00075 #include "vtkWindow.h"
00076 #include "vtkViewport.h"
00077 #include "vtkActor2D.h"
00078 #include "vtkProperty2D.h"
00079
00080 #define VTK_ARIAL 0
00081 #define VTK_COURIER 1
00082 #define VTK_TIMES 2
00083
00084 #define VTK_TEXT_LEFT 0
00085 #define VTK_TEXT_CENTERED 1
00086 #define VTK_TEXT_RIGHT 2
00087
00088 #define VTK_TEXT_BOTTOM 0
00089 #define VTK_TEXT_TOP 2
00090
00091 class VTK_RENDERING_EXPORT vtkTextMapper : public vtkMapper2D
00092 {
00093 public:
00094 vtkTypeMacro(vtkTextMapper,vtkMapper2D);
00095 void PrintSelf(ostream& os, vtkIndent indent);
00096
00099 static vtkTextMapper *New();
00100
00102
00104 virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
00105 int GetWidth(vtkViewport*);
00106 int GetHeight(vtkViewport*);
00108
00110
00112 void SetInput(const char *inputString);
00113 vtkGetStringMacro(Input);
00115
00119 virtual void SetFontSize(int size);
00120
00122
00125 vtkGetMacro(FontSize, int);
00127
00129
00130 void SetBold(int val);
00131 vtkGetMacro(Bold, int);
00132 vtkBooleanMacro(Bold, int);
00134
00136
00137 void SetItalic(int val);
00138 vtkGetMacro(Italic, int);
00139 vtkBooleanMacro(Italic, int);
00141
00143
00144 void SetShadow(int val);
00145 vtkGetMacro(Shadow, int);
00146 vtkBooleanMacro(Shadow, int);
00148
00150
00152 void SetFontFamily(int val);
00153 vtkGetMacro(FontFamily, int);
00154 void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00155 void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00156 void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00158
00160
00162 vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00163 vtkGetMacro(Justification,int);
00164 void SetJustificationToLeft() {this->SetJustification(VTK_TEXT_LEFT);};
00165 void SetJustificationToCentered() {this->SetJustification(VTK_TEXT_CENTERED);};
00166 void SetJustificationToRight() {this->SetJustification(VTK_TEXT_RIGHT);};
00168
00170
00172 vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00173 vtkGetMacro(VerticalJustification,int);
00174 void SetVerticalJustificationToBottom()
00175 {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00176 void SetVerticalJustificationToCentered()
00177 {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00178 void SetVerticalJustificationToTop()
00179 {this->SetVerticalJustification(VTK_TEXT_TOP);};
00181
00183
00186 vtkSetMacro(LineOffset, float);
00187 vtkGetMacro(LineOffset, float);
00188 vtkSetMacro(LineSpacing, float);
00189 vtkGetMacro(LineSpacing, float);
00190 vtkGetMacro(NumberOfLines,int);
00192
00194 void ShallowCopy(vtkTextMapper *tm);
00195
00198 int GetNumberOfLines(const char *input);
00199
00200 protected:
00201 vtkTextMapper();
00202 ~vtkTextMapper();
00203
00204 int Italic;
00205 int Bold;
00206 int Shadow;
00207 int FontSize;
00208 int FontFamily;
00209 char* Input;
00210 int Justification;
00211 int VerticalJustification;
00212 vtkTimeStamp FontMTime;
00213
00214 int LineSize;
00215 float LineOffset;
00216 float LineSpacing;
00217 int NumberOfLines;
00218 int NumberOfLinesAllocated;
00219 vtkTextMapper **TextLines;
00220 char *NextLine(const char *input, int lineNum);
00221 void GetMultiLineSize(vtkViewport* viewport, int size[2]);
00222 void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00223 void RenderOpaqueGeometryMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00224
00225 private:
00226 vtkTextMapper(const vtkTextMapper&);
00227 void operator=(const vtkTextMapper&);
00228 };
00229
00230 #endif
00231