File: vtkTextActor3D.h

package info (click to toggle)
paraview 5.11.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 497,236 kB
  • sloc: cpp: 3,171,290; ansic: 1,315,072; python: 134,290; xml: 103,324; sql: 65,887; sh: 5,286; javascript: 4,901; yacc: 4,383; java: 3,977; perl: 2,363; lex: 1,909; f90: 1,255; objc: 143; makefile: 119; tcl: 59; pascal: 50; fortran: 29
file content (155 lines) | stat: -rw-r--r-- 4,561 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkTextActor3D.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
/**
 * @class   vtkTextActor3D
 * @brief   An actor that displays text.
 *
 * The input text is rendered into a buffer, which in turn is used as a
 * texture applied onto a quad (a vtkImageActor is used under the hood).
 * @warning
 * This class is experimental at the moment.
 * - The orientation is not optimized, the quad should be oriented, not
 *   the text itself when it is rendered in the buffer (we end up with
 *   excessively big textures for 45 degrees angles).
 *   This will be fixed first.
 * - No checking is done at the moment regarding hardware texture size limits.
 *
 * @sa
 * vtkProp3D
 */

#ifndef vtkTextActor3D_h
#define vtkTextActor3D_h

#include "vtkProp3D.h"
#include "vtkRenderingCoreModule.h" // For export macro
#include <string>                   // for ivar

VTK_ABI_NAMESPACE_BEGIN
class vtkImageActor;
class vtkImageData;
class vtkTextProperty;

class VTKRENDERINGCORE_EXPORT vtkTextActor3D : public vtkProp3D
{
public:
  static vtkTextActor3D* New();
  vtkTypeMacro(vtkTextActor3D, vtkProp3D);
  void PrintSelf(ostream& os, vtkIndent indent) override;

  ///@{
  /**
   * Set the text string to be displayed.
   */
  vtkSetStringMacro(Input);
  vtkGetStringMacro(Input);
  ///@}

  ///@{
  /**
   * Set/Get the text property.
   */
  virtual void SetTextProperty(vtkTextProperty* p);
  vtkGetObjectMacro(TextProperty, vtkTextProperty);
  ///@}

  /**
   * Since a 3D text actor is not pixel-aligned and positioned in 3D space,
   * the text is rendered at a constant DPI, rather than using the current
   * window DPI. This static method returns the DPI value used to produce the
   * text images.
   */
  static int GetRenderedDPI() { return 72; }

  /**
   * Shallow copy of this text actor. Overloads the virtual
   * vtkProp method.
   */
  void ShallowCopy(vtkProp* prop) override;

  /**
   * Get the bounds for this Prop3D as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
   */
  double* GetBounds() VTK_SIZEHINT(6) override;
  void GetBounds(double bounds[6]) { this->vtkProp3D::GetBounds(bounds); }

  /**
   * Get the vtkTextRenderer-derived bounding box for the given vtkTextProperty
   * and text string str.  Results are returned in the four element bbox int
   * array.  This call can be used for sizing other elements.
   */
  int GetBoundingBox(int bbox[4]);

  /**
   * WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
   * DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
   * Release any graphics resources that are being consumed by this actor.
   * The parameter window could be used to determine which graphic
   * resources to release.
   */
  void ReleaseGraphicsResources(vtkWindow*) override;

  /**
   * Force the actor to render during the opaque or translucent pass.
   * @{
   */
  virtual void SetForceOpaque(bool opaque);
  virtual bool GetForceOpaque();
  virtual void ForceOpaqueOn();
  virtual void ForceOpaqueOff();
  virtual void SetForceTranslucent(bool trans);
  virtual bool GetForceTranslucent();
  virtual void ForceTranslucentOn();
  virtual void ForceTranslucentOff();
  /**@}*/

  ///@{
  /**
   * WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE
   * DO NOT USE THIS METHOD OUTSIDE OF THE RENDERING PROCESS.
   * Draw the text actor to the screen.
   */
  int RenderOpaqueGeometry(vtkViewport* viewport) override;
  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
  int RenderOverlay(vtkViewport* viewport) override;
  ///@}

  /**
   * Does this prop have some translucent polygonal geometry?
   */
  vtkTypeBool HasTranslucentPolygonalGeometry() override;

protected:
  vtkTextActor3D();
  ~vtkTextActor3D() override;

  char* Input;

  vtkImageActor* ImageActor;
  vtkImageData* ImageData;
  vtkTextProperty* TextProperty;

  vtkTimeStamp BuildTime;
  std::string LastInputString;

  virtual int UpdateImageActor();

private:
  vtkTextActor3D(const vtkTextActor3D&) = delete;
  void operator=(const vtkTextActor3D&) = delete;
};

VTK_ABI_NAMESPACE_END
#endif