VTK
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 =========================================================================*/
60 #ifndef vtkBalloonRepresentation_h
61 #define vtkBalloonRepresentation_h
62 
63 #include "vtkInteractionWidgetsModule.h" // For export macro
65 
66 class vtkTextMapper;
67 class vtkTextActor;
68 class vtkTextProperty;
69 class vtkPoints;
70 class vtkCellArray;
71 class vtkPolyData;
73 class vtkActor2D;
74 class vtkProperty2D;
75 class vtkImageData;
76 class vtkTexture;
77 class vtkPoints;
78 class vtkPolyData;
80 class vtkTexturedActor2D;
81 
82 class VTKINTERACTIONWIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
83 {
84 public:
88  static vtkBalloonRepresentation *New();
89 
91 
95  void PrintSelf(ostream& os, vtkIndent indent) override;
97 
99 
102  virtual void SetBalloonImage(vtkImageData *img);
103  vtkGetObjectMacro(BalloonImage,vtkImageData);
105 
107 
110  vtkGetStringMacro(BalloonText);
111  vtkSetStringMacro(BalloonText);
113 
115 
121  vtkSetVector2Macro(ImageSize,int);
122  vtkGetVector2Macro(ImageSize,int);
124 
126 
129  virtual void SetTextProperty(vtkTextProperty *p);
130  vtkGetObjectMacro(TextProperty,vtkTextProperty);
132 
134 
138  virtual void SetFrameProperty(vtkProperty2D *p);
139  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
141 
143 
146  virtual void SetImageProperty(vtkProperty2D *p);
147  vtkGetObjectMacro(ImageProperty,vtkProperty2D);
149 
150  enum {ImageLeft=0,ImageRight,ImageBottom,ImageTop};
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 
213  enum _InteractionState {Outside=0, OnText, OnImage};
214 
215 protected:
217  ~vtkBalloonRepresentation() override;
218 
219  // The balloon text and image
220  char *BalloonText;
222 
223  // The layout of the balloon
225 
226  // Controlling placement
227  int Padding;
228  int Offset[2];
229  int ImageSize[2];
230 
231  // Represent the text
235 
236  // Represent the image
243 
244  // The frame
251 
252  // Internal variable controlling rendering process
255 
256  // Helper methods
257  void AdjustImageSize(double imageSize[2]);
258  void ScaleImage(double imageSize[2],double scale);
259 
260 private:
262  void operator=(const vtkBalloonRepresentation&) = delete;
263 };
264 
265 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:39
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:136
vtkWidgetRepresentation.h
vtkBalloonRepresentation::SetBalloonLayoutToTextTop
void SetBalloonLayoutToTextTop()
Definition: vtkBalloonRepresentation.h:168
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:51
vtkBalloonRepresentation::TextMapper
vtkTextMapper * TextMapper
Definition: vtkBalloonRepresentation.h:232
vtkBalloonRepresentation::FrameActor
vtkActor2D * FrameActor
Definition: vtkBalloonRepresentation.h:249
vtkX3D::scale
Definition: vtkX3D.h:229
vtkWidgetRepresentation::EndWidgetInteraction
virtual void EndWidgetInteraction(double newEventPos[2])
Definition: vtkWidgetRepresentation.h:138
vtkTexturedActor2D
actor that draws 2D data with texture support
Definition: vtkTexturedActor2D.h:41
vtkBalloonRepresentation::FramePoints
vtkPoints * FramePoints
Definition: vtkBalloonRepresentation.h:245
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkWidgetRepresentation
abstract class defines interface between the widget and widget representation classes
Definition: vtkWidgetRepresentation.h:60
vtkBalloonRepresentation::FramePolyData
vtkPolyData * FramePolyData
Definition: vtkBalloonRepresentation.h:247
vtkBalloonRepresentation::Padding
int Padding
Definition: vtkBalloonRepresentation.h:227
vtkBalloonRepresentation::TextProperty
vtkTextProperty * TextProperty
Definition: vtkBalloonRepresentation.h:234
vtkBalloonRepresentation::TexturePolyData
vtkPolyData * TexturePolyData
Definition: vtkBalloonRepresentation.h:238
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkBalloonRepresentation::SetBalloonLayoutToImageBottom
void SetBalloonLayoutToImageBottom()
Definition: vtkBalloonRepresentation.h:164
vtkBalloonRepresentation::SetBalloonLayoutToTextBottom
void SetBalloonLayoutToTextBottom()
Definition: vtkBalloonRepresentation.h:169
vtkBalloonRepresentation::TextureMapper
vtkPolyDataMapper2D * TextureMapper
Definition: vtkBalloonRepresentation.h:240
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
vtkBalloonRepresentation::BalloonLayout
int BalloonLayout
Definition: vtkBalloonRepresentation.h:224
vtkWidgetRepresentation::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Definition: vtkWidgetRepresentation.h:220
vtkTexture
handles properties associated with a texture map
Definition: vtkTexture.h:71
vtkBalloonRepresentation::ImageVisible
int ImageVisible
Definition: vtkBalloonRepresentation.h:254
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:53
vtkBalloonRepresentation::FrameProperty
vtkProperty2D * FrameProperty
Definition: vtkBalloonRepresentation.h:250
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:45
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:56
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkBalloonRepresentation::SetBalloonLayoutToTextRight
void SetBalloonLayoutToTextRight()
Definition: vtkBalloonRepresentation.h:167
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:50
vtkBalloonRepresentation::ImageProperty
vtkProperty2D * ImageProperty
Definition: vtkBalloonRepresentation.h:242
vtkBalloonRepresentation::TextActor
vtkActor2D * TextActor
Definition: vtkBalloonRepresentation.h:233
vtkBalloonRepresentation::SetBalloonLayoutToImageTop
void SetBalloonLayoutToImageTop()
Definition: vtkBalloonRepresentation.h:165
vtkBalloonRepresentation::Texture
vtkTexture * Texture
Definition: vtkBalloonRepresentation.h:237
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkBalloonRepresentation::BalloonText
char * BalloonText
Definition: vtkBalloonRepresentation.h:220
vtkBalloonRepresentation
represent the vtkBalloonWidget
Definition: vtkBalloonRepresentation.h:82
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:39
vtkBalloonRepresentation::BalloonImage
vtkImageData * BalloonImage
Definition: vtkBalloonRepresentation.h:221
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:40
vtkBalloonRepresentation::TexturePoints
vtkPoints * TexturePoints
Definition: vtkBalloonRepresentation.h:239
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:45
vtkWidgetRepresentation::RenderOverlay
int RenderOverlay(vtkViewport *vtkNotUsed(viewport)) override
Definition: vtkWidgetRepresentation.h:221
vtkPolyData
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:85
vtkBalloonRepresentation::SetBalloonLayoutToImageLeft
void SetBalloonLayoutToImageLeft()
Definition: vtkBalloonRepresentation.h:162
vtkBalloonRepresentation::_InteractionState
_InteractionState
State is either outside, or inside (on the text portion of the image).
Definition: vtkBalloonRepresentation.h:213
vtkBalloonRepresentation::TextureActor
vtkTexturedActor2D * TextureActor
Definition: vtkBalloonRepresentation.h:241
vtkBalloonRepresentation::SetBalloonLayoutToTextLeft
void SetBalloonLayoutToTextLeft()
Definition: vtkBalloonRepresentation.h:166
vtkBalloonRepresentation::FramePolygon
vtkCellArray * FramePolygon
Definition: vtkBalloonRepresentation.h:246
vtkBalloonRepresentation::SetBalloonLayoutToImageRight
void SetBalloonLayoutToImageRight()
Definition: vtkBalloonRepresentation.h:163
vtkBalloonRepresentation::TextVisible
int TextVisible
Definition: vtkBalloonRepresentation.h:253
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkBalloonRepresentation::FrameMapper
vtkPolyDataMapper2D * FrameMapper
Definition: vtkBalloonRepresentation.h:248
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.