VTK
dox/Rendering/Annotation/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 "vtkRenderingAnnotationModule.h" // For export macro
00055 #include "vtkActor2D.h"
00056 
00057 #define VTK_FLY_OUTER_EDGES 0
00058 #define VTK_FLY_CLOSEST_TRIAD 1
00059 #define VTK_FLY_NONE 2
00060 
00061 class vtkAlgorithmOutput;
00062 class vtkAxisActor2D;
00063 class vtkCamera;
00064 class vtkCubeAxesActor2DConnection;
00065 class vtkDataSet;
00066 class vtkTextProperty;
00067 
00068 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
00069 {
00070 public:
00071   vtkTypeMacro(vtkCubeAxesActor2D,vtkActor2D);
00072   void PrintSelf(ostream& os, vtkIndent indent);
00073 
00077   static vtkCubeAxesActor2D *New();
00078 
00080 
00081   int RenderOverlay(vtkViewport*);
00082   int RenderOpaqueGeometry(vtkViewport*);
00083   virtual int RenderTranslucentPolygonalGeometry(vtkViewport *) {return 0;}
00085 
00087   virtual int HasTranslucentPolygonalGeometry();
00088 
00090 
00093   virtual void SetInputConnection(vtkAlgorithmOutput*);
00094   virtual void SetInputData(vtkDataSet*);
00095   virtual vtkDataSet* GetInput();
00097 
00099 
00101   void SetViewProp(vtkProp* prop);
00102   vtkGetObjectMacro(ViewProp, vtkProp);
00104 
00106 
00110   vtkSetVector6Macro(Bounds,double);
00111   double *GetBounds();
00112   void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax,
00113                  double& zmin, double& zmax);
00114   void GetBounds(double bounds[6]);
00116 
00118 
00121   vtkSetVector6Macro(Ranges,double);
00122   double *GetRanges();
00123   void GetRanges(double& xmin, double& xmax, double& ymin, double& ymax,
00124                  double& zmin, double& zmax);
00125   void GetRanges(double ranges[6]);
00127 
00129 
00132   vtkSetMacro( XOrigin, double );
00133   vtkSetMacro( YOrigin, double );
00134   vtkSetMacro( ZOrigin, double );
00136 
00138 
00140   vtkSetMacro(UseRanges,int);
00141   vtkGetMacro(UseRanges,int);
00142   vtkBooleanMacro(UseRanges,int);
00144 
00146 
00148   virtual void SetCamera(vtkCamera*);
00149   vtkGetObjectMacro(Camera,vtkCamera);
00151 
00153 
00156   vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
00157   vtkGetMacro(FlyMode, int);
00158   void SetFlyModeToOuterEdges()
00159     {this->SetFlyMode(VTK_FLY_OUTER_EDGES);};
00160   void SetFlyModeToClosestTriad()
00161     {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);};
00162   void SetFlyModeToNone()
00163     {this->SetFlyMode(VTK_FLY_NONE);};
00165 
00167 
00171   vtkSetMacro(Scaling,int);
00172   vtkGetMacro(Scaling,int);
00173   vtkBooleanMacro(Scaling,int);
00175 
00177 
00180   vtkSetClampMacro(NumberOfLabels, int, 0, 50);
00181   vtkGetMacro(NumberOfLabels, int);
00183 
00185 
00187   vtkSetStringMacro(XLabel);
00188   vtkGetStringMacro(XLabel);
00189   vtkSetStringMacro(YLabel);
00190   vtkGetStringMacro(YLabel);
00191   vtkSetStringMacro(ZLabel);
00192   vtkGetStringMacro(ZLabel);
00194 
00196 
00198   vtkAxisActor2D *GetXAxisActor2D()
00199     {return this->XAxis;}
00200   vtkAxisActor2D *GetYAxisActor2D()
00201     {return this->YAxis;}
00202   vtkAxisActor2D *GetZAxisActor2D()
00203     {return this->ZAxis;}
00205 
00207 
00209   virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
00210   vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
00212 
00214 
00216   virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
00217   vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
00219 
00221 
00223   vtkSetStringMacro(LabelFormat);
00224   vtkGetStringMacro(LabelFormat);
00226 
00228 
00230   vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
00231   vtkGetMacro(FontFactor, double);
00233 
00235 
00238   vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
00239   vtkGetMacro(Inertia, int);
00241 
00243 
00249   vtkSetClampMacro(ShowActualBounds, int, 0, 1);
00250   vtkGetMacro(ShowActualBounds, int);
00252 
00254 
00257   vtkSetMacro(CornerOffset, double);
00258   vtkGetMacro(CornerOffset, double);
00260 
00264   void ReleaseGraphicsResources(vtkWindow *);
00265 
00267 
00268   vtkSetMacro(XAxisVisibility,int);
00269   vtkGetMacro(XAxisVisibility,int);
00270   vtkBooleanMacro(XAxisVisibility,int);
00271   vtkSetMacro(YAxisVisibility,int);
00272   vtkGetMacro(YAxisVisibility,int);
00273   vtkBooleanMacro(YAxisVisibility,int);
00274   vtkSetMacro(ZAxisVisibility,int);
00275   vtkGetMacro(ZAxisVisibility,int);
00276   vtkBooleanMacro(ZAxisVisibility,int);
00278 
00280   void ShallowCopy(vtkCubeAxesActor2D *actor);
00281 
00282 protected:
00283   vtkCubeAxesActor2D();
00284   ~vtkCubeAxesActor2D();
00285 
00286   vtkCubeAxesActor2DConnection* ConnectionHolder;
00287 
00288   vtkProp    *ViewProp;     //Define bounds from actor/assembly, or
00289   double      Bounds[6]; //Define bounds explicitly
00290   double      Ranges[6]; //Define ranges explicitly
00291   int        UseRanges; //Flag to use ranges or not
00292 
00293   vtkCamera *Camera;
00294   int FlyMode;
00295   int Scaling;
00296 
00297   vtkAxisActor2D *XAxis;
00298   vtkAxisActor2D *YAxis;
00299   vtkAxisActor2D *ZAxis;
00300 
00301   vtkTextProperty *AxisTitleTextProperty;
00302   vtkTextProperty *AxisLabelTextProperty;
00303 
00304   vtkTimeStamp  BuildTime;
00305 
00306   int   NumberOfLabels;
00307   char *XLabel;
00308   char *YLabel;
00309   char *ZLabel;
00310   char *Labels[3];
00311 
00312   int XAxisVisibility;
00313   int YAxisVisibility;
00314   int ZAxisVisibility;
00315 
00316   char  *LabelFormat;
00317   double FontFactor;
00318   double CornerOffset;
00319   int   Inertia;
00320   int   RenderCount;
00321   int   InertiaAxes[8];
00322 
00323   int RenderSomething;
00324 
00325   // Always show the actual bounds of the object
00326   int ShowActualBounds;
00327 
00328   double XOrigin;
00329   double YOrigin;
00330   double ZOrigin;
00331 
00332   // various helper methods
00333   void TransformBounds(vtkViewport *viewport, double bounds[6],
00334                        double pts[8][3]);
00335   int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6]);
00336   double EvaluatePoint(double planes[24], double x[3]);
00337   double EvaluateBounds(double planes[24], double bounds[6]);
00338   void AdjustAxes(double pts[8][3], double bounds[6],
00339                   int idx, int xIdx, int yIdx, int zIdx, int zIdx2,
00340                   int xAxes, int yAxes, int zAxes,
00341                   double xCoords[4], double yCoords[4], double zCoords[4],
00342                   double xRange[2], double yRange[2], double zRange[2]);
00343 
00344 private:
00345   // hide the superclass' ShallowCopy() from the user and the compiler.
00346   void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
00347 private:
00348   vtkCubeAxesActor2D(const vtkCubeAxesActor2D&);  // Not implemented.
00349   void operator=(const vtkCubeAxesActor2D&);  // Not implemented.
00350 };
00351 
00352 
00353 #endif