VTK  9.3.1
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
45 #ifndef vtkBalloonRepresentation_h
46 #define vtkBalloonRepresentation_h
47 
48 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_2_0
49 #include "vtkInteractionWidgetsModule.h" // For export macro
50 #include "vtkLegacy.h" // for VTK_LEGACY_REMOVE
52 
53 VTK_ABI_NAMESPACE_BEGIN
54 class vtkTextMapper;
55 class vtkTextActor;
56 class vtkTextProperty;
57 class vtkPoints;
58 class vtkCellArray;
59 class vtkPolyData;
61 class vtkActor2D;
62 class vtkProperty2D;
63 class vtkImageData;
64 class vtkTexture;
65 class vtkPoints;
66 class vtkPolyData;
68 class vtkTexturedActor2D;
69 
70 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
71 {
72 public:
76  static vtkBalloonRepresentation* New();
77 
79 
83  void PrintSelf(ostream& os, vtkIndent indent) override;
85 
87 
90  virtual void SetBalloonImage(vtkImageData* img);
91  vtkGetObjectMacro(BalloonImage, vtkImageData);
93 
95 
98  vtkGetStringMacro(BalloonText);
99  vtkSetStringMacro(BalloonText);
101 
103 
109  vtkSetVector2Macro(ImageSize, int);
110  vtkGetVector2Macro(ImageSize, int);
112 
114 
117  virtual void SetTextProperty(vtkTextProperty* p);
118  vtkGetObjectMacro(TextProperty, vtkTextProperty);
120 
122 
126  virtual void SetFrameProperty(vtkProperty2D* p);
127  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
129 
131 
134  virtual void SetImageProperty(vtkProperty2D* p);
135  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
137 
138  enum
139  {
140  ImageLeft = 0,
143  ImageTop
144  };
145 
147 
154  vtkSetMacro(BalloonLayout, int);
155  vtkGetMacro(BalloonLayout, int);
156  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
157  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
158  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
159  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
160  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
161  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
162  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
163  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
165 
167 
173  vtkSetVector2Macro(Offset, int);
174  vtkGetVector2Macro(Offset, int);
176 
178 
182  vtkSetClampMacro(Padding, int, 0, 100);
183  vtkGetMacro(Padding, int);
185 
187 
190  void StartWidgetInteraction(double e[2]) override;
191  void EndWidgetInteraction(double e[2]) override;
192  void BuildRepresentation() override;
193  int ComputeInteractionState(int X, int Y, int modify = 0) override;
195 
197 
200  void ReleaseGraphicsResources(vtkWindow* w) override;
201  int RenderOverlay(vtkViewport* viewport) override;
203 
208  {
209  Outside = 0,
211  OnImage
212  };
213 #if !defined(VTK_LEGACY_REMOVE)
214  VTK_DEPRECATED_IN_9_2_0("because leading underscore is reserved")
216 #endif
217 
218 protected:
220  ~vtkBalloonRepresentation() override;
221 
222  // The balloon text and image
223  char* BalloonText;
225 
226  // The layout of the balloon
228 
229  // Controlling placement
230  int Padding;
231  int Offset[2];
232  int ImageSize[2];
233 
234  // Represent the text
238 
239  // Represent the image
246 
247  // The frame
254 
255  // Internal variable controlling rendering process
258 
259  // Helper methods
260  void AdjustImageSize(double imageSize[2]);
261  void ScaleImage(double imageSize[2], double scale);
262 
263 private:
265  void operator=(const vtkBalloonRepresentation&) = delete;
266 };
267 
268 VTK_ABI_NAMESPACE_END
269 #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:44
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:34
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:79
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:39
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
An actor that displays text.
Definition: vtkTextActor.h:45
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:28
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
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:57
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:175
represent surface properties of a 2D image
Definition: vtkProperty2D.h:29
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:28