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 =========================================================================*/
57 #ifndef vtkBalloonRepresentation_h
58 #define vtkBalloonRepresentation_h
59 
60 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
61 #include "vtkInteractionWidgetsModule.h" // For export macro
63 
64 class vtkTextMapper;
65 class vtkTextActor;
66 class vtkTextProperty;
67 class vtkPoints;
68 class vtkCellArray;
69 class vtkPolyData;
71 class vtkActor2D;
72 class vtkProperty2D;
73 class vtkImageData;
74 class vtkTexture;
75 class vtkPoints;
76 class vtkPolyData;
78 class vtkTexturedActor2D;
79 
80 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
81 {
82 public:
86  static vtkBalloonRepresentation* New();
87 
89 
93  void PrintSelf(ostream& os, vtkIndent indent) override;
95 
97 
100  virtual void SetBalloonImage(vtkImageData* img);
101  vtkGetObjectMacro(BalloonImage, vtkImageData);
103 
105 
108  vtkGetStringMacro(BalloonText);
109  vtkSetStringMacro(BalloonText);
111 
113 
119  vtkSetVector2Macro(ImageSize, int);
120  vtkGetVector2Macro(ImageSize, int);
122 
124 
127  virtual void SetTextProperty(vtkTextProperty* p);
128  vtkGetObjectMacro(TextProperty, vtkTextProperty);
130 
132 
136  virtual void SetFrameProperty(vtkProperty2D* p);
137  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
139 
141 
144  virtual void SetImageProperty(vtkProperty2D* p);
145  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
147 
148  enum
149  {
150  ImageLeft = 0,
153  ImageTop
154  };
155 
157 
164  vtkSetMacro(BalloonLayout, int);
165  vtkGetMacro(BalloonLayout, int);
166  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
167  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
168  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
169  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
170  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
171  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
172  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
173  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
175 
177 
183  vtkSetVector2Macro(Offset, int);
184  vtkGetVector2Macro(Offset, int);
186 
188 
192  vtkSetClampMacro(Padding, int, 0, 100);
193  vtkGetMacro(Padding, int);
195 
197 
200  void StartWidgetInteraction(double e[2]) override;
201  void EndWidgetInteraction(double e[2]) override;
202  void BuildRepresentation() override;
203  int ComputeInteractionState(int X, int Y, int modify = 0) override;
205 
207 
210  void ReleaseGraphicsResources(vtkWindow* w) override;
211  int RenderOverlay(vtkViewport* viewport) override;
213 
218  {
219  Outside = 0,
221  OnImage
222  };
223 #if !defined(VTK_LEGACY_REMOVE)
224  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
226 #endif
227 
228 protected:
230  ~vtkBalloonRepresentation() override;
231 
232  // The balloon text and image
233  char* BalloonText;
235 
236  // The layout of the balloon
238 
239  // Controlling placement
240  int Padding;
241  int Offset[2];
242  int ImageSize[2];
243 
244  // Represent the text
248 
249  // Represent the image
256 
257  // The frame
264 
265  // Internal variable controlling rendering process
268 
269  // Helper methods
270  void AdjustImageSize(double imageSize[2]);
271  void ScaleImage(double imageSize[2], double scale);
272 
273 private:
275  void operator=(const vtkBalloonRepresentation&) = delete;
276 };
277 
278 #endif
void PrintSelf(ostream &os, vtkIndent indent) override
Standard methods for instances of this class.
void SetBalloonLayoutToImageLeft()
Specify the layout of the image and text within the balloon.
virtual void EndWidgetInteraction(double newEventPos[2])
actor that draws 2D data with texture support
void SetBalloonLayoutToImageRight()
Specify the layout of the image and text within the balloon.
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:55
virtual void StartWidgetInteraction(double eventPos[2])
void SetBalloonLayoutToTextLeft()
Specify the layout of the image and text within the balloon.
#define VTK_DEPRECATED_IN_9_2_0(reason)
a actor that draws 2D data
Definition: vtkActor2D.h:45
void SetBalloonLayoutToTextTop()
Specify the layout of the image and text within the balloon.
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:90
void SetBalloonLayoutToTextRight()
Specify the layout of the image and text within the balloon.
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
Subclasses of vtkWidgetRepresentation must implement these methods.
2D text annotation
Definition: vtkTextMapper.h:50
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
An actor that displays text.
Definition: vtkTextActor.h:56
void SetBalloonLayoutToImageBottom()
Specify the layout of the image and text within the balloon.
void SetBalloonLayoutToImageTop()
Specify the layout of the image and text within the balloon.
void SetBalloonLayoutToTextBottom()
Specify the layout of the image and text within the balloon.
a simple class to control print indentation
Definition: vtkIndent.h:39
topologically and geometrically regular array of data
Definition: vtkImageData.h:53
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
handles properties associated with a texture map
Definition: vtkTexture.h:68
vtkPolyDataMapper2D * TextureMapper
represent text properties.
represent the vtkBalloonWidget
InteractionStateType
State is either outside, or inside (on the text portion of the image).
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
object to represent cell connectivity
Definition: vtkCellArray.h:186
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
vtkPolyDataMapper2D * FrameMapper
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:39