00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00044 #ifndef __vtkViewport_h
00045 #define __vtkViewport_h
00046
00047 #include "vtkObject.h"
00048
00049 class vtkActor2DCollection;
00050 class vtkAssemblyPath;
00051 class vtkProp;
00052 class vtkPropCollection;
00053 class vtkWindow;
00054
00055 class VTK_FILTERING_EXPORT vtkViewport : public vtkObject
00056 {
00057 public:
00058 vtkTypeRevisionMacro(vtkViewport,vtkObject);
00059 void PrintSelf(ostream& os, vtkIndent indent);
00060
00063 void AddProp(vtkProp *);
00064
00066 vtkPropCollection *GetProps() {return this->Props;};
00067
00069 int HasProp(vtkProp *);
00070
00072 void RemoveProp(vtkProp *);
00073
00075 void RemoveAllProps(void);
00076
00078
00081 void AddActor2D(vtkProp* p) {this->AddProp(p);};
00082 void RemoveActor2D(vtkProp* p);
00083 vtkActor2DCollection *GetActors2D();
00085
00087
00089 vtkSetVector3Macro(Background,double);
00090 vtkGetVector3Macro(Background,double);
00092
00094
00096 vtkSetVector2Macro(Aspect,double);
00097 vtkGetVectorMacro(Aspect,double,2);
00098 virtual void ComputeAspect();
00100
00102
00105 vtkSetVector2Macro(PixelAspect,double);
00106 vtkGetVectorMacro(PixelAspect,double,2);
00108
00110
00113 vtkSetVector4Macro(Viewport,double);
00114 vtkGetVectorMacro(Viewport,double,4);
00116
00118
00121 vtkSetVector3Macro(DisplayPoint,double);
00122 vtkGetVectorMacro(DisplayPoint,double,3);
00124
00126
00129 vtkSetVector3Macro(ViewPoint,double);
00130 vtkGetVectorMacro(ViewPoint,double,3);
00132
00134
00136 vtkSetVector4Macro(WorldPoint,double);
00137 vtkGetVectorMacro(WorldPoint,double,4);
00139
00141 virtual double *GetCenter();
00142
00144 virtual int IsInViewport(int x,int y);
00145
00147 virtual vtkWindow *GetVTKWindow() = 0;
00148
00150 virtual void DisplayToView();
00151
00153 virtual void ViewToDisplay();
00154
00156 virtual void WorldToView();
00157
00159 virtual void ViewToWorld();
00160
00162 void DisplayToWorld() {this->DisplayToView(); this->ViewToWorld();};
00163
00165 void WorldToDisplay() {this->WorldToView(); this->ViewToDisplay();};
00166
00168
00173 virtual void LocalDisplayToDisplay(double &x, double &y);
00174 virtual void DisplayToNormalizedDisplay(double &u, double &v);
00175 virtual void NormalizedDisplayToViewport(double &x, double &y);
00176 virtual void ViewportToNormalizedViewport(double &u, double &v);
00177 virtual void NormalizedViewportToView(double &x, double &y, double &z);
00178 virtual void ViewToWorld(double &, double &, double &) {};
00179 virtual void DisplayToLocalDisplay(double &x, double &y);
00180 virtual void NormalizedDisplayToDisplay(double &u, double &v);
00181 virtual void ViewportToNormalizedDisplay(double &x, double &y);
00182 virtual void NormalizedViewportToViewport(double &u, double &v);
00183 virtual void ViewToNormalizedViewport(double &x, double &y, double &z);
00184 virtual void WorldToView(double &, double &, double &) {};
00186
00188
00191 int *GetSize();
00192 int *GetOrigin();
00193 void GetTiledSize(int *width, int *height);
00194 void GetTiledSizeAndOrigin(int *width, int *height,
00195 int *lowerLeftX, int *lowerLeftY);
00197
00198
00199
00200
00206 virtual vtkAssemblyPath* PickProp(double selectionX, double selectionY) = 0;
00207
00209
00212 vtkAssemblyPath* PickPropFrom(double selectionX, double selectionY,
00213 vtkPropCollection*);
00215
00217
00219 vtkGetMacro(PickX, double);
00220 vtkGetMacro(PickY, double);
00221 vtkGetMacro(IsPicking, int);
00223
00225 virtual double GetPickedZ() = 0;
00226
00227 protected:
00228
00229
00230
00231 vtkViewport();
00232 ~vtkViewport();
00233
00234
00235
00236
00237 virtual void DevicePickRender() = 0;
00238
00239 virtual void StartPick(unsigned int pickFromSize) = 0;
00240
00241 virtual void UpdatePickId() = 0;
00242
00243 virtual void DonePick() = 0;
00244
00245 virtual unsigned int GetPickedId() = 0;
00246
00247
00248
00249
00250 vtkAssemblyPath* PickedProp;
00251 vtkPropCollection* PickFromProps;
00252
00253 int IsPicking;
00254 unsigned int CurrentPickId;
00255 double PickX;
00256 double PickY;
00257
00258
00259 vtkPropCollection *Props;
00260 vtkActor2DCollection *Actors2D;
00261 vtkWindow *VTKWindow;
00262 double Background[3];
00263 double Viewport[4];
00264 double Aspect[2];
00265 double PixelAspect[2];
00266 double Center[2];
00267
00268 int Size[2];
00269 int Origin[2];
00270 double DisplayPoint[3];
00271 double ViewPoint[3];
00272 double WorldPoint[4];
00273
00274 private:
00275 vtkViewport(const vtkViewport&);
00276 void operator=(const vtkViewport&);
00277 };
00278
00279
00280
00281 #endif