VTK  9.2.6
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 =========================================================================*/
66 #ifndef vtkBalloonRepresentation_h
67 #define vtkBalloonRepresentation_h
68 
69 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
70 #include "vtkInteractionWidgetsModule.h" // For export macro
72 
73 class vtkTextMapper;
74 class vtkTextActor;
75 class vtkTextProperty;
76 class vtkPoints;
77 class vtkCellArray;
78 class vtkPolyData;
80 class vtkActor2D;
81 class vtkProperty2D;
82 class vtkImageData;
83 class vtkTexture;
84 class vtkPoints;
85 class vtkPolyData;
87 class vtkTexturedActor2D;
88 
89 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
90 {
91 public:
96 
98 
102  void PrintSelf(ostream& os, vtkIndent indent) override;
104 
106 
109  virtual void SetBalloonImage(vtkImageData* img);
110  vtkGetObjectMacro(BalloonImage, vtkImageData);
112 
114 
117  vtkGetStringMacro(BalloonText);
118  vtkSetStringMacro(BalloonText);
120 
122 
128  vtkSetVector2Macro(ImageSize, int);
129  vtkGetVector2Macro(ImageSize, int);
131 
133 
137  vtkGetObjectMacro(TextProperty, vtkTextProperty);
139 
141 
145  virtual void SetFrameProperty(vtkProperty2D* p);
146  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
148 
150 
153  virtual void SetImageProperty(vtkProperty2D* p);
154  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
156 
157  enum
158  {
159  ImageLeft = 0,
162  ImageTop
163  };
164 
166 
173  vtkSetMacro(BalloonLayout, int);
174  vtkGetMacro(BalloonLayout, int);
175  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
176  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
177  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
178  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
179  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
180  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
181  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
182  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
184 
186 
192  vtkSetVector2Macro(Offset, int);
193  vtkGetVector2Macro(Offset, int);
195 
197 
201  vtkSetClampMacro(Padding, int, 0, 100);
202  vtkGetMacro(Padding, int);
204 
206 
209  void StartWidgetInteraction(double e[2]) override;
210  void EndWidgetInteraction(double e[2]) override;
211  void BuildRepresentation() override;
212  int ComputeInteractionState(int X, int Y, int modify = 0) override;
214 
216 
220  int RenderOverlay(vtkViewport* viewport) override;
222 
227  {
228  Outside = 0,
230  OnImage
231  };
232 #if !defined(VTK_LEGACY_REMOVE)
233  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
235 #endif
236 
237 protected:
240 
241  // The balloon text and image
242  char* BalloonText;
244 
245  // The layout of the balloon
247 
248  // Controlling placement
249  int Padding;
250  int Offset[2];
251  int ImageSize[2];
252 
253  // Represent the text
257 
258  // Represent the image
265 
266  // The frame
273 
274  // Internal variable controlling rendering process
277 
278  // Helper methods
279  void AdjustImageSize(double imageSize[2]);
280  void ScaleImage(double imageSize[2], double scale);
281 
282 private:
284  void operator=(const vtkBalloonRepresentation&) = delete;
285 };
286 
287 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:55
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:196
topologically and geometrically regular array of data
Definition: vtkImageData.h:63
a simple class to control print indentation
Definition: vtkIndent.h:49
represent and manipulate 3D points
Definition: vtkPoints.h:49
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:100
represent surface properties of a 2D image
Definition: vtkProperty2D.h:50
An actor that displays text.
Definition: vtkTextActor.h:66
2D text annotation
Definition: vtkTextMapper.h:60
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:78
actor that draws 2D data with texture support
abstract specification for Viewports
Definition: vtkViewport.h:65
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
@ scale
Definition: vtkX3D.h:235
#define VTK_DEPRECATED_IN_9_2_0(reason)