00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00059 #ifndef __vtkBalloonRepresentation_h
00060 #define __vtkBalloonRepresentation_h
00061
00062 #include "vtkWidgetRepresentation.h"
00063
00064 class vtkTextMapper;
00065 class vtkTextActor;
00066 class vtkTextProperty;
00067 class vtkPoints;
00068 class vtkCellArray;
00069 class vtkPolyData;
00070 class vtkPolyDataMapper2D;
00071 class vtkActor2D;
00072 class vtkProperty2D;
00073 class vtkImageData;
00074 class vtkTexture;
00075 class vtkPoints;
00076 class vtkPolyData;
00077 class vtkPolyDataMapper2D;
00078 class vtkActor2D;
00079
00080 class VTK_WIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation
00081 {
00082 public:
00084 static vtkBalloonRepresentation *New();
00085
00087
00088 vtkTypeMacro(vtkBalloonRepresentation,vtkWidgetRepresentation);
00089 void PrintSelf(ostream& os, vtkIndent indent);
00091
00093
00094 virtual void SetBalloonImage(vtkImageData *img);
00095 vtkGetObjectMacro(BalloonImage,vtkImageData);
00097
00099
00100 vtkGetStringMacro(BalloonText);
00101 vtkSetStringMacro(BalloonText);
00103
00105
00109 vtkSetVector2Macro(ImageSize,int);
00110 vtkGetVector2Macro(ImageSize,int);
00112
00114
00115 virtual void SetTextProperty(vtkTextProperty *p);
00116 vtkGetObjectMacro(TextProperty,vtkTextProperty);
00118
00120
00122 virtual void SetFrameProperty(vtkProperty2D *p);
00123 vtkGetObjectMacro(FrameProperty,vtkProperty2D);
00125
00127
00128 virtual void SetImageProperty(vtkProperty2D *p);
00129 vtkGetObjectMacro(ImageProperty,vtkProperty2D);
00131
00132
00133 enum {ImageLeft=0,ImageRight,ImageBottom,ImageTop};
00134
00136
00142 vtkSetMacro(BalloonLayout,int);
00143 vtkGetMacro(BalloonLayout,int);
00144 void SetBalloonLayoutToImageLeft() {this->SetBalloonLayout(ImageLeft);}
00145 void SetBalloonLayoutToImageRight() {this->SetBalloonLayout(ImageRight);}
00146 void SetBalloonLayoutToImageBottom() {this->SetBalloonLayout(ImageBottom);}
00147 void SetBalloonLayoutToImageTop() {this->SetBalloonLayout(ImageTop);}
00148 void SetBalloonLayoutToTextLeft() {this->SetBalloonLayout(ImageRight);}
00149 void SetBalloonLayoutToTextRight() {this->SetBalloonLayout(ImageLeft);}
00150 void SetBalloonLayoutToTextTop() {this->SetBalloonLayout(ImageBottom);}
00151 void SetBalloonLayoutToTextBottom() {this->SetBalloonLayout(ImageTop);}
00153
00155
00159 vtkSetVector2Macro(Offset,int);
00160 vtkGetVector2Macro(Offset,int);
00162
00164
00166 vtkSetClampMacro(Padding,int,0,100);
00167 vtkGetMacro(Padding,int);
00169
00171
00172 virtual void StartWidgetInteraction(double e[2]);
00173 virtual void EndWidgetInteraction(double e[2]);
00174 virtual void BuildRepresentation();
00175 virtual int ComputeInteractionState(int X, int Y, int modify=0);
00177
00179
00180 virtual void ReleaseGraphicsResources(vtkWindow *w);
00181 virtual int RenderOverlay(vtkViewport *viewport);
00183
00186 enum _InteractionState {Outside=0, OnText, OnImage};
00187
00188 protected:
00189 vtkBalloonRepresentation();
00190 ~vtkBalloonRepresentation();
00191
00192
00193 char *BalloonText;
00194 vtkImageData *BalloonImage;
00195
00196
00197 int BalloonLayout;
00198
00199
00200 int Padding;
00201 int Offset[2];
00202 int ImageSize[2];
00203
00204
00205 vtkTextMapper *TextMapper;
00206 vtkActor2D *TextActor;
00207 vtkTextProperty *TextProperty;
00208
00209
00210 vtkTexture *Texture;
00211 vtkPolyData *TexturePolyData;
00212 vtkPoints *TexturePoints;
00213 vtkPolyDataMapper2D *TextureMapper;
00214 vtkActor2D *TextureActor;
00215 vtkProperty2D *ImageProperty;
00216
00217
00218 vtkPoints *FramePoints;
00219 vtkCellArray *FramePolygon;
00220 vtkPolyData *FramePolyData;
00221 vtkPolyDataMapper2D *FrameMapper;
00222 vtkActor2D *FrameActor;
00223 vtkProperty2D *FrameProperty;
00224
00225
00226 int TextVisible;
00227 int ImageVisible;
00228
00229
00230 void AdjustImageSize(double imageSize[2]);
00231 void ScaleImage(double imageSize[2],double scale);
00232
00233 private:
00234 vtkBalloonRepresentation(const vtkBalloonRepresentation&);
00235 void operator=(const vtkBalloonRepresentation&);
00236 };
00237
00238 #endif