VTK
vtkTextActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkTextActor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
35 #ifndef vtkTextActor_h
36 #define vtkTextActor_h
37 
38 #include "vtkRenderingCoreModule.h" // For export macro
39 #include "vtkTexturedActor2D.h"
40 
41 class vtkImageData;
42 class vtkPoints;
43 class vtkPolyData;
45 class vtkProperty2D;
46 class vtkTextProperty;
47 class vtkTextRenderer;
48 class vtkTransform;
49 
50 class VTKRENDERINGCORE_EXPORT vtkTextActor : public vtkTexturedActor2D
51 {
52 public:
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
60  static vtkTextActor *New();
61 
66  void ShallowCopy(vtkProp *prop) override;
67 
69 
75  void SetInput(const char *inputString);
76  char *GetInput();
78 
80 
85  vtkSetVector2Macro(MinimumSize,int);
86  vtkGetVector2Macro(MinimumSize,int);
88 
90 
96  vtkSetMacro(MaximumLineHeight,float);
97  vtkGetMacro(MaximumLineHeight,float);
99 
101 
110  vtkSetClampMacro(TextScaleMode, int,
111  TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
112  vtkGetMacro(TextScaleMode, int);
114  { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
116  { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
118  { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
120 
121  enum {
122  TEXT_SCALE_MODE_NONE = 0,
124  TEXT_SCALE_MODE_VIEWPORT
125  };
126 
128 
133  vtkSetMacro(UseBorderAlign,vtkTypeBool);
134  vtkGetMacro(UseBorderAlign,vtkTypeBool);
135  vtkBooleanMacro(UseBorderAlign,vtkTypeBool);
137 
139 
154  void SetAlignmentPoint(int point);
155  int GetAlignmentPoint();
157 
159 
166  void SetOrientation(float orientation);
167  vtkGetMacro(Orientation,float);
169 
171 
174  virtual void SetTextProperty(vtkTextProperty *p);
175  vtkGetObjectMacro(TextProperty,vtkTextProperty);
177 
183  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
184 
188  virtual void GetSize(vtkViewport* vport, double size[2]);
189 
191 
196  virtual int SetConstrainedFontSize(
197  vtkViewport*, int targetWidth, int targetHeight);
198  static int SetConstrainedFontSize(
199  vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
201 
208  static int SetMultipleConstrainedFontSize(
209  vtkViewport*, int targetWidth, int targetHeight,
210  vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
211 
221  virtual void SetNonLinearFontScale(double exponent, int target);
222 
227  void SpecifiedToDisplay(double *pos, vtkViewport *vport, int specified);
228 
233  void DisplayToSpecified(double *pos, vtkViewport *vport, int specified);
234 
239  virtual void ComputeScaledFont(vtkViewport *viewport);
240 
242 
246  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
248 
256  static float GetFontScale(vtkViewport *viewport);
257 
265  void ReleaseGraphicsResources(vtkWindow *) override;
266 
268 
273  int RenderOpaqueGeometry(vtkViewport* viewport) override;
274  int RenderTranslucentPolygonalGeometry(vtkViewport* ) override {return 0;};
275  int RenderOverlay(vtkViewport* viewport) override;
277 
281  int HasTranslucentPolygonalGeometry() override;
282 
283 protected:
287  virtual bool RenderImage(vtkTextProperty *tprop, vtkViewport *viewport);
288 
292  virtual bool GetImageBoundingBox(
293  vtkTextProperty *tprop, vtkViewport *viewport, int bbox[4]);
294 
295  vtkTextActor();
296  ~vtkTextActor() override;
297 
298  int MinimumSize[2];
302  float Orientation;
304 
310  int LastSize[2];
311  int LastOrigin[2];
312  char *Input;
316 
318 
319  // Stuff needed to display the image text as a texture map.
322 
323  virtual void ComputeRectangle(vtkViewport *viewport);
324 
338  virtual int UpdateRectangle(vtkViewport* viewport);
339 
340 private:
341  vtkTextActor(const vtkTextActor&) = delete;
342  void operator=(const vtkTextActor&) = delete;
343 };
344 
345 
346 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkTextActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkTextActor.h:274
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:45
vtkTexturedActor2D::New
static vtkTexturedActor2D * New()
vtkTextActor::SetTextScaleModeToNone
void SetTextScaleModeToNone()
Definition: vtkTextActor.h:113
vtkTextActor::Orientation
float Orientation
Definition: vtkTextActor.h:302
vtkTextActor::SetTextScaleModeToProp
void SetTextScaleModeToProp()
Definition: vtkTextActor.h:115
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:38
vtkTextActor::FormerOrientation
double FormerOrientation
Definition: vtkTextActor.h:314
vtkTextActor::InputRendered
bool InputRendered
Definition: vtkTextActor.h:313
vtkTextActor::ImageData
vtkImageData * ImageData
Definition: vtkTextActor.h:306
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkTexturedActor2D.h
vtkTextActor::MaximumLineHeight
float MaximumLineHeight
Definition: vtkTextActor.h:299
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkTextActor::TEXT_SCALE_MODE_PROP
Definition: vtkTextActor.h:123
vtkX3D::point
Definition: vtkX3D.h:236
vtkTextActor::RectanglePoints
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:321
vtkTextActor::ScaledTextProperty
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:317
vtkTextActor::UseBorderAlign
vtkTypeBool UseBorderAlign
Definition: vtkTextActor.h:303
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:50
vtkTextActor::TextProperty
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:305
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkActor2D::HasTranslucentPolygonalGeometry
int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkTextActor::BuildTime
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:308
vtkX3D::size
Definition: vtkX3D.h:253
vtkTexturedActor2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTexturedActor2D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *viewport) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
vtkTexturedActor2D::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkTextActor::Rectangle
vtkPolyData * Rectangle
Definition: vtkTextActor.h:320
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:46
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
vtkX3D::orientation
Definition: vtkX3D.h:262
vtkTexturedActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkTexturedActor2D.
vtkTextRenderer
Interface for generating images and path data from string data, using multiple backends.
Definition: vtkTextRenderer.h:72
vtkTexturedActor2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *win) override
Release any graphics resources that are being consumed by this actor.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:79
vtkTextActor::TextRenderer
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:307
vtkTextActor::TextScaleMode
int TextScaleMode
Definition: vtkTextActor.h:301
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:832
vtkTextActor::FontScaleExponent
double FontScaleExponent
Definition: vtkTextActor.h:300
vtkTextActor::Input
char * Input
Definition: vtkTextActor.h:312
vtkTextActor::RenderedDPI
int RenderedDPI
Definition: vtkTextActor.h:315
vtkTextActor::Transform
vtkTransform * Transform
Definition: vtkTextActor.h:309
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkTextActor::SetTextScaleModeToViewport
void SetTextScaleModeToViewport()
Definition: vtkTextActor.h:117