VTK  9.3.20231207
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
64 #ifndef vtkBalloonRepresentation_h
65 #define vtkBalloonRepresentation_h
66 
67 #include "vtkInteractionWidgetsModule.h" // For export macro
69 
70 VTK_ABI_NAMESPACE_BEGIN
71 class vtkTextMapper;
72 class vtkTextActor;
73 class vtkTextProperty;
74 class vtkPoints;
75 class vtkCellArray;
76 class vtkPolyData;
78 class vtkActor2D;
79 class vtkProperty2D;
80 class vtkImageData;
81 class vtkTexture;
82 class vtkPoints;
83 class vtkPolyData;
85 class vtkTexturedActor2D;
86 
87 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
88 {
89 public:
94 
96 
100  void PrintSelf(ostream& os, vtkIndent indent) override;
102 
104 
107  virtual void SetBalloonImage(vtkImageData* img);
108  vtkGetObjectMacro(BalloonImage, vtkImageData);
110 
112 
115  vtkGetStringMacro(BalloonText);
116  vtkSetStringMacro(BalloonText);
118 
120 
126  vtkSetVector2Macro(ImageSize, int);
127  vtkGetVector2Macro(ImageSize, int);
129 
131 
135  vtkGetObjectMacro(TextProperty, vtkTextProperty);
137 
139 
143  virtual void SetFrameProperty(vtkProperty2D* p);
144  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
146 
148 
151  virtual void SetImageProperty(vtkProperty2D* p);
152  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
154 
155  enum
156  {
157  ImageLeft = 0,
160  ImageTop
161  };
162 
164 
171  vtkSetMacro(BalloonLayout, int);
172  vtkGetMacro(BalloonLayout, int);
173  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
174  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
175  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
176  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
177  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
178  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
179  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
180  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
182 
184 
190  vtkSetVector2Macro(Offset, int);
191  vtkGetVector2Macro(Offset, int);
193 
195 
199  vtkSetClampMacro(Padding, int, 0, 100);
200  vtkGetMacro(Padding, int);
202 
204 
207  void StartWidgetInteraction(double e[2]) override;
208  void EndWidgetInteraction(double e[2]) override;
209  void BuildRepresentation() override;
210  int ComputeInteractionState(int X, int Y, int modify = 0) override;
212 
214 
218  int RenderOverlay(vtkViewport* viewport) override;
220 
225  {
226  Outside = 0,
228  OnImage
229  };
230 
231 protected:
234 
235  // The balloon text and image
236  char* BalloonText;
238 
239  // The layout of the balloon
241 
242  // Controlling placement
243  int Padding;
244  int Offset[2];
245  int ImageSize[2];
246 
247  // Represent the text
251 
252  // Represent the image
259 
260  // The frame
267 
268  // Internal variable controlling rendering process
271 
272  // Helper methods
273  void AdjustImageSize(double imageSize[2]);
274  void ScaleImage(double imageSize[2], double scale);
275 
276 private:
278  void operator=(const vtkBalloonRepresentation&) = delete;
279 };
280 
281 VTK_ABI_NAMESPACE_END
282 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:144
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:285
topologically and geometrically regular array of data
Definition: vtkImageData.h:155
a simple class to control print indentation
Definition: vtkIndent.h:108
represent and manipulate 3D points
Definition: vtkPoints.h:138
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:180
represent surface properties of a 2D image
An actor that displays text.
Definition: vtkTextActor.h:155
2D text annotation
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:167
actor that draws 2D data with texture support
abstract specification for Viewports
Definition: vtkViewport.h:64
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:47
@ scale
Definition: vtkX3D.h:229