VTK  9.2.20230129
vtkBalloonRepresentation.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkBalloonRepresentation.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 =========================================================================*/
76 #ifndef vtkBalloonRepresentation_h
77 #define vtkBalloonRepresentation_h
78 
79 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
80 #include "vtkInteractionWidgetsModule.h" // For export macro
82 
83 VTK_ABI_NAMESPACE_BEGIN
84 class vtkTextMapper;
85 class vtkTextActor;
86 class vtkTextProperty;
87 class vtkPoints;
88 class vtkCellArray;
89 class vtkPolyData;
91 class vtkActor2D;
92 class vtkProperty2D;
93 class vtkImageData;
94 class vtkTexture;
95 class vtkPoints;
96 class vtkPolyData;
98 class vtkTexturedActor2D;
99 
100 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
101 {
102 public:
107 
109 
113  void PrintSelf(ostream& os, vtkIndent indent) override;
115 
117 
120  virtual void SetBalloonImage(vtkImageData* img);
121  vtkGetObjectMacro(BalloonImage, vtkImageData);
123 
125 
128  vtkGetStringMacro(BalloonText);
129  vtkSetStringMacro(BalloonText);
131 
133 
139  vtkSetVector2Macro(ImageSize, int);
140  vtkGetVector2Macro(ImageSize, int);
142 
144 
148  vtkGetObjectMacro(TextProperty, vtkTextProperty);
150 
152 
156  virtual void SetFrameProperty(vtkProperty2D* p);
157  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
159 
161 
164  virtual void SetImageProperty(vtkProperty2D* p);
165  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
167 
168  enum
169  {
170  ImageLeft = 0,
173  ImageTop
174  };
175 
177 
184  vtkSetMacro(BalloonLayout, int);
185  vtkGetMacro(BalloonLayout, int);
186  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
187  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
188  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
189  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
190  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
191  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
192  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
193  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
195 
197 
203  vtkSetVector2Macro(Offset, int);
204  vtkGetVector2Macro(Offset, int);
206 
208 
212  vtkSetClampMacro(Padding, int, 0, 100);
213  vtkGetMacro(Padding, int);
215 
217 
220  void StartWidgetInteraction(double e[2]) override;
221  void EndWidgetInteraction(double e[2]) override;
222  void BuildRepresentation() override;
223  int ComputeInteractionState(int X, int Y, int modify = 0) override;
225 
227 
231  int RenderOverlay(vtkViewport* viewport) override;
233 
238  {
239  Outside = 0,
241  OnImage
242  };
243 #if !defined(VTK_LEGACY_REMOVE)
244  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
246 #endif
247 
248 protected:
251 
252  // The balloon text and image
253  char* BalloonText;
255 
256  // The layout of the balloon
258 
259  // Controlling placement
260  int Padding;
261  int Offset[2];
262  int ImageSize[2];
263 
264  // Represent the text
268 
269  // Represent the image
276 
277  // The frame
284 
285  // Internal variable controlling rendering process
288 
289  // Helper methods
290  void AdjustImageSize(double imageSize[2]);
291  void ScaleImage(double imageSize[2], double scale);
292 
293 private:
295  void operator=(const vtkBalloonRepresentation&) = delete;
296 };
297 
298 VTK_ABI_NAMESPACE_END
299 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:156
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:297
topologically and geometrically regular array of data
Definition: vtkImageData.h:164
a simple class to control print indentation
Definition: vtkIndent.h:120
represent and manipulate 3D points
Definition: vtkPoints.h:150
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:201
represent surface properties of a 2D image
An actor that displays text.
Definition: vtkTextActor.h:167
2D text annotation
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:179
actor that draws 2D data with texture support
abstract specification for Viewports
Definition: vtkViewport.h:57
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:40
@ scale
Definition: vtkX3D.h:241
#define VTK_DEPRECATED_IN_9_2_0(reason)