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 
63 
64 class vtkTextMapper;
65 class vtkTextActor;
66 class vtkTextProperty;
67 class vtkPoints;
68 class vtkCellArray;
69 class vtkPolyData;
71 class vtkActor2D;
72 class vtkProperty2D;
73 class vtkImageData;
74 class vtkTexture;
75 class vtkPoints;
76 class vtkPolyData;
78 class vtkActor2D;
79 
81 {
82 public:
84  static vtkBalloonRepresentation *New();
85 
87 
89  void PrintSelf(ostream& os, vtkIndent indent);
91 
93 
94  virtual void SetBalloonImage(vtkImageData *img);
95  vtkGetObjectMacro(BalloonImage,vtkImageData);
97 
99 
100  vtkGetStringMacro(BalloonText);
101  vtkSetStringMacro(BalloonText);
103 
105 
109  vtkSetVector2Macro(ImageSize,int);
110  vtkGetVector2Macro(ImageSize,int);
112 
114 
115  virtual void SetTextProperty(vtkTextProperty *p);
116  vtkGetObjectMacro(TextProperty,vtkTextProperty);
118 
120 
122  virtual void SetFrameProperty(vtkProperty2D *p);
123  vtkGetObjectMacro(FrameProperty,vtkProperty2D);
125 
127 
128  virtual void SetImageProperty(vtkProperty2D *p);
129  vtkGetObjectMacro(ImageProperty,vtkProperty2D);
131 
132 //BTX
133  enum {ImageLeft=0,ImageRight,ImageBottom,ImageTop};
134 //ETX
136 
142  vtkSetMacro(BalloonLayout,int);
143  vtkGetMacro(BalloonLayout,int);
144  void SetBalloonLayoutToImageLeft() {this->SetBalloonLayout(ImageLeft);}
145  void SetBalloonLayoutToImageRight() {this->SetBalloonLayout(ImageRight);}
146  void SetBalloonLayoutToImageBottom() {this->SetBalloonLayout(ImageBottom);}
147  void SetBalloonLayoutToImageTop() {this->SetBalloonLayout(ImageTop);}
148  void SetBalloonLayoutToTextLeft() {this->SetBalloonLayout(ImageRight);}
149  void SetBalloonLayoutToTextRight() {this->SetBalloonLayout(ImageLeft);}
150  void SetBalloonLayoutToTextTop() {this->SetBalloonLayout(ImageBottom);}
151  void SetBalloonLayoutToTextBottom() {this->SetBalloonLayout(ImageTop);}
153 
155 
159  vtkSetVector2Macro(Offset,int);
160  vtkGetVector2Macro(Offset,int);
162 
164 
166  vtkSetClampMacro(Padding,int,0,100);
167  vtkGetMacro(Padding,int);
169 
171 
172  virtual void StartWidgetInteraction(double e[2]);
173  virtual void EndWidgetInteraction(double e[2]);
174  virtual void BuildRepresentation();
175  virtual int ComputeInteractionState(int X, int Y, int modify=0);
177 
179 
180  virtual void ReleaseGraphicsResources(vtkWindow *w);
181  virtual int RenderOverlay(vtkViewport *viewport);
183 
186  enum _InteractionState {Outside=0, OnText, OnImage};
187 
188 protected:
191 
192  // The balloon text and image
193  char *BalloonText;
195 
196  // The layout of the balloon
198 
199  // Controlling placement
200  int Padding;
201  int Offset[2];
202  int ImageSize[2];
203 
204  // Represent the text
208 
209  // Represent the image
216 
217  // The frame
224 
225  // Internal variable controlling rendering process
228 
229  // Helper methods
230  void AdjustImageSize(double imageSize[2]);
231  void ScaleImage(double imageSize[2],double scale);
232 
233 private:
234  vtkBalloonRepresentation(const vtkBalloonRepresentation&); //Not implemented
235  void operator=(const vtkBalloonRepresentation&); //Not implemented
236 };
237 
238 #endif