OSDN Git Service

FIRST REPOSITORY
[eos/hostdependOTHERS.git] / I386LINUX / util / I386LINUX / include / vtk / vtkTextActor.h
1 /*=========================================================================
2
3   Program:   Visualization Toolkit
4   Module:    $RCSfile: vtkTextActor.h,v $
5   Language:  C++
6   Date:      $Date: 2002/08/28 16:44:22 $
7   Version:   $Revision: 1.4 $
8
9   Copyright (c) 1993-2002 Ken Martin, Will Schroeder, Bill Lorensen
10   All rights reserved.
11   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
12
13      This software is distributed WITHOUT ANY WARRANTY; without even
14      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15      PURPOSE.  See the above copyright notice for more information.
16
17 =========================================================================*/
18 // .NAME vtkTextActor - An actor that displays text. Scaled or unscaled
19 // .SECTION Description
20 // vtkTextActor can be used to place text annotation into a window.
21 // When ScaledText is false, the text is fixed font and operation is
22 // the same as a vtkTextMapper/vtkActor2D pair.
23 // When ScaledText is true, the font resizes such that the text fits inside the
24 // box defined by the position 1 & 2 coordinates. This class replaces the
25 // deprecated vtkScaledTextActor and acts as a convenient wrapper for
26 // a vtkTextMapper/vtkActor2D pair.
27 // Set the text property/attributes through the vtkTextProperty associated to
28 // this actor.
29 //
30 // .SECTION See Also
31 // vtkActor2D vtkTextMapper vtkTextProperty
32
33 #ifndef __vtkTextActor_h
34 #define __vtkTextActor_h
35
36 #include "vtkActor2D.h"
37
38 // We need to include vtkTextMapper here otherwise we have an ambiguous
39 // case of vtkMapper2D or vtkTextMapper in SetMapper(vtkTextMapper *mapper);
40 // - two members with identical prototypes!
41 class vtkTextProperty;
42 class vtkTextMapper;
43
44 class VTK_RENDERING_EXPORT vtkTextActor : public vtkActor2D
45 {
46 public:
47   vtkTypeRevisionMacro(vtkTextActor,vtkActor2D);
48   void PrintSelf(ostream& os, vtkIndent indent);
49
50   // Description:
51   // Instantiate object with a rectangle in normaled view coordinates
52   // of (0.2,0.85, 0.8, 0.95).
53   static vtkTextActor *New();
54
55   // Description:
56   // Shallow copy of this text actor. Overloads the virtual
57   // vtkProp method.
58   void ShallowCopy(vtkProp *prop);
59
60   // Description:
61   // Override the vtkTextMapper that defines the text to be drawn.
62   // One will be created by default if none is supplied
63   void SetMapper(vtkTextMapper *mapper);
64
65   // Description:
66   // Set the text string to be displayed. "\n" is recognized
67   // as a carriage return/linefeed (line separator).
68   // Convenience method to the underlying mapper
69   void SetInput(const char *inputString);
70   char *GetInput();
71
72   // Description:
73   // Set/Get the minimum size in pixels for this actor.
74   // Defaults to 10,10.
75   // Not valid when ScaledText = false
76   vtkSetVector2Macro(MinimumSize,int);
77   vtkGetVector2Macro(MinimumSize,int);
78
79   // Description:
80   // Set/Get the maximum height of a line of text as a
81   // percentage of the vertical area allocated to this
82   // scaled text actor. Defaults to 1.0.
83   // Not valid when ScaledText = false
84   vtkSetMacro(MaximumLineHeight,float);
85   vtkGetMacro(MaximumLineHeight,float);
86
87   // Description:
88   // Turn on or off the ScaledText option.
89   // When text is scaled, the bounding rectangle is used to fit the text
90   // When ScaledText is off, the text is rendered at a fixed font size
91   vtkSetMacro(ScaledText,int);
92   vtkGetMacro(ScaledText,int);
93   vtkBooleanMacro(ScaledText,int);
94
95   // Description:
96   // Set/Get the Alignment point for unscaled (fixed fontsize) text
97   // if zero (default), the text aligns itself to the bottom left corner
98   // (which is defined by the PositionCoordinate)
99   // otherwise the text aligns itself to corner/midpoint or centre
100   //      6   7   8    of the box defined by the position 1 & 2 coordinates
101   //      3   4   5    according to the diagram on the left.
102   //      0   1   2
103   vtkSetClampMacro(AlignmentPoint,int,0,8)
104   vtkGetMacro(AlignmentPoint,int);
105
106   // Description:
107   // Return the actual vtkCoordinate reference that the mapper should use
108   // to position the actor. This is used internally by the mappers and should
109   // be overridden in specialized subclasses and otherwise ignored.
110   vtkCoordinate *GetActualPositionCoordinate(void)
111     { return this->AdjustedPositionCoordinate; }
112
113   // Description:
114   // Set/Get the text property.
115   virtual void SetTextProperty(vtkTextProperty *p);
116   vtkGetObjectMacro(TextProperty,vtkTextProperty);
117   
118 //BTX
119   // Description:
120   // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
121   // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
122   // Release any graphics resources that are being consumed by this actor.
123   // The parameter window could be used to determine which graphic
124   // resources to release.
125   virtual void ReleaseGraphicsResources(vtkWindow *);
126
127   // Description:
128   // WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
129   // DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
130   // Draw the text actor to the screen.
131   int RenderOpaqueGeometry(vtkViewport* viewport);
132   int RenderTranslucentGeometry(vtkViewport* ) {return 0;};
133   int RenderOverlay(vtkViewport* viewport);
134 //ETX
135
136 protected:
137   // Description:
138   // Hide access methods which use superclass vtkMapper2D and not vtkTextMapper
139   void SetMapper(vtkMapper2D *mapper);
140
141    vtkTextActor();
142   ~vtkTextActor();
143
144   int   MinimumSize[2];
145   float MaximumLineHeight;
146   int   ScaledText;
147   int   AlignmentPoint;
148
149   vtkCoordinate *AdjustedPositionCoordinate;
150   vtkTextProperty *TextProperty;
151
152   vtkTimeStamp  BuildTime;
153   int LastSize[2];
154   int LastOrigin[2];
155
156 private:
157   vtkTextActor(const vtkTextActor&);  // Not implemented.
158   void operator=(const vtkTextActor&);  // Not implemented.
159 };
160
161
162 #endif
163