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 =========================================================================*/
59 #ifndef vtkBalloonRepresentation_h
60 #define vtkBalloonRepresentation_h
61 
62 #include "vtkInteractionWidgetsModule.h" // For export macro
64 
65 class vtkTextMapper;
66 class vtkTextActor;
67 class vtkTextProperty;
68 class vtkPoints;
69 class vtkCellArray;
70 class vtkPolyData;
72 class vtkActor2D;
73 class vtkProperty2D;
74 class vtkImageData;
75 class vtkTexture;
76 class vtkPoints;
77 class vtkPolyData;
79 class vtkActor2D;
80 
82 {
83 public:
85  static vtkBalloonRepresentation *New();
86 
88 
90  void PrintSelf(ostream& os, vtkIndent indent);
92 
94 
95  virtual void SetBalloonImage(vtkImageData *img);
96  vtkGetObjectMacro(BalloonImage,vtkImageData);
98 
100 
101  vtkGetStringMacro(BalloonText);
102  vtkSetStringMacro(BalloonText);
104 
106 
110  vtkSetVector2Macro(ImageSize,int);
111  vtkGetVector2Macro(ImageSize,int);
113 
115 
116  virtual void SetTextProperty(vtkTextProperty *p);
117  vtkGetObjectMacro(TextProperty,vtkTextProperty);
119 
121 
123  virtual void SetFrameProperty(vtkProperty2D *p);
124  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
126 
128 
129  virtual void SetImageProperty(vtkProperty2D *p);
130  vtkGetObjectMacro(ImageProperty,vtkProperty2D);
132 
133 //BTX
134  enum {ImageLeft=0,ImageRight,ImageBottom,ImageTop};
135 //ETX
137 
143  vtkSetMacro(BalloonLayout,int);
144  vtkGetMacro(BalloonLayout,int);
145  void SetBalloonLayoutToImageLeft() {this->SetBalloonLayout(ImageLeft);}
146  void SetBalloonLayoutToImageRight() {this->SetBalloonLayout(ImageRight);}
147  void SetBalloonLayoutToImageBottom() {this->SetBalloonLayout(ImageBottom);}
148  void SetBalloonLayoutToImageTop() {this->SetBalloonLayout(ImageTop);}
149  void SetBalloonLayoutToTextLeft() {this->SetBalloonLayout(ImageRight);}
150  void SetBalloonLayoutToTextRight() {this->SetBalloonLayout(ImageLeft);}
151  void SetBalloonLayoutToTextTop() {this->SetBalloonLayout(ImageBottom);}
152  void SetBalloonLayoutToTextBottom() {this->SetBalloonLayout(ImageTop);}
154 
156 
160  vtkSetVector2Macro(Offset,int);
161  vtkGetVector2Macro(Offset,int);
163 
165 
167  vtkSetClampMacro(Padding,int,0,100);
168  vtkGetMacro(Padding,int);
170 
172 
173  virtual void StartWidgetInteraction(double e[2]);
174  virtual void EndWidgetInteraction(double e[2]);
175  virtual void BuildRepresentation();
176  virtual int ComputeInteractionState(int X, int Y, int modify=0);
178 
180 
181  virtual void ReleaseGraphicsResources(vtkWindow *w);
182  virtual int RenderOverlay(vtkViewport *viewport);
184 
187  enum _InteractionState {Outside=0, OnText, OnImage};
188 
189 protected:
192 
193  // The balloon text and image
194  char *BalloonText;
196 
197  // The layout of the balloon
199 
200  // Controlling placement
201  int Padding;
202  int Offset[2];
203  int ImageSize[2];
204 
205  // Represent the text
209 
210  // Represent the image
217 
218  // The frame
225 
226  // Internal variable controlling rendering process
229 
230  // Helper methods
231  void AdjustImageSize(double imageSize[2]);
232  void ScaleImage(double imageSize[2],double scale);
233 
234 private:
235  vtkBalloonRepresentation(const vtkBalloonRepresentation&); //Not implemented
236  void operator=(const vtkBalloonRepresentation&); //Not implemented
237 };
238 
239 #endif
virtual int RenderOverlay(vtkViewport *vtkNotUsed(viewport))
virtual void EndWidgetInteraction(double newEventPos[2])
virtual int ComputeInteractionState(int X, int Y, int modify=0)
abstract specification for Viewports
Definition: vtkViewport.h:46
virtual void StartWidgetInteraction(double eventPos[2])
a actor that draws 2D data
Definition: vtkActor2D.h:44
concrete dataset represents vertices, lines, polygons, and triangle strips
Definition: vtkPolyData.h:83
virtual void ReleaseGraphicsResources(vtkWindow *)
abstract class defines interface between the widget and widget representation classes ...
virtual void BuildRepresentation()=0
2D text annotation
Definition: vtkTextMapper.h:52
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
#define VTKINTERACTIONWIDGETS_EXPORT
An actor that displays text. Scaled or unscaled.
Definition: vtkTextActor.h:54
a simple class to control print indentation
Definition: vtkIndent.h:38
topologically and geometrically regular array of data
Definition: vtkImageData.h:44
handles properties associated with a texture map
Definition: vtkTexture.h:69
vtkPolyDataMapper2D * TextureMapper
represent text properties.
represent the vtkBalloonWidget
object to represent cell connectivity
Definition: vtkCellArray.h:49
represent surface properties of a 2D image
Definition: vtkProperty2D.h:39
void PrintSelf(ostream &os, vtkIndent indent)
static vtkObject * New()
vtkPolyDataMapper2D * FrameMapper
draw vtkPolyData onto the image plane
represent and manipulate 3D points
Definition: vtkPoints.h:38