OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / HP / util / HP / include / vtk / vtkTextMapper.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkTextMapper.h,v $
5   Language:  C++
6   Date:      $Date: 2002/02/01 06:33:24 $
7   Version:   $Revision: 1.1.1.1 $
8   Thanks:    Thanks to Matt Turek who developed this class.
9
10 Copyright (c) 1993-1995 Ken Martin, Will Schroeder, Bill Lorensen.
11
12 This software is copyrighted by Ken Martin, Will Schroeder and Bill Lorensen.
13 The following terms apply to all files associated with the software unless
14 explicitly disclaimed in individual files. This copyright specifically does
15 not apply to the related textbook "The Visualization Toolkit" ISBN
16 013199837-4 published by Prentice Hall which is covered by its own copyright.
17
18 The authors hereby grant permission to use, copy, and distribute this
19 software and its documentation for any purpose, provided that existing
20 copyright notices are retained in all copies and that this notice is included
21 verbatim in any distributions. Additionally, the authors grant permission to
22 modify this software and its documentation for any purpose, provided that
23 such modifications are not distributed without the explicit consent of the
24 authors and that existing copyright notices are retained in all copies. Some
25 of the algorithms implemented by this software are patented, observe all
26 applicable patent law.
27
28 IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY FOR
29 DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
30 OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF,
31 EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32
33 THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES, INCLUDING,
34 BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
35 PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE IS PROVIDED ON AN
36 "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE NO OBLIGATION TO PROVIDE
37 MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
38
39
40 =========================================================================*/
41 // .NAME vtkTextMapper - 2D Text annotation
42 // .SECTION Description
43 // vtkTextMapper provides 2D text annotation support for vtk.
44 // It is a Mapper2D that can be accosciated with a Actor2D
45 // and placed withint a RenderWindow or ImageWindow.
46
47 // .SECTION See Also
48 // vtkMapper2D vtkActor2D
49
50 #ifndef __vtkTextMapper_h
51 #define __vtkTextMapper_h
52
53
54 #include "vtkMapper2D.h"
55 #include "vtkWindow.h"
56 #include "vtkViewport.h"
57 #include "vtkActor2D.h"
58 #include "vtkProperty2D.h"
59
60 #define VTK_ARIAL     0
61 #define VTK_COURIER   1
62 #define VTK_TIMES     2
63
64 class VTK_EXPORT vtkTextMapper : public vtkMapper2D
65 {
66 public:
67   vtkTextMapper();
68   virtual ~vtkTextMapper();
69   const char *GetClassName() {return "vtkTextMapper";};
70   static vtkTextMapper *New();
71   void PrintSelf(ostream& os, vtkIndent indent);
72   
73   // Description:
74   // Draw the text to the screen.  This function is implemented in
75   // the subclasses.
76   virtual void Render(vtkViewport*, vtkActor2D*) {};
77
78   // Description:
79   // Set the input to the mapper.  The mapper doesn't parse the string
80   // for carriage returns or line feeds.
81   vtkSetStringMacro(Input);
82
83   // Description:
84   // Set the font size used by the mapper.  The subclasses can override
85   // this function since all font sizes may not be available (especially
86   // in X).
87   virtual void SetFontSize(int size) 
88   {this->FontSize = size; this->FontChanged = 1; this->Modified();};
89
90   // Description:
91   // Return the font size actually in use by the mapper.  This value may
92   // not match the value specified in the last SetFontSize if the last size
93   // was unavailable.
94   vtkGetMacro(FontSize, int);
95
96   // Description:
97   // Set/Get the bold property.
98   //  vtkSetMacro(Bold, int);
99   void SetBold(int val) 
100   {if (val == this->Bold) return;
101     this->Bold = val; this->FontChanged = 1; this->Modified();};
102   vtkGetMacro(Bold, int);
103   vtkBooleanMacro(Bold, int);
104
105   // Description:
106   // Set/Get the italic property.
107   // vtkSetMacro(Italic, int);
108   void SetItalic(int val) 
109   {if (val == this->Italic) return;
110     this->Italic = val; this->FontChanged = 1; this->Modified();};
111   vtkGetMacro(Italic, int);
112   vtkBooleanMacro(Italic, int);
113
114   // Description:
115   // Set/Get the shadow property.
116   // vtkSetMacro(Shadow, int);
117   void SetShadow(int val) 
118   {this->Shadow = val; this->FontChanged = 1; this->Modified();};
119   vtkGetMacro(Shadow, int);
120   vtkBooleanMacro(Shadow, int);
121   
122   // Description:
123   // Set/Get the font family.  Three font types are allowed: Arial (VTK_ARIAL),
124   // Courier (VTK_COURIER), and Times (VTK_TIMES).
125   // vtkSetMacro(FontFamily, int);
126   void SetFontFamily(int val) 
127   {if (val == this->FontFamily) return;
128     this->FontFamily = val; this->FontChanged = 1; this->Modified();};
129   vtkGetMacro(FontFamily, int);
130   void SetFontFamilyToArial() {SetFontFamily(VTK_ARIAL);};
131   void SetFontFamilyToCourier() {SetFontFamily(VTK_COURIER);};
132   void SetFontFamilyToTimes() {SetFontFamily(VTK_TIMES);};
133
134 protected:
135   int   Italic;
136   int   Bold;
137   int   Shadow;
138   int   FontSize;
139   int   FontFamily;
140   char* Input;
141   int   FontChanged;  
142 };
143
144
145 #endif
146