00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00062 #ifndef __vtkViewport_h
00063 #define __vtkViewport_h
00064
00065 #include "vtkObject.h"
00066 #include "vtkPropCollection.h"
00067 #include "vtkActor2DCollection.h"
00068
00069 class vtkWindow;
00070 class vtkAssemblyPath;
00071
00072 class VTK_COMMON_EXPORT vtkViewport : public vtkObject
00073 {
00074 public:
00075 vtkTypeMacro(vtkViewport,vtkObject);
00076 void PrintSelf(ostream& os, vtkIndent indent);
00077
00080 void AddProp(vtkProp *);
00081
00083 vtkPropCollection *GetProps() {return this->Props;};
00084
00086 void RemoveProp(vtkProp *);
00087
00089
00092 void AddActor2D(vtkProp* p) {this->AddProp(p);};
00093 void RemoveActor2D(vtkProp* p);
00094 vtkActor2DCollection *GetActors2D();
00096
00098
00100 vtkSetVector3Macro(Background,float);
00101 vtkGetVectorMacro(Background,float,3);
00103
00105
00107 vtkSetVector2Macro(Aspect,float);
00108 vtkGetVectorMacro(Aspect,float,2);
00109 void ComputeAspect();
00111
00113
00116 vtkSetVector2Macro(PixelAspect,float);
00117 vtkGetVectorMacro(PixelAspect,float,2);
00119
00121
00124 vtkSetVector4Macro(Viewport,float);
00125 vtkGetVectorMacro(Viewport,float,4);
00127
00129
00132 vtkSetVector3Macro(DisplayPoint,float);
00133 vtkGetVectorMacro(DisplayPoint,float,3);
00134 void GetDisplayPoint(double *a)
00135 {
00136 a[0] = this->DisplayPoint[0];
00137 a[1] = this->DisplayPoint[1];
00138 a[2] = this->DisplayPoint[2];
00139 a[3] = 1.0;
00140 };
00142
00144
00147 vtkSetVector3Macro(ViewPoint,float);
00148 vtkGetVectorMacro(ViewPoint,float,3);
00150
00152
00154 vtkSetVector4Macro(WorldPoint,float);
00155 vtkGetVectorMacro(WorldPoint,float,4);
00156 void GetWorldPoint(double *a)
00157 {
00158 a[0] = this->WorldPoint[0];
00159 a[1] = this->WorldPoint[1];
00160 a[2] = this->WorldPoint[2];
00161 a[3] = this->WorldPoint[3];
00162 };
00164
00166 virtual float *GetCenter();
00167
00169 virtual int IsInViewport(int x,int y);
00170
00172 virtual vtkWindow *GetVTKWindow() = 0;
00173
00176 void SetStartRenderMethod(void (*f)(void *), void *arg);
00177
00180 void SetEndRenderMethod(void (*f)(void *), void *arg);
00181
00183 void SetStartRenderMethodArgDelete(void (*f)(void *));
00184
00186 void SetEndRenderMethodArgDelete(void (*f)(void *));
00187
00189 virtual void DisplayToView();
00190
00192 virtual void ViewToDisplay();
00193
00195 virtual void WorldToView();
00196
00198 virtual void ViewToWorld();
00199
00201 void DisplayToWorld() {this->DisplayToView(); this->ViewToWorld();};
00202
00204 void WorldToDisplay() {this->WorldToView(); this->ViewToDisplay();};
00205
00207
00212 virtual void LocalDisplayToDisplay(float &x, float &y);
00213 virtual void DisplayToNormalizedDisplay(float &u, float &v);
00214 virtual void NormalizedDisplayToViewport(float &x, float &y);
00215 virtual void ViewportToNormalizedViewport(float &u, float &v);
00216 virtual void NormalizedViewportToView(float &x, float &y, float &z);
00217 virtual void ViewToWorld(float &, float &, float &) {};
00218 virtual void DisplayToLocalDisplay(float &x, float &y);
00219 virtual void NormalizedDisplayToDisplay(float &u, float &v);
00220 virtual void ViewportToNormalizedDisplay(float &x, float &y);
00221 virtual void NormalizedViewportToViewport(float &u, float &v);
00222 virtual void ViewToNormalizedViewport(float &x, float &y, float &z);
00223 virtual void WorldToView(float &, float &, float &) {};
00225
00227
00230 int *GetSize();
00231 int *GetOrigin();
00233
00234
00235
00236
00242 virtual vtkAssemblyPath* PickProp(float selectionX, float selectionY) = 0;
00243
00245
00248 vtkAssemblyPath* PickPropFrom(float selectionX, float selectionY,
00249 vtkPropCollection*);
00251
00253
00255 vtkGetMacro(PickX, float);
00256 vtkGetMacro(PickY, float);
00257 vtkGetMacro(IsPicking, int);
00259
00261 virtual float GetPickedZ() = 0;
00262
00263 protected:
00264
00265
00266
00267 vtkViewport();
00268 ~vtkViewport();
00269
00270
00271
00272
00273 virtual void DevicePickRender() = 0;
00274
00275 virtual void StartPick(unsigned int pickFromSize) = 0;
00276
00277 virtual void UpdatePickId() = 0;
00278
00279 virtual void DonePick() = 0;
00280
00281 virtual unsigned int GetPickedId() = 0;
00282
00283
00284
00285
00286 vtkAssemblyPath* PickedProp;
00287 vtkPropCollection* PickFromProps;
00288
00289 int IsPicking;
00290 unsigned int CurrentPickId;
00291 float PickX;
00292 float PickY;
00293
00294
00295 vtkPropCollection *Props;
00296 vtkActor2DCollection *Actors2D;
00297 vtkWindow *VTKWindow;
00298 float Background[3];
00299 float Viewport[4];
00300 float Aspect[2];
00301 float PixelAspect[2];
00302 float Center[2];
00303
00304 unsigned long StartTag;
00305 unsigned long EndTag;
00306
00307 int Size[2];
00308 int Origin[2];
00309 float DisplayPoint[3];
00310 float ViewPoint[3];
00311 float WorldPoint[4];
00312
00313 private:
00314 vtkViewport(const vtkViewport&);
00315 void operator=(const vtkViewport&);
00316 };
00317
00318
00319
00320 #endif