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 =========================================================================*/
73 #ifndef vtkBalloonRepresentation_h
74 #define vtkBalloonRepresentation_h
75 
76 #include "vtkInteractionWidgetsModule.h" // For export macro
78 
79 class vtkTextMapper;
80 class vtkTextActor;
81 class vtkTextProperty;
82 class vtkPoints;
83 class vtkCellArray;
84 class vtkPolyData;
86 class vtkActor2D;
87 class vtkProperty2D;
88 class vtkImageData;
89 class vtkTexture;
90 class vtkPoints;
91 class vtkPolyData;
93 class vtkTexturedActor2D;
94 
95 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
96 {
97 public:
102 
104 
108  void PrintSelf(ostream& os, vtkIndent indent) override;
110 
112 
115  virtual void SetBalloonImage(vtkImageData* img);
116  vtkGetObjectMacro(BalloonImage, vtkImageData);
118 
120 
123  vtkGetStringMacro(BalloonText);
124  vtkSetStringMacro(BalloonText);
126 
128 
134  vtkSetVector2Macro(ImageSize, int);
135  vtkGetVector2Macro(ImageSize, int);
137 
139 
143  vtkGetObjectMacro(TextProperty, vtkTextProperty);
145 
147 
151  virtual void SetFrameProperty(vtkProperty2D* p);
152  vtkGetObjectMacro(FrameProperty, vtkProperty2D);
154 
156 
159  virtual void SetImageProperty(vtkProperty2D* p);
160  vtkGetObjectMacro(ImageProperty, vtkProperty2D);
162 
163  enum
164  {
165  ImageLeft = 0,
168  ImageTop
169  };
170 
172 
179  vtkSetMacro(BalloonLayout, int);
180  vtkGetMacro(BalloonLayout, int);
181  void SetBalloonLayoutToImageLeft() { this->SetBalloonLayout(ImageLeft); }
182  void SetBalloonLayoutToImageRight() { this->SetBalloonLayout(ImageRight); }
183  void SetBalloonLayoutToImageBottom() { this->SetBalloonLayout(ImageBottom); }
184  void SetBalloonLayoutToImageTop() { this->SetBalloonLayout(ImageTop); }
185  void SetBalloonLayoutToTextLeft() { this->SetBalloonLayout(ImageRight); }
186  void SetBalloonLayoutToTextRight() { this->SetBalloonLayout(ImageLeft); }
187  void SetBalloonLayoutToTextTop() { this->SetBalloonLayout(ImageBottom); }
188  void SetBalloonLayoutToTextBottom() { this->SetBalloonLayout(ImageTop); }
190 
192 
198  vtkSetVector2Macro(Offset, int);
199  vtkGetVector2Macro(Offset, int);
201 
203 
207  vtkSetClampMacro(Padding, int, 0, 100);
208  vtkGetMacro(Padding, int);
210 
212 
215  void StartWidgetInteraction(double e[2]) override;
216  void EndWidgetInteraction(double e[2]) override;
217  void BuildRepresentation() override;
218  int ComputeInteractionState(int X, int Y, int modify = 0) override;
220 
222 
226  int RenderOverlay(vtkViewport* viewport) override;
228 
233  {
234  Outside = 0,
236  OnImage
237  };
238 
239 protected:
242 
243  // The balloon text and image
244  char* BalloonText;
246 
247  // The layout of the balloon
249 
250  // Controlling placement
251  int Padding;
252  int Offset[2];
253  int ImageSize[2];
254 
255  // Represent the text
259 
260  // Represent the image
267 
268  // The frame
275 
276  // Internal variable controlling rendering process
279 
280  // Helper methods
281  void AdjustImageSize(double imageSize[2]);
282  void ScaleImage(double imageSize[2], double scale);
283 
284 private:
286  void operator=(const vtkBalloonRepresentation&) = delete;
287 };
288 
289 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:143
vtkWidgetRepresentation.h
vtkBalloonRepresentation::SetBalloonLayoutToTextTop
void SetBalloonLayoutToTextTop()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:187
vtkBalloonRepresentation::AdjustImageSize
void AdjustImageSize(double imageSize[2])
vtkBalloonRepresentation::ImageBottom
@ ImageBottom
Definition: vtkBalloonRepresentation.h:167
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:154
vtkBalloonRepresentation::TextMapper
vtkTextMapper * TextMapper
Definition: vtkBalloonRepresentation.h:256
vtkBalloonRepresentation::FrameActor
vtkActor2D * FrameActor
Definition: vtkBalloonRepresentation.h:273
vtkX3D::scale
@ scale
Definition: vtkX3D.h:235
vtkBalloonRepresentation::~vtkBalloonRepresentation
~vtkBalloonRepresentation() override
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:39
vtkBalloonRepresentation::FramePoints
vtkPoints * FramePoints
Definition: vtkBalloonRepresentation.h:269
vtkBalloonRepresentation::StartWidgetInteraction
void StartWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkBalloonRepresentation::New
static vtkBalloonRepresentation * New()
Instantiate the class.
vtkBalloonRepresentation::SetFrameProperty
virtual void SetFrameProperty(vtkProperty2D *p)
Set/get the frame property (relevant only if text is shown).
vtkBalloonRepresentation::ScaleImage
void ScaleImage(double imageSize[2], double scale)
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkBalloonRepresentation::ImageRight
@ ImageRight
Definition: vtkBalloonRepresentation.h:166
vtkBalloonRepresentation::vtkBalloonRepresentation
vtkBalloonRepresentation()
vtkBalloonRepresentation::FramePolyData
vtkPolyData * FramePolyData
Definition: vtkBalloonRepresentation.h:271
vtkBalloonRepresentation::Padding
int Padding
Definition: vtkBalloonRepresentation.h:251
vtkBalloonRepresentation::TextProperty
vtkTextProperty * TextProperty
Definition: vtkBalloonRepresentation.h:258
vtkBalloonRepresentation::OnText
@ OnText
Definition: vtkBalloonRepresentation.h:235
vtkBalloonRepresentation::TexturePolyData
vtkPolyData * TexturePolyData
Definition: vtkBalloonRepresentation.h:262
vtkBalloonRepresentation::SetBalloonLayoutToImageBottom
void SetBalloonLayoutToImageBottom()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:183
vtkBalloonRepresentation::SetBalloonLayoutToTextBottom
void SetBalloonLayoutToTextBottom()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:188
vtkBalloonRepresentation::ComputeInteractionState
int ComputeInteractionState(int X, int Y, int modify=0) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkBalloonRepresentation::TextureMapper
vtkPolyDataMapper2D * TextureMapper
Definition: vtkBalloonRepresentation.h:264
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkBalloonRepresentation::BalloonLayout
int BalloonLayout
Definition: vtkBalloonRepresentation.h:248
vtkBalloonRepresentation::SetImageProperty
virtual void SetImageProperty(vtkProperty2D *p)
Set/get the image property (relevant only if an image is shown).
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:175
vtkBalloonRepresentation::ImageVisible
int ImageVisible
Definition: vtkBalloonRepresentation.h:278
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:157
vtkBalloonRepresentation::FrameProperty
vtkProperty2D * FrameProperty
Definition: vtkBalloonRepresentation.h:274
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:157
vtkTextActor
An actor that displays text.
Definition: vtkTextActor.h:160
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkBalloonRepresentation::SetBalloonLayoutToTextRight
void SetBalloonLayoutToTextRight()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:186
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:290
vtkBalloonRepresentation::ImageProperty
vtkProperty2D * ImageProperty
Definition: vtkBalloonRepresentation.h:266
vtkBalloonRepresentation::TextActor
vtkActor2D * TextActor
Definition: vtkBalloonRepresentation.h:257
vtkBalloonRepresentation::SetBalloonLayoutToImageTop
void SetBalloonLayoutToImageTop()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:184
vtkBalloonRepresentation::Texture
vtkTexture * Texture
Definition: vtkBalloonRepresentation.h:261
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkBalloonRepresentation::BalloonText
char * BalloonText
Definition: vtkBalloonRepresentation.h:244
vtkBalloonRepresentation
represent the vtkBalloonWidget
Definition: vtkBalloonRepresentation.h:96
vtkBalloonRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Standard VTK methods.
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:143
vtkBalloonRepresentation::BalloonImage
vtkImageData * BalloonImage
Definition: vtkBalloonRepresentation.h:245
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:147
vtkBalloonRepresentation::TexturePoints
vtkPoints * TexturePoints
Definition: vtkBalloonRepresentation.h:263
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:149
vtkBalloonRepresentation::SetBalloonImage
virtual void SetBalloonImage(vtkImageData *img)
Specify/retrieve the image to display in the balloon.
vtkBalloonRepresentation::EndWidgetInteraction
void EndWidgetInteraction(double e[2]) override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkBalloonRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *viewport) override
Methods required by vtkProp superclass.
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:195
vtkBalloonRepresentation::SetBalloonLayoutToImageLeft
void SetBalloonLayoutToImageLeft()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:181
vtkBalloonRepresentation::_InteractionState
_InteractionState
State is either outside, or inside (on the text portion of the image).
Definition: vtkBalloonRepresentation.h:233
vtkBalloonRepresentation::TextureActor
vtkTexturedActor2D * TextureActor
Definition: vtkBalloonRepresentation.h:265
vtkBalloonRepresentation::BuildRepresentation
void BuildRepresentation() override
These are methods that satisfy vtkWidgetRepresentation's API.
vtkBalloonRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *w) override
Methods required by vtkProp superclass.
vtkBalloonRepresentation::SetTextProperty
virtual void SetTextProperty(vtkTextProperty *p)
Set/get the text property (relevant only if text is shown).
vtkBalloonRepresentation::SetBalloonLayoutToTextLeft
void SetBalloonLayoutToTextLeft()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:185
vtkBalloonRepresentation::FramePolygon
vtkCellArray * FramePolygon
Definition: vtkBalloonRepresentation.h:270
vtkBalloonRepresentation::SetBalloonLayoutToImageRight
void SetBalloonLayoutToImageRight()
Specify the layout of the image and text within the balloon.
Definition: vtkBalloonRepresentation.h:182
vtkBalloonRepresentation::TextVisible
int TextVisible
Definition: vtkBalloonRepresentation.h:277
vtkBalloonRepresentation::FrameMapper
vtkPolyDataMapper2D * FrameMapper
Definition: vtkBalloonRepresentation.h:272