VTK  9.1.0
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=========================================================================*/
63#ifndef vtkBalloonRepresentation_h
64#define vtkBalloonRepresentation_h
65
66#include "vtkInteractionWidgetsModule.h" // For export macro
68
69class vtkTextMapper;
70class vtkTextActor;
71class vtkTextProperty;
72class vtkPoints;
73class vtkCellArray;
74class vtkPolyData;
76class vtkActor2D;
77class vtkProperty2D;
78class vtkImageData;
79class vtkTexture;
80class vtkPoints;
81class vtkPolyData;
84
85class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
86{
87public:
92
94
98 void PrintSelf(ostream& os, vtkIndent indent) override;
100
102
105 virtual void SetBalloonImage(vtkImageData* img);
106 vtkGetObjectMacro(BalloonImage, vtkImageData);
108
110
113 vtkGetStringMacro(BalloonText);
114 vtkSetStringMacro(BalloonText);
116
118
124 vtkSetVector2Macro(ImageSize, int);
125 vtkGetVector2Macro(ImageSize, int);
127
129
133 vtkGetObjectMacro(TextProperty, vtkTextProperty);
135
137
142 vtkGetObjectMacro(FrameProperty, vtkProperty2D);
144
146
150 vtkGetObjectMacro(ImageProperty, vtkProperty2D);
152
153 enum
154 {
155 ImageLeft = 0,
158 ImageTop
159 };
160
162
169 vtkSetMacro(BalloonLayout, int);
170 vtkGetMacro(BalloonLayout, int);
171 void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
172 void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
173 void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
174 void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
175 void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
176 void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
177 void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
178 void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
180
182
188 vtkSetVector2Macro(Offset, int);
189 vtkGetVector2Macro(Offset, int);
191
193
197 vtkSetClampMacro(Padding, int, 0, 100);
198 vtkGetMacro(Padding, int);
200
202
205 void StartWidgetInteraction(double e[2]) override;
206 void EndWidgetInteraction(double e[2]) override;
207 void BuildRepresentation() override;
208 int ComputeInteractionState(int X, int Y, int modify = 0) override;
210
212
216 int RenderOverlay(vtkViewport* viewport) override;
218
223 {
224 Outside = 0,
226 OnImage
227 };
228
229protected:
232
233 // The balloon text and image
236
237 // The layout of the balloon
239
240 // Controlling placement
242 int Offset[2];
243 int ImageSize[2];
244
245 // Represent the text
249
250 // Represent the image
257
258 // The frame
265
266 // Internal variable controlling rendering process
269
270 // Helper methods
271 void AdjustImageSize(double imageSize[2]);
272 void ScaleImage(double imageSize[2], double scale);
273
274private:
276 void operator=(const vtkBalloonRepresentation&) = delete;
277};
278
279#endif
a actor that draws 2D data
Definition: vtkActor2D.h:49
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.
_InteractionState
State is either outside, or inside (on the text portion of the image).
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.
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:190
topologically and geometrically regular array of data
Definition: vtkImageData.h:57
a simple class to control print indentation
Definition: vtkIndent.h:43
represent and manipulate 3D points
Definition: vtkPoints.h:43
draw vtkPolyData onto the image plane
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:95
represent surface properties of a 2D image
Definition: vtkProperty2D.h:47
An actor that displays text.
Definition: vtkTextActor.h:60
2D text annotation
Definition: vtkTextMapper.h:57
represent text properties.
handles properties associated with a texture map
Definition: vtkTexture.h:75
actor that draws 2D data with texture support
abstract specification for Viewports
Definition: vtkViewport.h:56
abstract class defines interface between the widget and widget representation classes
window superclass for vtkRenderWindow
Definition: vtkWindow.h:45
@ scale
Definition: vtkX3D.h:235