VTK
dox/Hybrid/vtkCubeAxesActor2D.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkCubeAxesActor2D.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00051 #ifndef __vtkCubeAxesActor2D_h
00052 #define __vtkCubeAxesActor2D_h
00053 
00054 #include "vtkActor2D.h"
00055 
00056 #define VTK_FLY_OUTER_EDGES 0
00057 #define VTK_FLY_CLOSEST_TRIAD 1
00058 #define VTK_FLY_NONE 2
00059 
00060 class vtkAxisActor2D;
00061 class vtkCamera;
00062 class vtkDataSet;
00063 class vtkTextProperty;
00064 
00065 class VTK_HYBRID_EXPORT vtkCubeAxesActor2D : public vtkActor2D
00066 {
00067 public:
00068   vtkTypeMacro(vtkCubeAxesActor2D,vtkActor2D);
00069   void PrintSelf(ostream& os, vtkIndent indent);
00070 
00074   static vtkCubeAxesActor2D *New();
00075   
00077 
00078   int RenderOverlay(vtkViewport*);
00079   int RenderOpaqueGeometry(vtkViewport*);
00080   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) {return 0;}
00082 
00084   virtual int HasTranslucentPolygonalGeometry();
00085   
00087 
00090   virtual void SetInput(vtkDataSet*);
00091   vtkGetObjectMacro(Input, vtkDataSet);
00093 
00095 
00097   void SetViewProp(vtkProp* prop);
00098   vtkGetObjectMacro(ViewProp, vtkProp);
00100 
00102 
00106   vtkSetVector6Macro(Bounds,double);
00107   double *GetBounds();
00108   void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax, 
00109                  double& zmin, double& zmax);
00110   void GetBounds(double bounds[6]);
00112 
00114 
00117   vtkSetVector6Macro(Ranges,double);
00118   double *GetRanges();
00119   void GetRanges(double& xmin, double& xmax, double& ymin, double& ymax, 
00120                  double& zmin, double& zmax);
00121   void GetRanges(double ranges[6]);  
00123 
00125 
00128   vtkSetMacro( XOrigin, double );
00129   vtkSetMacro( YOrigin, double );
00130   vtkSetMacro( ZOrigin, double );
00132 
00134 
00136   vtkSetMacro(UseRanges,int);
00137   vtkGetMacro(UseRanges,int);
00138   vtkBooleanMacro(UseRanges,int);
00140 
00142 
00144   virtual void SetCamera(vtkCamera*);
00145   vtkGetObjectMacro(Camera,vtkCamera);
00147 
00149 
00152   vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
00153   vtkGetMacro(FlyMode, int);
00154   void SetFlyModeToOuterEdges()
00155     {this->SetFlyMode(VTK_FLY_OUTER_EDGES);};
00156   void SetFlyModeToClosestTriad()
00157     {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);};
00158   void SetFlyModeToNone()
00159     {this->SetFlyMode(VTK_FLY_NONE);};
00161 
00163 
00167   vtkSetMacro(Scaling,int);
00168   vtkGetMacro(Scaling,int);
00169   vtkBooleanMacro(Scaling,int);
00171 
00173 
00176   vtkSetClampMacro(NumberOfLabels, int, 0, 50);
00177   vtkGetMacro(NumberOfLabels, int);
00179   
00181 
00183   vtkSetStringMacro(XLabel);
00184   vtkGetStringMacro(XLabel);
00185   vtkSetStringMacro(YLabel);
00186   vtkGetStringMacro(YLabel);
00187   vtkSetStringMacro(ZLabel);
00188   vtkGetStringMacro(ZLabel);
00190 
00192 
00194   vtkAxisActor2D *GetXAxisActor2D()
00195     {return this->XAxis;}
00196   vtkAxisActor2D *GetYAxisActor2D()
00197     {return this->YAxis;}
00198   vtkAxisActor2D *GetZAxisActor2D()
00199     {return this->ZAxis;}
00201 
00203 
00205   virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00206   vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00208   
00210 
00212   virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00213   vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00215       
00217 
00219   vtkSetStringMacro(LabelFormat);
00220   vtkGetStringMacro(LabelFormat);
00222   
00224 
00226   vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
00227   vtkGetMacro(FontFactor, double);
00229 
00231 
00234   vtkSetClampMacro(Inertia, int, 1, VTK_LARGE_INTEGER);
00235   vtkGetMacro(Inertia, int);
00237   
00239 
00245   vtkSetClampMacro(ShowActualBounds, int, 0, 1);
00246   vtkGetMacro(ShowActualBounds, int);
00248 
00250 
00253   vtkSetMacro(CornerOffset, double);
00254   vtkGetMacro(CornerOffset, double);
00256 
00260   void ReleaseGraphicsResources(vtkWindow *);
00261 
00263 
00264   vtkSetMacro(XAxisVisibility,int);
00265   vtkGetMacro(XAxisVisibility,int);
00266   vtkBooleanMacro(XAxisVisibility,int);
00267   vtkSetMacro(YAxisVisibility,int);
00268   vtkGetMacro(YAxisVisibility,int);
00269   vtkBooleanMacro(YAxisVisibility,int);
00270   vtkSetMacro(ZAxisVisibility,int);
00271   vtkGetMacro(ZAxisVisibility,int);
00272   vtkBooleanMacro(ZAxisVisibility,int);
00274 
00276   void ShallowCopy(vtkCubeAxesActor2D *actor);
00277 
00278 // Disable warnings about qualifiers on return types.
00279 #if defined(_COMPILER_VERSION)
00280 # pragma set woff 3303
00281 #endif
00282 #if defined(__INTEL_COMPILER)
00283 # pragma warning (push)
00284 # pragma warning (disable:858)
00285 #endif
00286 
00287 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00288 # define SetPropA SetProp
00289 # define SetPropW SetProp
00290 # define GetPropA GetProp
00291 # define GetPropW GetProp
00292 #endif
00293 
00296   VTK_LEGACY(virtual void SetProp(vtkProp* prop));
00297 
00300   VTK_LEGACY(virtual vtkProp* GetProp());
00301 
00302 #ifdef VTK_WORKAROUND_WINDOWS_MANGLE
00303 # undef SetPropW
00304 # undef SetPropA
00305 # undef GetPropW
00306 # undef GetPropA
00307   //BTX
00308   VTK_LEGACY(virtual void SetPropA(vtkProp* prop));
00309   VTK_LEGACY(virtual void SetPropW(vtkProp* prop));
00310   VTK_LEGACY(virtual vtkProp* GetPropA());
00311   VTK_LEGACY(virtual vtkProp* GetPropW());
00312   //ETX
00313 #endif
00314 
00315 // Reset disabled warning about qualifiers on return types.
00316 #if defined(__INTEL_COMPILER)
00317 # pragma warning (pop)
00318 #endif
00319 #if defined(_COMPILER_VERSION)
00320 # pragma reset woff 3303
00321 #endif
00322 
00323 protected:
00324   vtkCubeAxesActor2D();
00325   ~vtkCubeAxesActor2D();
00326 
00327   vtkDataSet *Input;    //Define bounds from input data, or
00328   vtkProp    *ViewProp;     //Define bounds from actor/assembly, or
00329   double      Bounds[6]; //Define bounds explicitly
00330   double      Ranges[6]; //Define ranges explicitly
00331   int        UseRanges; //Flag to use ranges or not
00332 
00333   vtkCamera *Camera;
00334   int FlyMode;
00335   int Scaling;
00336   
00337   vtkAxisActor2D *XAxis;
00338   vtkAxisActor2D *YAxis;
00339   vtkAxisActor2D *ZAxis;
00340   
00341   vtkTextProperty *AxisTitleTextProperty;
00342   vtkTextProperty *AxisLabelTextProperty;
00343 
00344   vtkTimeStamp  BuildTime;
00345 
00346   int   NumberOfLabels;
00347   char *XLabel;
00348   char *YLabel;
00349   char *ZLabel;
00350   char *Labels[3];
00351 
00352   int XAxisVisibility;
00353   int YAxisVisibility;
00354   int ZAxisVisibility;
00355 
00356   char  *LabelFormat;
00357   double FontFactor;
00358   double CornerOffset;
00359   int   Inertia;
00360   int   RenderCount;
00361   int   InertiaAxes[8];
00362   
00363   int RenderSomething;
00364   
00365   // Always show the actual bounds of the object
00366   int ShowActualBounds;
00367 
00368   double XOrigin;
00369   double YOrigin;
00370   double ZOrigin;
00371   
00372   // various helper methods
00373   void TransformBounds(vtkViewport *viewport, double bounds[6], 
00374                        double pts[8][3]);
00375   int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6]);
00376   double EvaluatePoint(double planes[24], double x[3]);
00377   double EvaluateBounds(double planes[24], double bounds[6]);
00378   void AdjustAxes(double pts[8][3], double bounds[6], 
00379                   int idx, int xIdx, int yIdx, int zIdx, int zIdx2, 
00380                   int xAxes, int yAxes, int zAxes,
00381                   double xCoords[4], double yCoords[4], double zCoords[4],
00382                   double xRange[2], double yRange[2], double zRange[2]);
00383 
00384 private:
00385   // hide the superclass' ShallowCopy() from the user and the compiler.
00386   void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
00387 private:
00388   vtkCubeAxesActor2D(const vtkCubeAxesActor2D&);  // Not implemented.
00389   void operator=(const vtkCubeAxesActor2D&);  // Not implemented.
00390 };
00391 
00392 
00393 #endif