VTK  9.2.6
vtkFlagpoleLabel.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkFlagpoleLabel.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 =========================================================================*/
28 #ifndef vtkFlagpoleLabel_h
29 #define vtkFlagpoleLabel_h
30 
31 #include "vtkActor.h"
32 #include "vtkNew.h" // For.... vtkNew!
33 #include "vtkRenderingCoreModule.h" // For export macro
34 #include "vtkSmartPointer.h" // For.... vtkSmartPointer!
35 
36 class vtkActor;
37 class vtkImageData;
38 class vtkLineSource;
39 class vtkPolyData;
40 class vtkPolyDataMapper;
41 class vtkRenderer;
42 class vtkTextProperty;
43 class vtkTextRenderer;
44 
45 class VTKRENDERINGCORE_EXPORT vtkFlagpoleLabel : public vtkActor
46 {
47 public:
48  static vtkFlagpoleLabel* New();
49  vtkTypeMacro(vtkFlagpoleLabel, vtkActor);
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
56  void SetInput(const char* in);
57  vtkGetStringMacro(Input);
65  vtkGetObjectMacro(TextProperty, vtkTextProperty);
72  void SetForceOpaque(bool opaque) override;
73  bool GetForceOpaque() VTK_FUTURE_CONST override;
74  void ForceOpaqueOn() override;
75  void ForceOpaqueOff() override;
76  void SetForceTranslucent(bool trans) override;
77  bool GetForceTranslucent() VTK_FUTURE_CONST override;
78  void ForceTranslucentOn() override;
79  void ForceTranslucentOff() override;
85  vtkTypeBool HasTranslucentPolygonalGeometry() override;
86 
90  int RenderOpaqueGeometry(vtkViewport* vp) override;
91 
96  int RenderTranslucentPolygonalGeometry(vtkViewport* vp) override;
97 
98  void ReleaseGraphicsResources(vtkWindow* win) override;
99  double* GetBounds() override;
100  using Superclass::GetBounds;
101 
105  vtkGetVector3Macro(BasePosition, double);
106  void SetBasePosition(double x, double y, double z);
107 
111  vtkGetVector3Macro(TopPosition, double);
112  void SetTopPosition(double x, double y, double z);
113 
119  vtkGetMacro(FlagSize, double);
120  vtkSetMacro(FlagSize, double);
121 
122 protected:
124  ~vtkFlagpoleLabel() override;
125 
126  bool InputIsValid();
127 
128  void UpdateInternals(vtkRenderer* ren);
129 
130  bool TextureIsStale(vtkRenderer* ren);
131  void GenerateTexture(vtkRenderer* ren);
132 
133  bool QuadIsStale(vtkRenderer* ren);
134  void GenerateQuad(vtkRenderer* ren);
135 
136  // Used by the opaque pass to tell the translucent pass not to render.
137  void Invalidate();
138  bool IsValid();
139 
140  // Used to sync the internal actor's state.
141  void PreRender();
142 
143  // Text specification:
144  char* Input;
145  vtkTextProperty* TextProperty;
146 
147  // Cached metadata to determine if things need rebuildin'
148  int RenderedDPI;
149  vtkTimeStamp InputMTime;
150 
151  // We cache this so we can recompute the bounds between renders, if needed.
152  vtkSmartPointer<vtkRenderer> RenderedRenderer;
153 
154  // Rendering stuffies
155  vtkNew<vtkTextRenderer> TextRenderer;
159  vtkNew<vtkActor> QuadActor;
160 
162  vtkNew<vtkLineSource> LineSource;
163  vtkNew<vtkActor> PoleActor;
164 
165  double TopPosition[3];
166  double BasePosition[3];
167  double FlagSize;
168 
169 private:
170  vtkFlagpoleLabel(const vtkFlagpoleLabel&) = delete;
171  void operator=(const vtkFlagpoleLabel&) = delete;
172 };
173 
174 #endif // vtkFlagpoleLabel_h
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:161
Renders a flagpole (line) with a label at the top that faces the camera.
void SetTextProperty(vtkTextProperty *tprop)
The vtkTextProperty object that controls the rendered text.
bool GetForceOpaque() VTK_FUTURE_CONST override
Force the actor to render during the opaque or translucent pass.
void SetInput(const char *in)
The UTF-8 encoded string to display.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetForceOpaque(bool opaque) override
Force the actor to render during the opaque or translucent pass.
static vtkFlagpoleLabel * New()
topologically and geometrically regular array of data
Definition: vtkImageData.h:163
a simple class to control print indentation
Definition: vtkIndent.h:119
create a line defined by two end points
Allocate and hold a VTK object.
Definition: vtkNew.h:171
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:200
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:99
abstract specification for renderers
Definition: vtkRenderer.h:182
Hold a reference to a vtkObjectBase instance.
represent text properties.
Interface for generating images and path data from string data, using multiple backends.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
void GetBounds(T a, double bds[6])
int vtkTypeBool
Definition: vtkABI.h:69