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
00058 #ifndef __vtkViewport_h
00059 #define __vtkViewport_h
00060
00061 #include "vtkObject.h"
00062 #include "vtkPropCollection.h"
00063 #include "vtkActor2DCollection.h"
00064
00065 class vtkWindow;
00066 class vtkAssemblyPath;
00067
00068 class VTK_EXPORT vtkViewport : public vtkObject
00069 {
00070 public:
00071 vtkTypeMacro(vtkViewport,vtkObject);
00072 void PrintSelf(ostream& os, vtkIndent indent);
00073
00076 void AddProp(vtkProp *);
00077
00079 vtkPropCollection *GetProps() {return this->Props;};
00080
00082 void RemoveProp(vtkProp *);
00083
00087 void AddActor2D(vtkProp* p) {this->AddProp(p);};
00088 void RemoveActor2D(vtkProp* p);
00089 vtkActor2DCollection *GetActors2D();
00090
00093 vtkSetVector3Macro(Background,float);
00094 vtkGetVectorMacro(Background,float,3);
00095
00098 vtkSetVector2Macro(Aspect,float);
00099 vtkGetVectorMacro(Aspect,float,2);
00100 void ComputeAspect();
00101
00105 vtkSetVector4Macro(Viewport,float);
00106 vtkGetVectorMacro(Viewport,float,4);
00107
00111 vtkSetVector3Macro(DisplayPoint,float);
00112 vtkGetVectorMacro(DisplayPoint,float,3);
00113 void GetDisplayPoint(double *a)
00114 {
00115 a[0] = this->DisplayPoint[0];
00116 a[1] = this->DisplayPoint[1];
00117 a[2] = this->DisplayPoint[2];
00118 a[3] = 1.0;
00119 };
00120
00124 vtkSetVector3Macro(ViewPoint,float);
00125 vtkGetVectorMacro(ViewPoint,float,3);
00126
00129 vtkSetVector4Macro(WorldPoint,float);
00130 vtkGetVectorMacro(WorldPoint,float,4);
00131 void GetWorldPoint(double *a)
00132 {
00133 a[0] = this->WorldPoint[0];
00134 a[1] = this->WorldPoint[1];
00135 a[2] = this->WorldPoint[2];
00136 a[3] = this->WorldPoint[3];
00137 };
00138
00140 virtual float *GetCenter();
00141
00143 virtual int IsInViewport(int x,int y);
00144
00146 virtual vtkWindow *GetVTKWindow() = 0;
00147
00150 void SetStartRenderMethod(void (*f)(void *), void *arg);
00151
00154 void SetEndRenderMethod(void (*f)(void *), void *arg);
00155
00157 void SetStartRenderMethodArgDelete(void (*f)(void *));
00158
00160 void SetEndRenderMethodArgDelete(void (*f)(void *));
00161
00163 virtual void DisplayToView();
00164
00166 virtual void ViewToDisplay();
00167
00169 virtual void WorldToView();
00170
00172 virtual void ViewToWorld();
00173
00175 void DisplayToWorld() {this->DisplayToView(); this->ViewToWorld();};
00176
00178 void WorldToDisplay() {this->WorldToView(); this->ViewToDisplay();};
00179
00185 virtual void LocalDisplayToDisplay(float &x, float &y);
00186 virtual void DisplayToNormalizedDisplay(float &u, float &v);
00187 virtual void NormalizedDisplayToViewport(float &x, float &y);
00188 virtual void ViewportToNormalizedViewport(float &u, float &v);
00189 virtual void NormalizedViewportToView(float &x, float &y, float &z);
00190 virtual void ViewToWorld(float &, float &, float &) {};
00191 virtual void DisplayToLocalDisplay(float &x, float &y);
00192 virtual void NormalizedDisplayToDisplay(float &u, float &v);
00193 virtual void ViewportToNormalizedDisplay(float &x, float &y);
00194 virtual void NormalizedViewportToViewport(float &u, float &v);
00195 virtual void ViewToNormalizedViewport(float &x, float &y, float &z);
00196 virtual void WorldToView(float &, float &, float &) {};
00197
00201 int *GetSize();
00202 int *GetOrigin();
00203
00204
00205
00206
00212 virtual vtkAssemblyPath* PickProp(float selectionX, float selectionY) = 0;
00213
00217 vtkAssemblyPath* PickPropFrom(float selectionX, float selectionY,
00218 vtkPropCollection*);
00219
00222 vtkGetMacro(PickX, float);
00223 vtkGetMacro(PickY, float);
00224 vtkGetMacro(IsPicking, int);
00225
00227 virtual float GetPickedZ() = 0;
00228
00229 protected:
00230
00231
00232
00233 vtkViewport();
00234 ~vtkViewport();
00235 vtkViewport(const vtkViewport&) {};
00236 void operator=(const vtkViewport&) {};
00237
00238
00239
00240
00241 virtual void DevicePickRender() = 0;
00242
00243 virtual void StartPick(unsigned int pickFromSize) = 0;
00244
00245 virtual void UpdatePickId() = 0;
00246
00247 virtual void DonePick() = 0;
00248
00249 virtual unsigned int GetPickedId() = 0;
00250
00251
00252
00253
00254 vtkAssemblyPath* PickedProp;
00255 vtkPropCollection* PickFromProps;
00256
00257 int IsPicking;
00258 unsigned int CurrentPickId;
00259 float PickX;
00260 float PickY;
00261
00262
00263 vtkPropCollection *Props;
00264 vtkActor2DCollection *Actors2D;
00265 vtkWindow *VTKWindow;
00266 float Background[3];
00267 float Viewport[4];
00268 float Aspect[2];
00269 float Center[2];
00270
00271 unsigned long StartTag;
00272 unsigned long EndTag;
00273
00274 int Size[2];
00275 int Origin[2];
00276 float DisplayPoint[3];
00277 float ViewPoint[3];
00278 float WorldPoint[4];
00279
00280 };
00281
00282
00283
00284 #endif