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

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 =========================================================================*/
00046 #ifndef __vtkTextMapper_h
00047 #define __vtkTextMapper_h
00048 
00049 #include "vtkMapper2D.h"
00050 
00051 class vtkActor2D;
00052 class vtkTextProperty;
00053 class vtkViewport;
00054 
00055 class VTK_RENDERING_EXPORT vtkTextMapper : public vtkMapper2D
00056 {
00057 public:
00058   vtkTypeRevisionMacro(vtkTextMapper,vtkMapper2D);
00059   void PrintSelf(ostream& os, vtkIndent indent);
00060 
00062   static vtkTextMapper *New();
00063 
00065 
00067   virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
00068   virtual int GetWidth(vtkViewport*v);
00069   virtual int GetHeight(vtkViewport*v);
00071   
00073 
00075   virtual void SetInput(const char *inputString);
00076   vtkGetStringMacro(Input);
00078 
00080 
00081   virtual void SetTextProperty(vtkTextProperty *p);
00082   vtkGetObjectMacro(TextProperty,vtkTextProperty);
00084   
00085   vtkGetMacro(NumberOfLines,int);
00086   
00088   void ShallowCopy(vtkTextMapper *tm);
00089   
00092   int  GetNumberOfLines(const char *input);
00093 
00095 
00097   virtual int SetConstrainedFontSize(vtkViewport*, 
00098                                      int targetWidth, int targetHeight);
00100 
00102 
00107   static int SetMultipleConstrainedFontSize(vtkViewport*, 
00108                                             int targetWidth, int targetHeight,
00109                                             vtkTextMapper** mappers, 
00110                                             int nbOfMappers, 
00111                                             int* maxResultingSize);
00113 
00115 
00116   virtual int GetSystemFontSize(int size) 
00117     { return size; };
00119 
00120 protected:
00121   vtkTextMapper();
00122   ~vtkTextMapper();
00123 
00124   char* Input;
00125   vtkTextProperty *TextProperty;
00126 
00127   int  LineSize;
00128   int  NumberOfLines;
00129   int  NumberOfLinesAllocated;
00130 
00131   vtkTextMapper **TextLines;
00132 
00133   // These functions are used to parse, process, and render multiple lines 
00134 
00135   char *NextLine(const char *input, int lineNum);
00136   void GetMultiLineSize(vtkViewport* viewport, int size[2]);
00137   void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00138   
00139 private:
00140   vtkTextMapper(const vtkTextMapper&);  // Not implemented.
00141   void operator=(const vtkTextMapper&);  // Not implemented.
00142 };
00143 
00144 #endif
00145