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 =========================================================================*/
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 {ImageLeft=0,ImageRight,ImageBottom,ImageTop};
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 
207  enum _InteractionState {Outside=0, OnText, OnImage};
208 
209 protected:
211  ~vtkBalloonRepresentation() override;
212 
213  // The balloon text and image
214  char *BalloonText;
216 
217  // The layout of the balloon
219 
220  // Controlling placement
221  int Padding;
222  int Offset[2];
223  int ImageSize[2];
224 
225  // Represent the text
229 
230  // Represent the image
237 
238  // The frame
245 
246  // Internal variable controlling rendering process
249 
250  // Helper methods
251  void AdjustImageSize(double imageSize[2]);
252  void ScaleImage(double imageSize[2],double scale);
253 
254 private:
256  void operator=(const vtkBalloonRepresentation&) = delete;
257 };
258 
259 #endif
vtkPoints
represent and manipulate 3D points
Definition: vtkPoints.h:33
vtkWidgetRepresentation::StartWidgetInteraction
virtual void StartWidgetInteraction(double eventPos[2])
Definition: vtkWidgetRepresentation.h:136
vtkWidgetRepresentation.h
vtkBalloonRepresentation::SetBalloonLayoutToTextTop
void SetBalloonLayoutToTextTop()
Definition: vtkBalloonRepresentation.h:162
vtkPolyDataMapper2D
draw vtkPolyData onto the image plane
Definition: vtkPolyDataMapper2D.h:45
vtkBalloonRepresentation::TextMapper
vtkTextMapper * TextMapper
Definition: vtkBalloonRepresentation.h:226
vtkBalloonRepresentation::FrameActor
vtkActor2D * FrameActor
Definition: vtkBalloonRepresentation.h:243
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:38
vtkBalloonRepresentation::FramePoints
vtkPoints * FramePoints
Definition: vtkBalloonRepresentation.h:239
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:241
vtkBalloonRepresentation::Padding
int Padding
Definition: vtkBalloonRepresentation.h:221
vtkBalloonRepresentation::TextProperty
vtkTextProperty * TextProperty
Definition: vtkBalloonRepresentation.h:228
vtkBalloonRepresentation::TexturePolyData
vtkPolyData * TexturePolyData
Definition: vtkBalloonRepresentation.h:232
vtkWidgetRepresentation::BuildRepresentation
virtual void BuildRepresentation()=0
vtkBalloonRepresentation::SetBalloonLayoutToImageBottom
void SetBalloonLayoutToImageBottom()
Definition: vtkBalloonRepresentation.h:158
vtkBalloonRepresentation::SetBalloonLayoutToTextBottom
void SetBalloonLayoutToTextBottom()
Definition: vtkBalloonRepresentation.h:163
vtkBalloonRepresentation::TextureMapper
vtkPolyDataMapper2D * TextureMapper
Definition: vtkBalloonRepresentation.h:234
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
vtkBalloonRepresentation::BalloonLayout
int BalloonLayout
Definition: vtkBalloonRepresentation.h:218
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:65
vtkBalloonRepresentation::ImageVisible
int ImageVisible
Definition: vtkBalloonRepresentation.h:248
vtkTextMapper
2D text annotation
Definition: vtkTextMapper.h:47
vtkBalloonRepresentation::FrameProperty
vtkProperty2D * FrameProperty
Definition: vtkBalloonRepresentation.h:244
vtkImageData
topologically and geometrically regular array of data
Definition: vtkImageData.h:39
vtkTextActor
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:50
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkBalloonRepresentation::SetBalloonLayoutToTextRight
void SetBalloonLayoutToTextRight()
Definition: vtkBalloonRepresentation.h:161
vtkCellArray
object to represent cell connectivity
Definition: vtkCellArray.h:44
vtkBalloonRepresentation::ImageProperty
vtkProperty2D * ImageProperty
Definition: vtkBalloonRepresentation.h:236
vtkBalloonRepresentation::TextActor
vtkActor2D * TextActor
Definition: vtkBalloonRepresentation.h:227
vtkBalloonRepresentation::SetBalloonLayoutToImageTop
void SetBalloonLayoutToImageTop()
Definition: vtkBalloonRepresentation.h:159
vtkBalloonRepresentation::Texture
vtkTexture * Texture
Definition: vtkBalloonRepresentation.h:231
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:44
vtkBalloonRepresentation::BalloonText
char * BalloonText
Definition: vtkBalloonRepresentation.h:214
vtkBalloonRepresentation
represent the vtkBalloonWidget
Definition: vtkBalloonRepresentation.h:76
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:33
vtkBalloonRepresentation::BalloonImage
vtkImageData * BalloonImage
Definition: vtkBalloonRepresentation.h:215
vtkProperty2D
represent surface properties of a 2D image
Definition: vtkProperty2D.h:37
vtkBalloonRepresentation::TexturePoints
vtkPoints * TexturePoints
Definition: vtkBalloonRepresentation.h:233
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:39
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:79
vtkBalloonRepresentation::SetBalloonLayoutToImageLeft
void SetBalloonLayoutToImageLeft()
Definition: vtkBalloonRepresentation.h:156
vtkBalloonRepresentation::_InteractionState
_InteractionState
State is either outside, or inside (on the text portion of the image).
Definition: vtkBalloonRepresentation.h:207
vtkBalloonRepresentation::TextureActor
vtkTexturedActor2D * TextureActor
Definition: vtkBalloonRepresentation.h:235
vtkBalloonRepresentation::SetBalloonLayoutToTextLeft
void SetBalloonLayoutToTextLeft()
Definition: vtkBalloonRepresentation.h:160
vtkBalloonRepresentation::FramePolygon
vtkCellArray * FramePolygon
Definition: vtkBalloonRepresentation.h:240
vtkBalloonRepresentation::SetBalloonLayoutToImageRight
void SetBalloonLayoutToImageRight()
Definition: vtkBalloonRepresentation.h:157
vtkBalloonRepresentation::TextVisible
int TextVisible
Definition: vtkBalloonRepresentation.h:247
vtkWidgetRepresentation::ComputeInteractionState
virtual int ComputeInteractionState(int X, int Y, int modify=0)
vtkBalloonRepresentation::FrameMapper
vtkPolyDataMapper2D * FrameMapper
Definition: vtkBalloonRepresentation.h:242
vtkWidgetRepresentation::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.