Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

Rendering/vtkTextMapper.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkTextMapper.h,v $
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 =========================================================================*/
00034 #ifndef __vtkTextMapper_h
00035 #define __vtkTextMapper_h
00036 
00037 #include "vtkMapper2D.h"
00038 
00039 class vtkActor2D;
00040 class vtkTextProperty;
00041 class vtkViewport;
00042 
00043 class VTK_RENDERING_EXPORT vtkTextMapper : public vtkMapper2D
00044 {
00045 public:
00046   vtkTypeRevisionMacro(vtkTextMapper,vtkMapper2D);
00047   void PrintSelf(ostream& os, vtkIndent indent);
00048 
00050   static vtkTextMapper *New();
00051 
00053 
00055   virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
00056   virtual int GetWidth(vtkViewport*v);
00057   virtual int GetHeight(vtkViewport*v);
00059   
00061 
00063   virtual void SetInput(const char *inputString);
00064   vtkGetStringMacro(Input);
00066 
00068 
00069   virtual void SetTextProperty(vtkTextProperty *p);
00070   vtkGetObjectMacro(TextProperty,vtkTextProperty);
00072   
00073   vtkGetMacro(NumberOfLines,int);
00074   
00076   void ShallowCopy(vtkTextMapper *tm);
00077   
00080   int  GetNumberOfLines(const char *input);
00081 
00083 
00085   virtual int SetConstrainedFontSize(vtkViewport*, 
00086                                      int targetWidth, int targetHeight);
00088 
00090 
00095   static int SetMultipleConstrainedFontSize(vtkViewport*, 
00096                                             int targetWidth, int targetHeight,
00097                                             vtkTextMapper** mappers, 
00098                                             int nbOfMappers, 
00099                                             int* maxResultingSize);
00101 
00103 
00104   virtual int GetSystemFontSize(int size) 
00105     { return size; };
00107 
00108 protected:
00109   vtkTextMapper();
00110   ~vtkTextMapper();
00111 
00112   char* Input;
00113   vtkTextProperty *TextProperty;
00114 
00115   int  LineSize;
00116   int  NumberOfLines;
00117   int  NumberOfLinesAllocated;
00118 
00119   vtkTextMapper **TextLines;
00120 
00121   // These functions are used to parse, process, and render multiple lines 
00122 
00123   char *NextLine(const char *input, int lineNum);
00124   void GetMultiLineSize(vtkViewport* viewport, int size[2]);
00125   void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00126   
00127 private:
00128   vtkTextMapper(const vtkTextMapper&);  // Not implemented.
00129   void operator=(const vtkTextMapper&);  // Not implemented.
00130 };
00131 
00132 #endif
00133