VTK  9.4.20250211
vtkFlagpoleLabel.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
16#ifndef vtkFlagpoleLabel_h
17#define vtkFlagpoleLabel_h
18
19#include "vtkActor.h"
20#include "vtkNew.h" // For.... vtkNew!
21#include "vtkRenderingCoreModule.h" // For export macro
22#include "vtkSmartPointer.h" // For.... vtkSmartPointer!
23
24VTK_ABI_NAMESPACE_BEGIN
25class vtkActor;
26class vtkImageData;
27class vtkLineSource;
28class vtkPolyData;
30class vtkRenderer;
31class vtkTextProperty;
32class vtkTextRenderer;
33
34class VTKRENDERINGCORE_EXPORT vtkFlagpoleLabel : public vtkActor
35{
36public:
38 vtkTypeMacro(vtkFlagpoleLabel, vtkActor);
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
45 void SetInput(const char* in);
46 vtkGetStringMacro(Input);
54 vtkGetObjectMacro(TextProperty, vtkTextProperty);
61 void SetForceOpaque(bool opaque) override;
62 bool GetForceOpaque() VTK_FUTURE_CONST override;
63 void ForceOpaqueOn() override;
64 void ForceOpaqueOff() override;
65 void SetForceTranslucent(bool trans) override;
66 bool GetForceTranslucent() VTK_FUTURE_CONST override;
67 void ForceTranslucentOn() override;
68 void ForceTranslucentOff() override;
74 vtkTypeBool HasTranslucentPolygonalGeometry() override;
75
79 int RenderOpaqueGeometry(vtkViewport* vp) override;
80
85 int RenderTranslucentPolygonalGeometry(vtkViewport* vp) override;
86
87 void ReleaseGraphicsResources(vtkWindow* win) override;
88 double* GetBounds() override;
89 using Superclass::GetBounds;
90
94 vtkGetVector3Macro(BasePosition, double);
95 void SetBasePosition(double x, double y, double z);
96
100 vtkGetVector3Macro(TopPosition, double);
101 void SetTopPosition(double x, double y, double z);
102
108 vtkGetMacro(FlagSize, double);
109 vtkSetMacro(FlagSize, double);
110
111protected:
113 ~vtkFlagpoleLabel() override;
114
115 bool InputIsValid();
116
117 void UpdateInternals(vtkRenderer* ren);
118
119 bool TextureIsStale(vtkRenderer* ren);
120 void GenerateTexture(vtkRenderer* ren);
121
122 bool QuadIsStale(vtkRenderer* ren);
123 void GenerateQuad(vtkRenderer* ren);
124
125 // Used by the opaque pass to tell the translucent pass not to render.
126 void Invalidate();
127 bool IsValid();
128
129 // Used to sync the internal actor's state.
130 void PreRender();
131
132 // Text specification:
133 char* Input;
134 vtkTextProperty* TextProperty;
135
136 // Cached metadata to determine if things need rebuildin'
137 int RenderedDPI;
138 vtkTimeStamp InputMTime;
139
140 // We cache this so we can recompute the bounds between renders, if needed.
141 vtkSmartPointer<vtkRenderer> RenderedRenderer;
142
143 // Rendering stuffies
144 vtkNew<vtkTextRenderer> TextRenderer;
148 vtkNew<vtkActor> QuadActor;
149
152 vtkNew<vtkActor> PoleActor;
153
154 double TopPosition[3];
155 double BasePosition[3];
156 double FlagSize;
157
158private:
159 vtkFlagpoleLabel(const vtkFlagpoleLabel&) = delete;
160 void operator=(const vtkFlagpoleLabel&) = delete;
161};
162
163VTK_ABI_NAMESPACE_END
164#endif // vtkFlagpoleLabel_h
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
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
a simple class to control print indentation
Definition vtkIndent.h:108
create a line defined by two end points
Allocate and hold a VTK object.
Definition vtkNew.h:167
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
abstract specification for renderers
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
abstract specification for Viewports
Definition vtkViewport.h:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64