VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkTextMapper.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 =========================================================================*/ 00041 #ifndef vtkTextMapper_h 00042 #define vtkTextMapper_h 00043 00044 #include "vtkRenderingCoreModule.h" // For export macro 00045 #include "vtkMapper2D.h" 00046 00047 #include "vtkNew.h" // For vtkNew 00048 00049 class vtkActor2D; 00050 class vtkImageData; 00051 class vtkPoints; 00052 class vtkPolyData; 00053 class vtkPolyDataMapper2D; 00054 class vtkTextProperty; 00055 class vtkTexture; 00056 class vtkTimeStamp; 00057 class vtkViewport; 00058 00059 class VTKRENDERINGCORE_EXPORT vtkTextMapper : public vtkMapper2D 00060 { 00061 public: 00062 vtkTypeMacro(vtkTextMapper,vtkMapper2D); 00063 void PrintSelf(ostream& os, vtkIndent indent); 00064 00066 static vtkTextMapper *New(); 00067 00069 00071 virtual void GetSize(vtkViewport*, int size[2]); 00072 virtual int GetWidth(vtkViewport*v); 00073 virtual int GetHeight(vtkViewport*v); 00075 00077 00078 vtkSetStringMacro(Input) 00079 vtkGetStringMacro(Input) 00081 00083 00084 virtual void SetTextProperty(vtkTextProperty *p); 00085 vtkGetObjectMacro(TextProperty,vtkTextProperty); 00087 00089 void ShallowCopy(vtkTextMapper *tm); 00090 00094 VTK_LEGACY(int GetNumberOfLines(const char *input)); 00095 00099 VTK_LEGACY(int GetNumberOfLines()); 00100 00102 00106 virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight); 00107 static int SetConstrainedFontSize(vtkTextMapper*, vtkViewport*, int targetWidth, int targetHeight); 00109 00111 00115 static int SetMultipleConstrainedFontSize(vtkViewport*, 00116 int targetWidth, int targetHeight, 00117 vtkTextMapper** mappers, 00118 int nbOfMappers, 00119 int* maxResultingSize); 00121 00123 00126 static int SetRelativeFontSize(vtkTextMapper*, vtkViewport*, int *winSize, 00127 int *stringSize, float sizeFactor=0.0); 00128 static int SetMultipleRelativeFontSize(vtkViewport *viewport, 00129 vtkTextMapper **textMappers, 00130 int nbOfMappers, int *winSize, 00131 int *stringSize, float sizeFactor); 00133 00137 VTK_LEGACY(virtual int GetSystemFontSize(int size)); 00138 00139 void RenderOverlay(vtkViewport *, vtkActor2D *); 00140 void ReleaseGraphicsResources(vtkWindow *); 00141 unsigned long GetMTime(); 00142 00143 protected: 00144 vtkTextMapper(); 00145 ~vtkTextMapper(); 00146 00147 char* Input; 00148 vtkTextProperty *TextProperty; 00149 00150 private: 00151 vtkTextMapper(const vtkTextMapper&); // Not implemented. 00152 void operator=(const vtkTextMapper&); // Not implemented. 00153 00154 void UpdateQuad(vtkActor2D *actor); 00155 void UpdateImage(); 00156 00157 int TextDims[2]; 00158 00159 vtkTimeStamp CoordsTime; 00160 vtkTimeStamp TCoordsTime; 00161 vtkNew<vtkImageData> Image; 00162 vtkNew<vtkPoints> Points; 00163 vtkNew<vtkPolyData> PolyData; 00164 vtkNew<vtkPolyDataMapper2D> Mapper; 00165 vtkNew<vtkTexture> Texture; 00166 }; 00167 00168 00169 #ifndef VTK_LEGACY_REMOVE 00170 inline int vtkTextMapper::GetSystemFontSize(int size) 00171 { 00172 VTK_LEGACY_BODY(vtkTextMapper::GetSystemFontSize, "VTK 6.0") 00173 return size; 00174 } 00175 #endif // VTK_LEGACY_REMOVE 00176 00177 #endif 00178