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);
64  void SetTextProperty(vtkTextProperty* tprop);
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
void GetBounds(T a, double bds[6])
virtual void SetForceOpaque(bool)
Force the actor to be treated as opaque or translucent.
represents an object (geometry & properties) in a rendered scene
Definition: vtkActor.h:51
abstract specification for Viewports
Definition: vtkViewport.h:55
record modification and/or execution time
Definition: vtkTimeStamp.h:35
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
Renders a flagpole (line) with a label at the top that faces the camera.
virtual bool GetForceOpaque()
Force the actor to be treated as opaque or translucent.
abstract specification for renderers
Definition: vtkRenderer.h:72
Hold a reference to a vtkObjectBase instance.
Definition: vtkMeta.h:32
represents an 3D object for placement in a rendered scene
Definition: vtkProp3D.h:49
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
static vtkActor * New()
Creates an actor with the following defaults: origin(0,0,0) position=(0,0,0) scale=(1,1,1) visibility=1 pickable=1 dragable=1 orientation=(0,0,0).
int vtkTypeBool
Definition: vtkABI.h:69
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
represent text properties.
create a line defined by two end points
Definition: vtkLineSource.h:63
map vtkPolyData to graphics primitives
Interface for generating images and path data from string data, using multiple backends.
Allocate and hold a VTK object.
Definition: vtkMeta.h:30