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 
00073 #ifndef __vtkCubeAxesActor2D_h
00074 #define __vtkCubeAxesActor2D_h
00075 
00076 #include "vtkAxisActor2D.h"
00077 #include "vtkCamera.h"
00078 
00079 #define VTK_FLY_OUTER_EDGES 0
00080 #define VTK_FLY_CLOSEST_TRIAD 1
00081 
00082 class VTK_EXPORT vtkCubeAxesActor2D : public vtkActor2D
00083 {
00084 public:
00085   vtkTypeMacro(vtkCubeAxesActor2D,vtkActor2D);
00086   void PrintSelf(ostream& os, vtkIndent indent);
00087 
00091   static vtkCubeAxesActor2D *New();
00092   
00094   int RenderOverlay(vtkViewport*);
00095   int RenderOpaqueGeometry(vtkViewport*);
00096   int RenderTranslucentGeometry(vtkViewport *) {return 0;}
00097 
00101   vtkSetObjectMacro(Input, vtkDataSet);
00102   vtkGetObjectMacro(Input, vtkDataSet);
00103 
00106   vtkSetObjectMacro(Prop, vtkProp);
00107   vtkGetObjectMacro(Prop, vtkProp);
00108   
00113   vtkSetVector6Macro(Bounds,float);
00114   float *GetBounds();
00115   void GetBounds(float& xmin, float& xmax, float& ymin, float& ymax, 
00116                  float& zmin, float& zmax);
00117   void GetBounds(float bounds[6]);
00118 
00121   vtkSetObjectMacro(Camera,vtkCamera);
00122   vtkGetObjectMacro(Camera,vtkCamera);
00123 
00126   vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_CLOSEST_TRIAD);
00127   vtkGetMacro(FlyMode, int);
00128   void SetFlyModeToOuterEdges()
00129     {this->SetFlyMode(VTK_FLY_OUTER_EDGES);};
00130   void SetFlyModeToClosestTriad()
00131     {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);};
00132 
00137   vtkSetMacro(Scaling,int);
00138   vtkGetMacro(Scaling,int);
00139   vtkBooleanMacro(Scaling,int);
00140 
00144   vtkSetClampMacro(NumberOfLabels, int, 0, 50);
00145   vtkGetMacro(NumberOfLabels, int);
00146   
00149   vtkSetStringMacro(XLabel);
00150   vtkGetStringMacro(XLabel);
00151   vtkSetStringMacro(YLabel);
00152   vtkGetStringMacro(YLabel);
00153   vtkSetStringMacro(ZLabel);
00154   vtkGetStringMacro(ZLabel);
00155 
00157   vtkSetMacro(Bold, int);
00158   vtkGetMacro(Bold, int);
00159   vtkBooleanMacro(Bold, int);
00160 
00162   vtkSetMacro(Italic, int);
00163   vtkGetMacro(Italic, int);
00164   vtkBooleanMacro(Italic, int);
00165 
00168   vtkSetMacro(Shadow, int);
00169   vtkGetMacro(Shadow, int);
00170   vtkBooleanMacro(Shadow, int);
00171 
00175   vtkSetMacro(FontFamily, int);
00176   vtkGetMacro(FontFamily, int);
00177   void SetFontFamilyToArial() {this->SetFontFamily(VTK_ARIAL);};
00178   void SetFontFamilyToCourier() {this->SetFontFamily(VTK_COURIER);};
00179   void SetFontFamilyToTimes() {this->SetFontFamily(VTK_TIMES);};
00180 
00183   vtkSetStringMacro(LabelFormat);
00184   vtkGetStringMacro(LabelFormat);
00185   
00188   vtkSetClampMacro(FontFactor, float, 0.1, 2.0);
00189   vtkGetMacro(FontFactor, float);
00190 
00194   vtkSetClampMacro(Inertia, int, 1, VTK_LARGE_INTEGER);
00195   vtkGetMacro(Inertia, float);
00196 
00200   vtkSetMacro(CornerOffset, float);
00201   vtkGetMacro(CornerOffset, float);
00202 
00206   void ReleaseGraphicsResources(vtkWindow *);
00207 
00209   vtkSetMacro(XAxisVisibility,int);
00210   vtkGetMacro(XAxisVisibility,int);
00211   vtkBooleanMacro(XAxisVisibility,int);
00212   vtkSetMacro(YAxisVisibility,int);
00213   vtkGetMacro(YAxisVisibility,int);
00214   vtkBooleanMacro(YAxisVisibility,int);
00215   vtkSetMacro(ZAxisVisibility,int);
00216   vtkGetMacro(ZAxisVisibility,int);
00217   vtkBooleanMacro(ZAxisVisibility,int);
00218 
00220   void ShallowCopy(vtkCubeAxesActor2D *actor);
00221 
00222 protected:
00223   vtkCubeAxesActor2D();
00224   ~vtkCubeAxesActor2D();
00225   vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) {};
00226   void operator=(const vtkCubeAxesActor2D&) {};
00227 
00228   vtkDataSet *Input;    
00229   vtkProp    *Prop;     
00230   float      Bounds[6]; 
00231 
00232   vtkCamera *Camera;
00233   int FlyMode;
00234   int Scaling;
00235   
00236   vtkAxisActor2D *XAxis;
00237   vtkAxisActor2D *YAxis;
00238   vtkAxisActor2D *ZAxis;
00239   
00240   int   NumberOfLabels;
00241   char *XLabel;
00242   char *YLabel;
00243   char *ZLabel;
00244   char *Labels[3];
00245 
00246   int XAxisVisibility;
00247   int YAxisVisibility;
00248   int ZAxisVisibility;
00249 
00250   int   Bold;
00251   int   Italic;
00252   int   Shadow;
00253   int   FontFamily;
00254   char  *LabelFormat;
00255   float FontFactor;
00256   float CornerOffset;
00257   int   Inertia;
00258   int   RenderCount;
00259   int   InertiaAxes[8];
00260   
00261   int RenderSomething;
00262   
00263   
00264   void TransformBounds(vtkViewport *viewport, float bounds[6], 
00265                        float pts[8][3]);
00266   int ClipBounds(vtkViewport *viewport, float pts[8][3], float bounds[6]);
00267   float EvaluatePoint(float planes[24], float x[3]);
00268   float EvaluateBounds(float planes[24], float bounds[6]);
00269   void AdjustAxes(float pts[8][3], float bounds[6], 
00270                   int idx, int xIdx, int yIdx, int zIdx, int zIdx2, 
00271                   int xAxes, int yAxes, int zAxes,
00272                   float xCoords[4], float yCoords[4], float zCoords[4],
00273                   float xRange[2], float yRange[2], float zRange[2]);
00274 
00275 private:
00276   
00277   void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
00278 };
00279 
00280 
00281 #endif