VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkBalloonRepresentation.h,v $ 00005 00006 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen 00007 All rights reserved. 00008 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00009 00010 This software is distributed WITHOUT ANY WARRANTY; without even 00011 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00012 PURPOSE. See the above copyright notice for more information. 00013 00014 =========================================================================*/ 00056 #ifndef __vtkBalloonRepresentation_h 00057 #define __vtkBalloonRepresentation_h 00058 00059 #include "vtkWidgetRepresentation.h" 00060 00061 class vtkTextMapper; 00062 class vtkTextActor; 00063 class vtkTextProperty; 00064 class vtkPoints; 00065 class vtkCellArray; 00066 class vtkPolyData; 00067 class vtkPolyDataMapper2D; 00068 class vtkActor2D; 00069 class vtkProperty2D; 00070 class vtkImageData; 00071 class vtkTexture; 00072 class vtkPoints; 00073 class vtkPolyData; 00074 class vtkPolyDataMapper2D; 00075 class vtkActor2D; 00076 00077 class VTK_WIDGETS_EXPORT vtkBalloonRepresentation : public vtkWidgetRepresentation 00078 { 00079 public: 00081 static vtkBalloonRepresentation *New(); 00082 00084 00085 vtkTypeRevisionMacro(vtkBalloonRepresentation,vtkWidgetRepresentation); 00086 void PrintSelf(ostream& os, vtkIndent indent); 00088 00090 00091 virtual void SetBalloonImage(vtkImageData *img); 00092 vtkGetObjectMacro(BalloonImage,vtkImageData); 00094 00096 00097 vtkGetStringMacro(BalloonText); 00098 vtkSetStringMacro(BalloonText); 00100 00102 00106 vtkSetVector2Macro(ImageSize,int); 00107 vtkGetVector2Macro(ImageSize,int); 00109 00111 00112 virtual void SetTextProperty(vtkTextProperty *p); 00113 vtkGetObjectMacro(TextProperty,vtkTextProperty); 00115 00117 00119 virtual void SetFrameProperty(vtkProperty2D *p); 00120 vtkGetObjectMacro(FrameProperty,vtkProperty2D); 00122 00124 00125 virtual void SetImageProperty(vtkProperty2D *p); 00126 vtkGetObjectMacro(ImageProperty,vtkProperty2D); 00128 00129 //BTX 00130 enum {ImageLeft=0,ImageRight,ImageBottom,ImageTop}; 00131 //ETX 00133 00139 vtkSetMacro(BalloonLayout,int); 00140 vtkGetMacro(BalloonLayout,int); 00141 void SetBalloonLayoutToImageLeft() {this->SetBalloonLayout(ImageLeft);} 00142 void SetBalloonLayoutToImageRight() {this->SetBalloonLayout(ImageRight);} 00143 void SetBalloonLayoutToImageBottom() {this->SetBalloonLayout(ImageBottom);} 00144 void SetBalloonLayoutToImageTop() {this->SetBalloonLayout(ImageTop);} 00145 void SetBalloonLayoutToTextLeft() {this->SetBalloonLayout(ImageRight);} 00146 void SetBalloonLayoutToTextRight() {this->SetBalloonLayout(ImageLeft);} 00147 void SetBalloonLayoutToTextTop() {this->SetBalloonLayout(ImageBottom);} 00148 void SetBalloonLayoutToTextBottom() {this->SetBalloonLayout(ImageTop);} 00150 00152 00156 vtkSetVector2Macro(Offset,int); 00157 vtkGetVector2Macro(Offset,int); 00159 00161 00163 vtkSetClampMacro(Padding,int,0,100); 00164 vtkGetMacro(Padding,int); 00166 00168 00169 virtual void StartWidgetInteraction(double e[2]); 00170 virtual void EndWidgetInteraction(double e[2]); 00171 virtual void BuildRepresentation(); 00173 00175 00176 virtual void ReleaseGraphicsResources(vtkWindow *w); 00177 virtual int RenderOverlay(vtkViewport *viewport); 00179 00180 protected: 00181 vtkBalloonRepresentation(); 00182 ~vtkBalloonRepresentation(); 00183 00184 // The balloon text and image 00185 char *BalloonText; 00186 vtkImageData *BalloonImage; 00187 00188 // The layout of the balloon 00189 int BalloonLayout; 00190 00191 // Controlling placement 00192 int Padding; 00193 int Offset[2]; 00194 int ImageSize[2]; 00195 00196 // Represent the text 00197 vtkTextMapper *TextMapper; 00198 vtkActor2D *TextActor; 00199 vtkTextProperty *TextProperty; 00200 00201 // Represent the image 00202 vtkTexture *Texture; 00203 vtkPolyData *TexturePolyData; 00204 vtkPoints *TexturePoints; 00205 vtkPolyDataMapper2D *TextureMapper; 00206 vtkActor2D *TextureActor; 00207 vtkProperty2D *ImageProperty; 00208 00209 // The frame 00210 vtkPoints *FramePoints; 00211 vtkCellArray *FramePolygon; 00212 vtkPolyData *FramePolyData; 00213 vtkPolyDataMapper2D *FrameMapper; 00214 vtkActor2D *FrameActor; 00215 vtkProperty2D *FrameProperty; 00216 00217 // Internal variable controlling rendering process 00218 int TextVisible; 00219 int ImageVisible; 00220 00221 // Helper methods 00222 void AdjustImageSize(double imageSize[2]); 00223 void ScaleImage(double imageSize[2],double scale); 00224 00225 private: 00226 vtkBalloonRepresentation(const vtkBalloonRepresentation&); //Not implemented 00227 void operator=(const vtkBalloonRepresentation&); //Not implemented 00228 }; 00229 00230 #endif