VTK  9.0.1
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 =========================================================================*/
54 #ifndef vtkBalloonRepresentation_h
55 #define vtkBalloonRepresentation_h
56 
57 #include "vtkInteractionWidgetsModule.h" // For export macro
59 
60 class vtkTextMapper;
61 class vtkTextActor;
62 class vtkTextProperty;
63 class vtkPoints;
64 class vtkCellArray;
65 class vtkPolyData;
67 class vtkActor2D;
68 class vtkProperty2D;
69 class vtkImageData;
70 class vtkTexture;
71 class vtkPoints;
72 class vtkPolyData;
74 class vtkTexturedActor2D;
75 
76 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
77 {
78 public:
82  static vtkBalloonRepresentation* New();
83 
85 
89  void PrintSelf(ostream& os, vtkIndent indent) override;
91 
93 
96  virtual void SetBalloonImage(vtkImageData* img);
97  vtkGetObjectMacro(BalloonImage, vtkImageData);
99 
101 
104  vtkGetStringMacro(BalloonText);
105  vtkSetStringMacro(BalloonText);
107 
109 
115  vtkSetVector2Macro(ImageSize, int);
116  vtkGetVector2Macro(ImageSize, int);
118 
120 
123  virtual void SetTextProperty(vtkTextProperty* p);
124  vtkGetObjectMacro(TextProperty, vtkTextProperty);
126 
128 
132  virtual void SetFrameProperty(vtkProperty2D* p);
133  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
135 
137 
140  virtual void SetImageProperty(vtkProperty2D* p);
141  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
143 
144  enum
145  {
146  ImageLeft = 0,
149  ImageTop
150  };
151 
153 
160  vtkSetMacro(BalloonLayout, int);
161  vtkGetMacro(BalloonLayout, int);
162  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
163  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
164  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
165  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
166  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
167  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
168  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
169  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
171 
173 
179  vtkSetVector2Macro(Offset, int);
180  vtkGetVector2Macro(Offset, int);
182 
184 
188  vtkSetClampMacro(Padding, int, 0, 100);
189  vtkGetMacro(Padding, int);
191 
193 
196  void StartWidgetInteraction(double e[2]) override;
197  void EndWidgetInteraction(double e[2]) override;
198  void BuildRepresentation() override;
199  int ComputeInteractionState(int X, int Y, int modify = 0) override;
201 
203 
206  void ReleaseGraphicsResources(vtkWindow* w) override;
207  int RenderOverlay(vtkViewport* viewport) override;
209 
214  {
215  Outside = 0,
217  OnImage
218  };
219 
220 protected:
222  ~vtkBalloonRepresentation() override;
223 
224  // The balloon text and image
225  char* BalloonText;
227 
228  // The layout of the balloon
230 
231  // Controlling placement
232  int Padding;
233  int Offset[2];
234  int ImageSize[2];
235 
236  // Represent the text
240 
241  // Represent the image
248 
249  // The frame
256 
257  // Internal variable controlling rendering process
260 
261  // Helper methods
262  void AdjustImageSize(double imageSize[2]);
263  void ScaleImage(double imageSize[2], double scale);
264 
265 private:
267  void operator=(const vtkBalloonRepresentation&) = delete;
268 };
269 
270 #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.
a actor that draws 2D data
Definition: vtkActor2D.h:39
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:84
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:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
An actor that displays text.
Definition: vtkTextActor.h:50
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:33
topologically and geometrically regular array of data
Definition: vtkImageData.h:41
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:65
_InteractionState
State is either outside, or inside (on the text portion of the image).
vtkPolyDataMapper2D * TextureMapper
represent text properties.
represent the vtkBalloonWidget
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
object to represent cell connectivity
Definition: vtkCellArray.h:179
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
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:33