Rendering/vtkTextMapper.h Source File

Main Page Class Hierarchy Alphabetical List Compound List File List Compound 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   Language:  C++
    00006
    00007   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
    00008   All rights reserved.
    00009   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
    00010
    00011      This software is distributed WITHOUT ANY WARRANTY; without even
    00012      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
    00013      PURPOSE.  See the above copyright notice for more information.
    00014
    00015 =========================================================================*/
    00050 #ifndef __vtkTextMapper_h
    00051 #define __vtkTextMapper_h
    00052
    00053 #include "vtkMapper2D.h"
    00054
    00055 class vtkActor2D;
    00056 class vtkTextProperty;
    00057 class vtkViewport;
    00058
    00059 class VTK_RENDERING_EXPORT vtkTextMapper : public vtkMapper2D
    00060 {
    00061 public:
    00062   vtkTypeRevisionMacro(vtkTextMapper,vtkMapper2D);
    00063   void PrintSelf(ostream& os, vtkIndent indent);
    00064
    00066   static vtkTextMapper *New();
    00067
    00069
    00071   virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
    00072   virtual int GetWidth(vtkViewport*v);
    00073   virtual int GetHeight(vtkViewport*v);
    00075
    00077
    00079   virtual void SetInput(const char *inputString);
    00080   vtkGetStringMacro(Input);
    00082
    00084
    00085   virtual void SetTextProperty(vtkTextProperty *p);
    00086   vtkGetObjectMacro(TextProperty,vtkTextProperty);
    00088
    00089 #ifndef VTK_REMOVE_LEGACY_CODE
    00090
    00091
    00095   virtual void SetFontFamily(int val);
    00096   virtual int GetFontFamily();
    00097   void SetFontFamilyToArial()   { this->SetFontFamily(VTK_ARIAL);  };
    00098   void SetFontFamilyToCourier() { this->SetFontFamily(VTK_COURIER);};
    00099   void SetFontFamilyToTimes()   { this->SetFontFamily(VTK_TIMES);  };
    00101 #endif
    00102
    00103 #ifndef VTK_REMOVE_LEGACY_CODE
    00104
    00105
    00108   virtual void SetFontSize(int size);
    00109   virtual int GetFontSize();
    00111 #endif
    00112
    00113 #ifndef VTK_REMOVE_LEGACY_CODE
    00114
    00115
    00118   virtual void SetBold(int val);
    00119   virtual int GetBold();
    00120   vtkBooleanMacro(Bold, int);
    00122 #endif
    00123
    00124 #ifndef VTK_REMOVE_LEGACY_CODE
    00125
    00126
    00129   virtual void SetItalic(int val);
    00130   virtual int GetItalic();
    00131   vtkBooleanMacro(Italic, int);
    00133 #endif
    00134
    00135 #ifndef VTK_REMOVE_LEGACY_CODE
    00136
    00137
    00140   virtual void SetShadow(int val);
    00141   virtual int GetShadow();
    00142   vtkBooleanMacro(Shadow, int);
    00144 #endif
    00145
    00146 #ifndef VTK_REMOVE_LEGACY_CODE
    00147
    00148
    00152   virtual void SetJustification(int val);
    00153   virtual int GetJustification();
    00154   void SetJustificationToLeft()
    00155     { this->SetJustification(VTK_TEXT_LEFT);};
    00156   void SetJustificationToCentered()
    00157     { this->SetJustification(VTK_TEXT_CENTERED);};
    00158   void SetJustificationToRight()
    00159     { this->SetJustification(VTK_TEXT_RIGHT);};
    00161 #endif
    00162
    00163 #ifndef VTK_REMOVE_LEGACY_CODE
    00164
    00165
    00169   virtual void SetVerticalJustification(int val);
    00170   virtual int GetVerticalJustification();
    00171   void SetVerticalJustificationToBottom()
    00172     {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
    00173   void SetVerticalJustificationToCentered()
    00174     {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
    00175   void SetVerticalJustificationToTop()
    00176     {this->SetVerticalJustification(VTK_TEXT_TOP);};
    00178 #endif
    00179
    00180 #ifndef VTK_REMOVE_LEGACY_CODE
    00181
    00182
    00188   virtual void SetLineOffset(float val);
    00189   virtual float GetLineOffset();
    00190   virtual void SetLineSpacing(float val);
    00191   virtual float GetLineSpacing();
    00193 #endif
    00194
    00195   vtkGetMacro(NumberOfLines,int);
    00196
    00198   void ShallowCopy(vtkTextMapper *tm);
    00199
    00202   int  GetNumberOfLines(const char *input);
    00203
    00205
    00207   virtual int SetConstrainedFontSize(vtkViewport*,
    00208                                      int targetWidth, int targetHeight);
    00210
    00212
    00217   static int SetMultipleConstrainedFontSize(vtkViewport*,
    00218                                             int targetWidth, int targetHeight,
    00219                                             vtkTextMapper** mappers,
    00220                                             int nbOfMappers,
    00221                                             int* maxResultingSize);
    00223
    00225
    00226   virtual int GetSystemFontSize(int size)
    00227     { return size; };
    00229
    00230 protected:
    00231   vtkTextMapper();
    00232   ~vtkTextMapper();
    00233
    00234   char* Input;
    00235   vtkTextProperty *TextProperty;
    00236
    00237   int  LineSize;
    00238   int  NumberOfLines;
    00239   int  NumberOfLinesAllocated;
    00240
    00241   vtkTextMapper **TextLines;
    00242
    00243   // These functions are used to parse, process, and render multiple lines
    00244
    00245   char *NextLine(const char *input, int lineNum);
    00246   void GetMultiLineSize(vtkViewport* viewport, int size[2]);
    00247   void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
    00248
    00249 private:
    00250   vtkTextMapper(const vtkTextMapper&);  // Not implemented.
    00251   void operator=(const vtkTextMapper&);  // Not implemented.
    00252 };
    00253
    00254 #endif
    00255