VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkCubeAxesActor.h,v $ 00005 Language: C++ 00006 00007 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen 00008 All rights reserve 00009 See Copyright.txt or http://www.kitware.com/Copyright.htm for details. 00010 00011 This software is distributed WITHOUT ANY WARRANTY; without even 00012 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 00013 PURPOSE. See the above copyright notice for more information. 00014 =========================================================================*/ 00052 #ifndef __vtkCubeAxesActor_h 00053 #define __vtkCubeAxesActor_h 00054 00055 #define VTK_FLY_OUTER_EDGES 0 00056 #define VTK_FLY_CLOSEST_TRIAD 1 00057 #define VTK_FLY_FURTHEST_TRIAD 2 00058 #define VTK_FLY_STATIC_TRIAD 3 00059 #define VTK_FLY_STATIC_EDGES 4 00060 00061 #define VTK_TICKS_INSIDE 0 00062 #define VTK_TICKS_OUTSIDE 1 00063 #define VTK_TICKS_BOTH 2 00064 00065 #include "vtkActor.h" 00066 00067 class vtkAxisActor; 00068 class vtkCamera; 00069 00070 class VTK_HYBRID_EXPORT vtkCubeAxesActor : public vtkActor 00071 { 00072 public: 00073 vtkTypeRevisionMacro(vtkCubeAxesActor,vtkActor); 00074 void PrintSelf(ostream& os, vtkIndent indent); 00075 00078 static vtkCubeAxesActor *New(); 00079 00081 00082 virtual int RenderOpaqueGeometry(vtkViewport*); 00083 virtual int RenderTranslucentGeometry(vtkViewport *) {return 0;} 00085 00087 00091 vtkSetVector6Macro(Bounds,double); 00092 double *GetBounds(); 00093 void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax, 00094 double& zmin, double& zmax); 00095 void GetBounds(double bounds[6]); 00097 00099 00101 virtual void SetCamera(vtkCamera*); 00102 vtkGetObjectMacro(Camera,vtkCamera); 00104 00106 00109 vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_STATIC_EDGES); 00110 vtkGetMacro(FlyMode, int); 00111 void SetFlyModeToOuterEdges() 00112 {this->SetFlyMode(VTK_FLY_OUTER_EDGES);}; 00113 void SetFlyModeToClosestTriad() 00114 {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);}; 00115 void SetFlyModeToFurthestTriad() 00116 {this->SetFlyMode(VTK_FLY_FURTHEST_TRIAD);}; 00117 void SetFlyModeToStaticTriad() 00118 {this->SetFlyMode(VTK_FLY_STATIC_TRIAD);}; 00119 void SetFlyModeToStaticEdges() 00120 {this->SetFlyMode(VTK_FLY_STATIC_EDGES);}; 00122 00124 00126 vtkSetStringMacro(XTitle); 00127 vtkGetStringMacro(XTitle); 00128 vtkSetStringMacro(XUnits); 00129 vtkGetStringMacro(XUnits); 00130 vtkSetStringMacro(YTitle); 00131 vtkGetStringMacro(YTitle); 00132 vtkSetStringMacro(YUnits); 00133 vtkGetStringMacro(YUnits); 00134 vtkSetStringMacro(ZTitle); 00135 vtkGetStringMacro(ZTitle); 00136 vtkSetStringMacro(ZUnits); 00137 vtkGetStringMacro(ZUnits); 00139 00141 00143 vtkSetStringMacro(XLabelFormat); 00144 vtkGetStringMacro(XLabelFormat); 00145 vtkSetStringMacro(YLabelFormat); 00146 vtkGetStringMacro(YLabelFormat); 00147 vtkSetStringMacro(ZLabelFormat); 00148 vtkGetStringMacro(ZLabelFormat); 00150 00152 00155 vtkSetClampMacro(Inertia, int, 1, VTK_LARGE_INTEGER); 00156 vtkGetMacro(Inertia, int); 00158 00160 00163 vtkSetMacro(CornerOffset, double); 00164 vtkGetMacro(CornerOffset, double); 00166 00170 void ReleaseGraphicsResources(vtkWindow *); 00171 00173 00174 vtkSetMacro(XAxisVisibility,int); 00175 vtkGetMacro(XAxisVisibility,int); 00176 vtkBooleanMacro(XAxisVisibility,int); 00177 vtkSetMacro(YAxisVisibility,int); 00178 vtkGetMacro(YAxisVisibility,int); 00179 vtkBooleanMacro(YAxisVisibility,int); 00180 vtkSetMacro(ZAxisVisibility,int); 00181 vtkGetMacro(ZAxisVisibility,int); 00182 vtkBooleanMacro(ZAxisVisibility,int); 00184 00186 00187 vtkSetMacro(XAxisLabelVisibility,int); 00188 vtkGetMacro(XAxisLabelVisibility,int); 00189 vtkBooleanMacro(XAxisLabelVisibility,int); 00191 00192 vtkSetMacro(YAxisLabelVisibility,int); 00193 vtkGetMacro(YAxisLabelVisibility,int); 00194 vtkBooleanMacro(YAxisLabelVisibility,int); 00195 00196 vtkSetMacro(ZAxisLabelVisibility,int); 00197 vtkGetMacro(ZAxisLabelVisibility,int); 00198 vtkBooleanMacro(ZAxisLabelVisibility,int); 00199 00201 00202 vtkSetMacro(XAxisTickVisibility,int); 00203 vtkGetMacro(XAxisTickVisibility,int); 00204 vtkBooleanMacro(XAxisTickVisibility,int); 00206 00207 vtkSetMacro(YAxisTickVisibility,int); 00208 vtkGetMacro(YAxisTickVisibility,int); 00209 vtkBooleanMacro(YAxisTickVisibility,int); 00210 00211 vtkSetMacro(ZAxisTickVisibility,int); 00212 vtkGetMacro(ZAxisTickVisibility,int); 00213 vtkBooleanMacro(ZAxisTickVisibility,int); 00214 00216 00217 vtkSetMacro(XAxisMinorTickVisibility,int); 00218 vtkGetMacro(XAxisMinorTickVisibility,int); 00219 vtkBooleanMacro(XAxisMinorTickVisibility,int); 00221 00222 vtkSetMacro(YAxisMinorTickVisibility,int); 00223 vtkGetMacro(YAxisMinorTickVisibility,int); 00224 vtkBooleanMacro(YAxisMinorTickVisibility,int); 00225 00226 vtkSetMacro(ZAxisMinorTickVisibility,int); 00227 vtkGetMacro(ZAxisMinorTickVisibility,int); 00228 vtkBooleanMacro(ZAxisMinorTickVisibility,int); 00229 00230 vtkSetMacro(DrawXGridlines,int); 00231 vtkGetMacro(DrawXGridlines,int); 00232 vtkBooleanMacro(DrawXGridlines,int); 00233 00234 vtkSetMacro(DrawYGridlines,int); 00235 vtkGetMacro(DrawYGridlines,int); 00236 vtkBooleanMacro(DrawYGridlines,int); 00237 00238 vtkSetMacro(DrawZGridlines,int); 00239 vtkGetMacro(DrawZGridlines,int); 00240 vtkBooleanMacro(DrawZGridlines,int); 00241 00243 00244 vtkSetClampMacro(TickLocation, int, VTK_TICKS_INSIDE, VTK_TICKS_BOTH); 00245 vtkGetMacro(TickLocation, int); 00247 00248 void SetTickLocationToInside(void) 00249 { this->SetTickLocation(VTK_TICKS_INSIDE); }; 00250 void SetTickLocationToOutside(void) 00251 { this->SetTickLocation(VTK_TICKS_OUTSIDE); }; 00252 void SetTickLocationToBoth(void) 00253 { this->SetTickLocation(VTK_TICKS_BOTH); }; 00254 00255 void SetLabelScaling(bool, int, int, int); 00257 void ShallowCopy(vtkCubeAxesActor *actor); 00258 00259 protected: 00260 vtkCubeAxesActor(); 00261 ~vtkCubeAxesActor(); 00262 00263 int LabelExponent(double min, double max); 00264 int Digits(double min, double max); 00265 double MaxOf(double, double); 00266 double MaxOf(double, double, double, double); 00267 double FFix(double); 00268 double FSign(double, double); 00269 00270 double Bounds[6]; //Define bounds explicitly 00271 00272 vtkCamera *Camera; 00273 int FlyMode; 00274 00275 // to control all axes 00276 // [0] always for 'Major' axis during non-static fly modes. 00277 vtkAxisActor *XAxes[4]; 00278 vtkAxisActor *YAxes[4]; 00279 vtkAxisActor *ZAxes[4]; 00280 00281 char *XTitle; 00282 char *XUnits; 00283 char *YTitle; 00284 char *YUnits; 00285 char *ZTitle; 00286 char *ZUnits; 00287 00288 char *ActualXLabel; 00289 char *ActualYLabel; 00290 char *ActualZLabel; 00291 00292 int TickLocation; 00293 00294 int XAxisVisibility; 00295 int YAxisVisibility; 00296 int ZAxisVisibility; 00297 00298 int XAxisTickVisibility; 00299 int YAxisTickVisibility; 00300 int ZAxisTickVisibility; 00301 00302 int XAxisMinorTickVisibility; 00303 int YAxisMinorTickVisibility; 00304 int ZAxisMinorTickVisibility; 00305 00306 int XAxisLabelVisibility; 00307 int YAxisLabelVisibility; 00308 int ZAxisLabelVisibility; 00309 00310 int DrawXGridlines; 00311 int DrawYGridlines; 00312 int DrawZGridlines; 00313 00314 char *XLabelFormat; 00315 char *YLabelFormat; 00316 char *ZLabelFormat; 00317 double CornerOffset; 00318 int Inertia; 00319 int RenderCount; 00320 int InertiaLocs[3]; 00321 00322 int RenderSomething; 00323 00324 private: 00325 vtkCubeAxesActor(const vtkCubeAxesActor&); // Not implemented 00326 void operator=(const vtkCubeAxesActor&); // Not implemented 00327 00328 vtkSetStringMacro(ActualXLabel); 00329 vtkSetStringMacro(ActualYLabel); 00330 vtkSetStringMacro(ActualZLabel); 00331 00332 vtkTimeStamp BuildTime; 00333 int LastXPow; 00334 int LastYPow; 00335 int LastZPow; 00336 int UserXPow; 00337 int UserYPow; 00338 int UserZPow; 00339 bool AutoLabelScaling; 00340 int LastXAxisDigits; 00341 int LastYAxisDigits; 00342 int LastZAxisDigits; 00343 double LastXRange[2]; 00344 double LastYRange[2]; 00345 double LastZRange[2]; 00346 int LastFlyMode; 00347 00348 int RenderAxesX[4]; 00349 int RenderAxesY[4]; 00350 int RenderAxesZ[4]; 00351 int NumberOfAxesX; 00352 int NumberOfAxesY; 00353 int NumberOfAxesZ; 00354 00355 bool MustAdjustXValue; 00356 bool MustAdjustYValue; 00357 bool MustAdjustZValue; 00358 bool ForceXLabelReset; 00359 bool ForceYLabelReset; 00360 bool ForceZLabelReset; 00361 00362 // various helper methods 00363 void TransformBounds(vtkViewport *viewport, const double bounds[6], 00364 double pts[8][3]); 00365 void AdjustAxes(double bounds[6], 00366 double xCoords[4][6], double yCoords[4][6], 00367 double zCoords[4][6], 00368 double xRange[2], double yRange[2], double zRange[2]); 00369 00370 bool ComputeTickSize(double bounds[6]); 00371 void AdjustValues(const double bounds[6]); 00372 void AdjustRange(const double bounds[6]); 00373 void BuildAxes(vtkViewport *); 00374 void DetermineRenderAxes(vtkViewport *); 00375 void SetNonDependentAttributes(void); 00376 void BuildLabels(vtkAxisActor *axes[4]); 00377 void AdjustTicksComputeRange(vtkAxisActor *axes[4]); 00378 00379 // hide the superclass' ShallowCopy() from the user and the compiler. 00380 void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); }; 00381 }; 00382 00383 00384 #endif