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

imaging/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-2001 Ken Martin, Will Schroeder, Bill Lorensen 
00008 All rights reserved.
00009 
00010 Redistribution and use in source and binary forms, with or without
00011 modification, are permitted provided that the following conditions are met:
00012 
00013  * Redistributions of source code must retain the above copyright notice,
00014    this list of conditions and the following disclaimer.
00015 
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017    this list of conditions and the following disclaimer in the documentation
00018    and/or other materials provided with the distribution.
00019 
00020  * Neither name of Ken Martin, Will Schroeder, or Bill Lorensen nor the names
00021    of any contributors may be used to endorse or promote products derived
00022    from this software without specific prior written permission.
00023 
00024  * Modified source versions must be plainly marked as such, and must not be
00025    misrepresented as being the original software.
00026 
00027 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS''
00028 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00029 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00030 ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR
00031 ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00032 DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00033 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00034 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00035 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00036 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00037 
00038 =========================================================================*/
00067 #ifndef __vtkTextMapper_h
00068 #define __vtkTextMapper_h
00069 
00070 #include "vtkMapper2D.h"
00071 #include "vtkWindow.h"
00072 #include "vtkViewport.h"
00073 #include "vtkActor2D.h"
00074 #include "vtkProperty2D.h"
00075 
00076 #define VTK_ARIAL     0
00077 #define VTK_COURIER   1
00078 #define VTK_TIMES     2
00079 
00080 #define VTK_TEXT_LEFT     0
00081 #define VTK_TEXT_CENTERED 1
00082 #define VTK_TEXT_RIGHT    2
00083 
00084 #define VTK_TEXT_BOTTOM 0
00085 #define VTK_TEXT_TOP    2
00086 
00087 class VTK_EXPORT vtkTextMapper : public vtkMapper2D
00088 {
00089 public:
00090   vtkTypeMacro(vtkTextMapper,vtkMapper2D);
00091   void PrintSelf(ostream& os, vtkIndent indent);
00092 
00095   static vtkTextMapper *New();
00096 
00099   virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
00100   int GetWidth(vtkViewport*);
00101   int GetHeight(vtkViewport*);
00102   
00105   void SetInput(const char *inputString);
00106   vtkGetStringMacro(Input);
00107 
00111   virtual void SetFontSize(int size);
00112 
00116   vtkGetMacro(FontSize, int);
00117 
00119   void SetBold(int val);
00120   vtkGetMacro(Bold, int);
00121   vtkBooleanMacro(Bold, int);
00122 
00124   void SetItalic(int val);
00125   vtkGetMacro(Italic, int);
00126   vtkBooleanMacro(Italic, int);
00127 
00129   void SetShadow(int val);
00130   vtkGetMacro(Shadow, int);
00131   vtkBooleanMacro(Shadow, int);
00132   
00135   void SetFontFamily(int val);
00136   vtkGetMacro(FontFamily, int);
00137   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00138   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00139   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00140 
00143   vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00144   vtkGetMacro(Justification,int);
00145   void SetJustificationToLeft() {this->SetJustification(VTK_TEXT_LEFT);};
00146   void SetJustificationToCentered() {this->SetJustification(VTK_TEXT_CENTERED);};
00147   void SetJustificationToRight() {this->SetJustification(VTK_TEXT_RIGHT);};
00148     
00151   vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00152   vtkGetMacro(VerticalJustification,int);
00153   void SetVerticalJustificationToBottom() 
00154     {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00155   void SetVerticalJustificationToCentered() 
00156     {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00157   void SetVerticalJustificationToTop() 
00158     {this->SetVerticalJustification(VTK_TEXT_TOP);};
00159     
00163   vtkSetMacro(LineOffset, float);
00164   vtkGetMacro(LineOffset, float);
00165   vtkSetMacro(LineSpacing, float);
00166   vtkGetMacro(LineSpacing, float);
00167   vtkGetMacro(NumberOfLines,int);
00168   
00170   void ShallowCopy(vtkTextMapper *tm);
00171   
00174   int  GetNumberOfLines(const char *input);
00175 
00176 protected:
00177   vtkTextMapper();
00178   ~vtkTextMapper();
00179   vtkTextMapper(const vtkTextMapper&) {};
00180   void operator=(const vtkTextMapper&) {};
00181 
00182   int   Italic;
00183   int   Bold;
00184   int   Shadow;
00185   int   FontSize;
00186   int   FontFamily;
00187   char* Input;
00188   int   Justification;
00189   int   VerticalJustification;
00190   vtkTimeStamp FontMTime;
00191   // these functions are used to parse, process, and render multiple lines 
00192   int LineSize;
00193   float LineOffset;
00194   float LineSpacing;
00195   int  NumberOfLines;
00196   int  NumberOfLinesAllocated;
00197   vtkTextMapper **TextLines;
00198   char *NextLine(const char *input, int lineNum);
00199   void GetMultiLineSize(vtkViewport* viewport, int size[2]);
00200   void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00201   void RenderOpaqueGeometryMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00202   
00203 };
00204 
00205 #endif
00206 

Generated on Wed Nov 21 12:27:09 2001 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001