VTK  9.3.0
vtkBalloonRepresentation.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
54 #ifndef vtkBalloonRepresentation_h
55 #define vtkBalloonRepresentation_h
56 
57 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
58 #include "vtkInteractionWidgetsModule.h" // For export macro
59 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
61 
62 VTK_ABI_NAMESPACE_BEGIN
63 class vtkTextMapper;
64 class vtkTextActor;
65 class vtkTextProperty;
66 class vtkPoints;
67 class vtkCellArray;
68 class vtkPolyData;
70 class vtkActor2D;
71 class vtkProperty2D;
72 class vtkImageData;
73 class vtkTexture;
74 class vtkPoints;
75 class vtkPolyData;
77 class vtkTexturedActor2D;
78 
79 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
80 {
81 public:
86 
88 
92  void PrintSelf(ostream& os, vtkIndent indent) override;
94 
96 
99  virtual void SetBalloonImage(vtkImageData* img);
100  vtkGetObjectMacro(BalloonImage, vtkImageData);
102 
104 
107  vtkGetStringMacro(BalloonText);
108  vtkSetStringMacro(BalloonText);
110 
112 
118  vtkSetVector2Macro(ImageSize, int);
119  vtkGetVector2Macro(ImageSize, int);
121 
123 
127  vtkGetObjectMacro(TextProperty, vtkTextProperty);
129 
131 
135  virtual void SetFrameProperty(vtkProperty2D* p);
136  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
138 
140 
143  virtual void SetImageProperty(vtkProperty2D* p);
144  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
146 
147  enum
148  {
149  ImageLeft = 0,
152  ImageTop
153  };
154 
156 
163  vtkSetMacro(BalloonLayout, int);
164  vtkGetMacro(BalloonLayout, int);
165  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
166  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
167  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
168  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
169  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
170  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
171  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
172  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
174 
176 
182  vtkSetVector2Macro(Offset, int);
183  vtkGetVector2Macro(Offset, int);
185 
187 
191  vtkSetClampMacro(Padding, int, 0, 100);
192  vtkGetMacro(Padding, int);
194 
196 
199  void StartWidgetInteraction(double e[2]) override;
200  void EndWidgetInteraction(double e[2]) override;
201  void BuildRepresentation() override;
202  int ComputeInteractionState(int X, int Y, int modify = 0) override;
204 
206 
210  int RenderOverlay(vtkViewport* viewport) override;
212 
217  {
218  Outside = 0,
220  OnImage
221  };
222 #if !defined(VTK_LEGACY_REMOVE)
223  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
225 #endif
226 
227 protected:
230 
231  // The balloon text and image
232  char* BalloonText;
234 
235  // The layout of the balloon
237 
238  // Controlling placement
239  int Padding;
240  int Offset[2];
241  int ImageSize[2];
242 
243  // Represent the text
247 
248  // Represent the image
255 
256  // The frame
263 
264  // Internal variable controlling rendering process
267 
268  // Helper methods
269  void AdjustImageSize(double imageSize[2]);
270  void ScaleImage(double imageSize[2], double scale);
271 
272 private:
274  void operator=(const vtkBalloonRepresentation&) = delete;
275 };
276 
277 VTK_ABI_NAMESPACE_END
278 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:44
represent the vtkBalloonWidget
void SetBalloonLayoutToTextRight()
Specify the layout of the image and text within the balloon.
void SetBalloonLayoutToImageLeft()
Specify the layout of the image and text within the balloon.
void SetBalloonLayoutToTextTop()
Specify the layout of the image and text within the balloon.
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SetBalloonImage(vtkImageData *img)
Specify/retrieve the image to display in the balloon.
void SetBalloonLayoutToImageRight()
Specify the layout of the image and text within the balloon.
vtkPolyDataMapper2D * TextureMapper
void EndWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
virtual void SetTextProperty(vtkTextProperty *p)
Set/get the text property (relevant only if text is shown).
vtkPolyDataMapper2D * FrameMapper
void SetBalloonLayoutToImageTop()
Specify the layout of the image and text within the balloon.
void SetBalloonLayoutToTextLeft()
Specify the layout of the image and text within the balloon.
void AdjustImageSize(double imageSize[2])
void SetBalloonLayoutToImageBottom()
Specify the layout of the image and text within the balloon.
void SetBalloonLayoutToTextBottom()
Specify the layout of the image and text within the balloon.
InteractionStateType
State is either outside, or inside (on the text portion of the image).
virtual void SetImageProperty(vtkProperty2D *p)
Set/get the image property (relevant only if an image is shown).
~vtkBalloonRepresentation() override
void ScaleImage(double imageSize[2], double scale)
void ReleaseGraphicsResources(vtkWindow *w) override
Methods required by vtkProp superclass.
static vtkBalloonRepresentation * New()
Instantiate the class.
int RenderOverlay(vtkViewport *viewport) override
Methods required by vtkProp superclass.
virtual void SetFrameProperty(vtkProperty2D *p)
Set/get the frame property (relevant only if text is shown).
object to represent cell connectivity
Definition: vtkCellArray.h:185
topologically and geometrically regular array of data
Definition: vtkImageData.h:52
a simple class to control print indentation
Definition: vtkIndent.h:38
represent and manipulate 3D points
Definition: vtkPoints.h:38
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:89
represent surface properties of a 2D image
Definition: vtkProperty2D.h:39
An actor that displays text.
Definition: vtkTextActor.h:55
2D text annotation
Definition: vtkTextMapper.h:49
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:67
actor that draws 2D data with texture support
abstract specification for Viewports
Definition: vtkViewport.h:54
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
@ scale
Definition: vtkX3D.h:229
#define VTK_DEPRECATED_IN_9_2_0(reason)