VTK  9.7.1
vtkCaptionRepresentation.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
27 #ifndef vtkCaptionRepresentation_h
28 #define vtkCaptionRepresentation_h
29 
31 #include "vtkInteractionWidgetsModule.h" // For export macro
32 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
33 
34 VTK_ABI_NAMESPACE_BEGIN
35 class vtkRenderer;
36 class vtkCaptionActor2D;
37 class vtkConeSource;
39 
40 class VTKINTERACTIONWIDGETS_EXPORT VTK_MARSHALAUTO vtkCaptionRepresentation
42 {
43 public:
47  static vtkCaptionRepresentation* New();
48 
50 
54  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
58 
62  void SetAnchorPosition(double pos[3]);
63  void GetAnchorPosition(double pos[3]);
65 
67 
71  void SetCaptionActor2D(vtkCaptionActor2D* captionActor);
72  vtkGetObjectMacro(CaptionActor2D, vtkCaptionActor2D);
74 
76 
81  void SetAnchorRepresentation(vtkPointHandleRepresentation3D*);
82  vtkGetObjectMacro(AnchorRepresentation, vtkPointHandleRepresentation3D);
84 
88  void BuildRepresentation() override;
89  void GetSize(double size[2]) override
90  {
91  size[0] = 2.0;
92  size[1] = 2.0;
93  }
94 
96 
100  void GetActors2D(vtkPropCollection*) override;
101  void ReleaseGraphicsResources(vtkWindow*) override;
102  int RenderOverlay(vtkViewport*) override;
103  int RenderOpaqueGeometry(vtkViewport*) override;
107 
109 
114  vtkSetClampMacro(FontFactor, double, 0.1, 10.0);
115  vtkGetMacro(FontFactor, double);
117 
129  enum FitType
130  {
131  VTK_FIT_TO_BORDER = 0,
132  VTK_FIT_TO_TEXT
133  };
134  vtkSetClampMacro(Fit, int, VTK_FIT_TO_BORDER, VTK_FIT_TO_TEXT);
135  vtkGetMacro(Fit, int);
136  void SetFitToBorder() { this->SetFit(VTK_FIT_TO_BORDER); }
137  void SetFitToText() { this->SetFit(VTK_FIT_TO_TEXT); }
138  const char* GetFitAsString();
139 
140 protected:
142  ~vtkCaptionRepresentation() override;
143 
144  // the text to manage
147 
149  int DisplayAttachmentPoint[2];
150  double FontFactor;
151  int Fit;
152 
153  // Internal representation for the anchor
155 
156  // Check and adjust boundaries according to the size of the caption text
157  virtual void AdjustCaptionBoundary();
158 
159 private:
161  void operator=(const vtkCaptionRepresentation&) = delete;
162 };
163 
164 VTK_ABI_NAMESPACE_END
165 #endif
int RenderOverlay(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
vtkTypeBool HasTranslucentPolygonalGeometry() override
These methods are necessary to make this representation behave as a vtkProp.
represent the position of a point in 3D space
abstract specification for Viewports
Definition: vtkViewport.h:46
void GetSize(double size[2]) override
Subclasses should implement these methods.
int RenderOpaqueGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
void GetActors2D(vtkPropCollection *) override
These methods are necessary to make this representation behave as a vtkProp.
abstract specification for renderers
Definition: vtkRenderer.h:63
generate polygonal cone
Definition: vtkConeSource.h:34
static vtkBorderRepresentation * New()
Instantiate this class.
an ordered list of Props
void PrintSelf(ostream &os, vtkIndent indent) override
Define standard methods.
int vtkTypeBool
Definition: vtkABI.h:64
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
These methods are necessary to make this representation behave as a vtkProp.
represents vtkCaptionWidget in the scene
void BuildRepresentation() override
Subclasses should implement these methods.
a simple class to control print indentation
Definition: vtkIndent.h:28
void ReleaseGraphicsResources(vtkWindow *) override
These methods are necessary to make this representation behave as a vtkProp.
FitType
Control the relationship between the size of the text and the border.
represent a vtkBorderWidget
#define VTK_MARSHALAUTO
draw text label associated with a point
vtkPointHandleRepresentation3D * AnchorRepresentation