00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00038
#ifndef __vtkViewport_h
00039
#define __vtkViewport_h
00040
00041
#include "vtkObject.h"
00042
00043
class vtkActor2DCollection;
00044
class vtkAssemblyPath;
00045
class vtkProp;
00046
class vtkPropCollection;
00047
class vtkWindow;
00048
00049 class VTK_COMMON_EXPORT vtkViewport :
public vtkObject
00050 {
00051
public:
00052 vtkTypeRevisionMacro(vtkViewport,
vtkObject);
00053
void PrintSelf(ostream& os,
vtkIndent indent);
00054
00057
void AddProp(
vtkProp *);
00058
00060 vtkPropCollection *GetProps() {
return this->Props;};
00061
00063
int HasProp(
vtkProp *);
00064
00066
void RemoveProp(
vtkProp *);
00067
00069
void RemoveAllProps(
void);
00070
00072
00075 void AddActor2D(
vtkProp* p) {this->AddProp(p);};
00076
void RemoveActor2D(
vtkProp* p);
00077
vtkActor2DCollection *GetActors2D();
00079
00081
00083 vtkSetVector3Macro(Background,
float);
00084 vtkGetVectorMacro(Background,
float,3);
00086
00088
00090 vtkSetVector2Macro(Aspect,
float);
00091 vtkGetVectorMacro(Aspect,
float,2);
00092
void ComputeAspect();
00094
00096
00099 vtkSetVector2Macro(PixelAspect,
float);
00100 vtkGetVectorMacro(PixelAspect,
float,2);
00102
00104
00107 vtkSetVector4Macro(Viewport,
float);
00108 vtkGetVectorMacro(Viewport,
float,4);
00110
00112
00115 vtkSetVector3Macro(DisplayPoint,
float);
00116 vtkGetVectorMacro(DisplayPoint,
float,3);
00117 void GetDisplayPoint(
double a[3])
00118 {
00119 a[0] = this->DisplayPoint[0];
00120 a[1] = this->DisplayPoint[1];
00121 a[2] = this->DisplayPoint[2];
00122 };
00124
00126
00129 vtkSetVector3Macro(ViewPoint,
float);
00130 vtkGetVectorMacro(ViewPoint,
float,3);
00132
00134
00136 vtkSetVector4Macro(WorldPoint,
float);
00137 vtkGetVectorMacro(WorldPoint,
float,4);
00138 void GetWorldPoint(
double a[4])
00139 {
00140 a[0] = this->WorldPoint[0];
00141 a[1] = this->WorldPoint[1];
00142 a[2] = this->WorldPoint[2];
00143 a[3] = this->WorldPoint[3];
00144 };
00146
00148
virtual float *GetCenter();
00149
00151
virtual int IsInViewport(
int x,
int y);
00152
00154
virtual vtkWindow *GetVTKWindow() = 0;
00155
00158
void SetStartRenderMethod(
void (*f)(
void *),
void *arg);
00159
00162
void SetEndRenderMethod(
void (*f)(
void *),
void *arg);
00163
00165
void SetStartRenderMethodArgDelete(
void (*f)(
void *));
00166
00168
void SetEndRenderMethodArgDelete(
void (*f)(
void *));
00169
00171
virtual void DisplayToView();
00172
00174
virtual void ViewToDisplay();
00175
00177
virtual void WorldToView();
00178
00180
virtual void ViewToWorld();
00181
00183 void DisplayToWorld() {this->DisplayToView(); this->ViewToWorld();};
00184
00186 void WorldToDisplay() {this->WorldToView(); this->ViewToDisplay();};
00187
00189
00194
virtual void LocalDisplayToDisplay(
float &x,
float &y);
00195
virtual void DisplayToNormalizedDisplay(
float &u,
float &v);
00196
virtual void NormalizedDisplayToViewport(
float &x,
float &y);
00197
virtual void ViewportToNormalizedViewport(
float &u,
float &v);
00198
virtual void NormalizedViewportToView(
float &x,
float &y,
float &z);
00199 virtual void ViewToWorld(
float &,
float &,
float &) {};
00200
virtual void DisplayToLocalDisplay(
float &x,
float &y);
00201
virtual void NormalizedDisplayToDisplay(
float &u,
float &v);
00202
virtual void ViewportToNormalizedDisplay(
float &x,
float &y);
00203
virtual void NormalizedViewportToViewport(
float &u,
float &v);
00204
virtual void ViewToNormalizedViewport(
float &x,
float &y,
float &z);
00205 virtual void WorldToView(
float &,
float &,
float &) {};
00207
00209
00212
int *GetSize();
00213
int *GetOrigin();
00214
void GetTiledSize(
int *width,
int *height);
00216
00217
00218
00219
00225
virtual vtkAssemblyPath* PickProp(
float selectionX,
float selectionY) = 0;
00226
00228
00231
vtkAssemblyPath* PickPropFrom(
float selectionX,
float selectionY,
00232
vtkPropCollection*);
00234
00236
00238 vtkGetMacro(PickX,
float);
00239 vtkGetMacro(PickY,
float);
00240 vtkGetMacro(IsPicking,
int);
00242
00244
virtual float GetPickedZ() = 0;
00245
00246
protected:
00247
00248
00249
00250 vtkViewport();
00251 ~vtkViewport();
00252
00253
00254
00255
00256
virtual void DevicePickRender() = 0;
00257
00258
virtual void StartPick(
unsigned int pickFromSize) = 0;
00259
00260
virtual void UpdatePickId() = 0;
00261
00262
virtual void DonePick() = 0;
00263
00264
virtual unsigned int GetPickedId() = 0;
00265
00266
00267
00268
00269 vtkAssemblyPath* PickedProp;
00270 vtkPropCollection* PickFromProps;
00271
00272 int IsPicking;
00273 unsigned int CurrentPickId;
00274 float PickX;
00275 float PickY;
00276
00277
00278 vtkPropCollection *Props;
00279 vtkActor2DCollection *Actors2D;
00280 vtkWindow *VTKWindow;
00281 float Background[3];
00282 float Viewport[4];
00283 float Aspect[2];
00284 float PixelAspect[2];
00285 float Center[2];
00286
00287 unsigned long StartTag;
00288 unsigned long EndTag;
00289
00290 int Size[2];
00291 int Origin[2];
00292 float DisplayPoint[3];
00293 float ViewPoint[3];
00294 float WorldPoint[4];
00295
00296
private:
00297 vtkViewport(
const vtkViewport&);
00298
void operator=(
const vtkViewport&);
00299 };
00300
00301
00302
00303
#endif