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-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 =========================================================================*/
00071 #ifndef __vtkTextMapper_h
00072 #define __vtkTextMapper_h
00073 
00074 #include "vtkMapper2D.h"
00075 #include "vtkWindow.h"
00076 #include "vtkViewport.h"
00077 #include "vtkActor2D.h"
00078 #include "vtkProperty2D.h"
00079 
00080 #define VTK_ARIAL     0
00081 #define VTK_COURIER   1
00082 #define VTK_TIMES     2
00083 
00084 #define VTK_TEXT_LEFT     0
00085 #define VTK_TEXT_CENTERED 1
00086 #define VTK_TEXT_RIGHT    2
00087 
00088 #define VTK_TEXT_BOTTOM 0
00089 #define VTK_TEXT_TOP    2
00090 
00091 class VTK_RENDERING_EXPORT vtkTextMapper : public vtkMapper2D
00092 {
00093 public:
00094   vtkTypeMacro(vtkTextMapper,vtkMapper2D);
00095   void PrintSelf(ostream& os, vtkIndent indent);
00096 
00099   static vtkTextMapper *New();
00100 
00102 
00104   virtual void GetSize(vtkViewport*, int size[2]) {size[0]=size[0];};
00105   int GetWidth(vtkViewport*);
00106   int GetHeight(vtkViewport*);
00108   
00110 
00112   void SetInput(const char *inputString);
00113   vtkGetStringMacro(Input);
00115 
00119   virtual void SetFontSize(int size);
00120 
00122 
00125   vtkGetMacro(FontSize, int);
00127 
00129 
00130   void SetBold(int val);
00131   vtkGetMacro(Bold, int);
00132   vtkBooleanMacro(Bold, int);
00134 
00136 
00137   void SetItalic(int val);
00138   vtkGetMacro(Italic, int);
00139   vtkBooleanMacro(Italic, int);
00141 
00143 
00144   void SetShadow(int val);
00145   vtkGetMacro(Shadow, int);
00146   vtkBooleanMacro(Shadow, int);
00148   
00150 
00152   void SetFontFamily(int val);
00153   vtkGetMacro(FontFamily, int);
00154   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00155   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00156   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00158 
00160 
00162   vtkSetClampMacro(Justification,int,VTK_TEXT_LEFT,VTK_TEXT_RIGHT);
00163   vtkGetMacro(Justification,int);
00164   void SetJustificationToLeft() {this->SetJustification(VTK_TEXT_LEFT);};
00165   void SetJustificationToCentered() {this->SetJustification(VTK_TEXT_CENTERED);};
00166   void SetJustificationToRight() {this->SetJustification(VTK_TEXT_RIGHT);};
00168     
00170 
00172   vtkSetClampMacro(VerticalJustification,int,VTK_TEXT_BOTTOM,VTK_TEXT_TOP);
00173   vtkGetMacro(VerticalJustification,int);
00174   void SetVerticalJustificationToBottom() 
00175     {this->SetVerticalJustification(VTK_TEXT_BOTTOM);};
00176   void SetVerticalJustificationToCentered() 
00177     {this->SetVerticalJustification(VTK_TEXT_CENTERED);};
00178   void SetVerticalJustificationToTop() 
00179     {this->SetVerticalJustification(VTK_TEXT_TOP);};
00181     
00183 
00186   vtkSetMacro(LineOffset, float);
00187   vtkGetMacro(LineOffset, float);
00188   vtkSetMacro(LineSpacing, float);
00189   vtkGetMacro(LineSpacing, float);
00190   vtkGetMacro(NumberOfLines,int);
00192   
00194   void ShallowCopy(vtkTextMapper *tm);
00195   
00198   int  GetNumberOfLines(const char *input);
00199 
00200 protected:
00201   vtkTextMapper();
00202   ~vtkTextMapper();
00203 
00204   int   Italic;
00205   int   Bold;
00206   int   Shadow;
00207   int   FontSize;
00208   int   FontFamily;
00209   char* Input;
00210   int   Justification;
00211   int   VerticalJustification;
00212   vtkTimeStamp FontMTime;
00213   // these functions are used to parse, process, and render multiple lines 
00214   int LineSize;
00215   float LineOffset;
00216   float LineSpacing;
00217   int  NumberOfLines;
00218   int  NumberOfLinesAllocated;
00219   vtkTextMapper **TextLines;
00220   char *NextLine(const char *input, int lineNum);
00221   void GetMultiLineSize(vtkViewport* viewport, int size[2]);
00222   void RenderOverlayMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00223   void RenderOpaqueGeometryMultipleLines(vtkViewport *viewport, vtkActor2D *actor);
00224   
00225 private:
00226   vtkTextMapper(const vtkTextMapper&);  // Not implemented.
00227   void operator=(const vtkTextMapper&);  // Not implemented.
00228 };
00229 
00230 #endif
00231 

Generated on Thu Mar 28 14:19:34 2002 for VTK by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001