VTK  9.0.1
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, TEXT_SCALE_MODE_NONE, TEXT_SCALE_MODE_VIEWPORT);
111  vtkGetMacro(TextScaleMode, int);
112  void SetTextScaleModeToNone() { this->SetTextScaleMode(TEXT_SCALE_MODE_NONE); }
113  void SetTextScaleModeToProp() { this->SetTextScaleMode(TEXT_SCALE_MODE_PROP); }
114  void SetTextScaleModeToViewport() { this->SetTextScaleMode(TEXT_SCALE_MODE_VIEWPORT); }
116 
117  enum
118  {
119  TEXT_SCALE_MODE_NONE = 0,
121  TEXT_SCALE_MODE_VIEWPORT
122  };
123 
125 
130  vtkSetMacro(UseBorderAlign, vtkTypeBool);
131  vtkGetMacro(UseBorderAlign, vtkTypeBool);
132  vtkBooleanMacro(UseBorderAlign, vtkTypeBool);
134 
136 
151  void SetAlignmentPoint(int point);
152  int GetAlignmentPoint();
154 
156 
163  void SetOrientation(float orientation);
164  vtkGetMacro(Orientation, float);
166 
168 
171  virtual void SetTextProperty(vtkTextProperty* p);
172  vtkGetObjectMacro(TextProperty, vtkTextProperty);
174 
180  virtual void GetBoundingBox(vtkViewport* vport, double bbox[4]);
181 
185  virtual void GetSize(vtkViewport* vport, double size[2]);
186 
188 
193  virtual int SetConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight);
194  static int SetConstrainedFontSize(vtkTextActor*, vtkViewport*, int targetWidth, int targetHeight);
196 
203  static int SetMultipleConstrainedFontSize(vtkViewport*, int targetWidth, int targetHeight,
204  vtkTextActor** actors, int nbOfActors, int* maxResultingSize);
205 
215  virtual void SetNonLinearFontScale(double exponent, int target);
216 
221  void SpecifiedToDisplay(double* pos, vtkViewport* vport, int specified);
222 
227  void DisplayToSpecified(double* pos, vtkViewport* vport, int specified);
228 
233  virtual void ComputeScaledFont(vtkViewport* viewport);
234 
236 
240  vtkGetObjectMacro(ScaledTextProperty, vtkTextProperty);
242 
250  static float GetFontScale(vtkViewport* viewport);
251 
259  void ReleaseGraphicsResources(vtkWindow*) override;
260 
262 
267  int RenderOpaqueGeometry(vtkViewport* viewport) override;
268  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
269  int RenderOverlay(vtkViewport* viewport) override;
271 
276 
277 protected:
281  virtual bool RenderImage(vtkTextProperty* tprop, vtkViewport* viewport);
282 
286  virtual bool GetImageBoundingBox(vtkTextProperty* tprop, vtkViewport* viewport, int bbox[4]);
287 
288  vtkTextActor();
289  ~vtkTextActor() override;
290 
291  int MinimumSize[2];
295  float Orientation;
297 
303  int LastSize[2];
304  int LastOrigin[2];
305  char* Input;
309 
311 
312  // Stuff needed to display the image text as a texture map.
315 
316  virtual void ComputeRectangle(vtkViewport* viewport);
317 
331  virtual int UpdateRectangle(vtkViewport* viewport);
332 
333 private:
334  vtkTextActor(const vtkTextActor&) = delete;
335  void operator=(const vtkTextActor&) = delete;
336 };
337 
338 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkTextActor::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Definition: vtkTextActor.h:268
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:44
vtkTexturedActor2D::New
static vtkTexturedActor2D * New()
vtkTextActor::SetTextScaleModeToNone
void SetTextScaleModeToNone()
Definition: vtkTextActor.h:112
vtkTextActor::Orientation
float Orientation
Definition: vtkTextActor.h:295
vtkTextActor::SetTextScaleModeToProp
void SetTextScaleModeToProp()
Definition: vtkTextActor.h:113
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:38
vtkTextActor::FormerOrientation
double FormerOrientation
Definition: vtkTextActor.h:307
vtkTextActor::InputRendered
bool InputRendered
Definition: vtkTextActor.h:306
vtkTextActor::ImageData
vtkImageData * ImageData
Definition: vtkTextActor.h:299
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:32
vtkTexturedActor2D.h
vtkTextActor::MaximumLineHeight
float MaximumLineHeight
Definition: vtkTextActor.h:292
vtkTransform
describes linear transformations via a 4x4 matrix
Definition: vtkTransform.h:54
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
target
boost::graph_traits< vtkGraph * >::vertex_descriptor target(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:965
vtkX3D::point
@ point
Definition: vtkX3D.h:242
vtkTextActor::RectanglePoints
vtkPoints * RectanglePoints
Definition: vtkTextActor.h:314
vtkTextActor::ScaledTextProperty
vtkTextProperty * ScaledTextProperty
Definition: vtkTextActor.h:310
vtkTextActor::UseBorderAlign
vtkTypeBool UseBorderAlign
Definition: vtkTextActor.h:296
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:50
vtkTextActor::TextProperty
vtkTextProperty * TextProperty
Definition: vtkTextActor.h:298
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkTextActor::BuildTime
vtkTimeStamp BuildTime
Definition: vtkTextActor.h:301
vtkX3D::size
@ size
Definition: vtkX3D.h:259
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:313
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
vtkX3D::orientation
@ orientation
Definition: vtkX3D.h:268
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:73
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:84
vtkTextActor::TextRenderer
vtkTextRenderer * TextRenderer
Definition: vtkTextActor.h:300
vtkTextActor::TextScaleMode
int TextScaleMode
Definition: vtkTextActor.h:294
vtkActor2D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkTextActor::FontScaleExponent
double FontScaleExponent
Definition: vtkTextActor.h:293
vtkTextActor::Input
char * Input
Definition: vtkTextActor.h:305
vtkTextActor::RenderedDPI
int RenderedDPI
Definition: vtkTextActor.h:308
vtkTextActor::Transform
vtkTransform * Transform
Definition: vtkTextActor.h:302
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkTextActor::TEXT_SCALE_MODE_PROP
@ TEXT_SCALE_MODE_PROP
Definition: vtkTextActor.h:120
vtkTextActor::SetTextScaleModeToViewport
void SetTextScaleModeToViewport()
Definition: vtkTextActor.h:114