VTK
vtkCubeAxesActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCubeAxesActor.h
5  Language: C++
6 
7 Copyright (c) 1993-2001 Ken Martin, Will Schroeder, Bill Lorensen
8 All rights reserve
9  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notice for more information.
14 =========================================================================*/
52 #ifndef __vtkCubeAxesActor_h
53 #define __vtkCubeAxesActor_h
54 
55 #define VTK_FLY_OUTER_EDGES 0
56 #define VTK_FLY_CLOSEST_TRIAD 1
57 #define VTK_FLY_FURTHEST_TRIAD 2
58 #define VTK_FLY_STATIC_TRIAD 3
59 #define VTK_FLY_STATIC_EDGES 4
60 
61 #define VTK_TICKS_INSIDE 0
62 #define VTK_TICKS_OUTSIDE 1
63 #define VTK_TICKS_BOTH 2
64 
65 #include "vtkActor.h"
66 
67 class vtkAxisActor;
68 class vtkCamera;
69 
71 {
72 public:
73  vtkTypeMacro(vtkCubeAxesActor,vtkActor);
74  void PrintSelf(ostream& os, vtkIndent indent);
75 
78  static vtkCubeAxesActor *New();
79 
81 
82  virtual int RenderOpaqueGeometry(vtkViewport*);
83  virtual int RenderTranslucentGeometry(vtkViewport *) {return 0;}
85 
87 
91  vtkSetVector6Macro(Bounds,double);
92  double *GetBounds();
93  void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax,
94  double& zmin, double& zmax);
95  void GetBounds(double bounds[6]);
97 
99 
106  vtkSetVector2Macro( XAxisRange, double );
107  vtkSetVector2Macro( YAxisRange, double );
108  vtkSetVector2Macro( ZAxisRange, double );
109  vtkGetVector2Macro( XAxisRange, double );
110  vtkGetVector2Macro( YAxisRange, double );
111  vtkGetVector2Macro( ZAxisRange, double );
113 
115 
117  virtual void SetCamera(vtkCamera*);
118  vtkGetObjectMacro(Camera,vtkCamera);
120 
122 
125  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_STATIC_EDGES);
126  vtkGetMacro(FlyMode, int);
127  void SetFlyModeToOuterEdges()
128  {this->SetFlyMode(VTK_FLY_OUTER_EDGES);};
129  void SetFlyModeToClosestTriad()
130  {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);};
131  void SetFlyModeToFurthestTriad()
132  {this->SetFlyMode(VTK_FLY_FURTHEST_TRIAD);};
133  void SetFlyModeToStaticTriad()
134  {this->SetFlyMode(VTK_FLY_STATIC_TRIAD);};
135  void SetFlyModeToStaticEdges()
136  {this->SetFlyMode(VTK_FLY_STATIC_EDGES);};
138 
140 
142  vtkSetStringMacro(XTitle);
143  vtkGetStringMacro(XTitle);
144  vtkSetStringMacro(XUnits);
145  vtkGetStringMacro(XUnits);
146  vtkSetStringMacro(YTitle);
147  vtkGetStringMacro(YTitle);
148  vtkSetStringMacro(YUnits);
149  vtkGetStringMacro(YUnits);
150  vtkSetStringMacro(ZTitle);
151  vtkGetStringMacro(ZTitle);
152  vtkSetStringMacro(ZUnits);
153  vtkGetStringMacro(ZUnits);
155 
157 
159  vtkSetStringMacro(XLabelFormat);
160  vtkGetStringMacro(XLabelFormat);
161  vtkSetStringMacro(YLabelFormat);
162  vtkGetStringMacro(YLabelFormat);
163  vtkSetStringMacro(ZLabelFormat);
164  vtkGetStringMacro(ZLabelFormat);
166 
168 
171  vtkSetClampMacro(Inertia, int, 1, VTK_LARGE_INTEGER);
172  vtkGetMacro(Inertia, int);
174 
176 
179  vtkSetMacro(CornerOffset, double);
180  vtkGetMacro(CornerOffset, double);
182 
187 
189 
190  vtkSetMacro(XAxisVisibility,int);
191  vtkGetMacro(XAxisVisibility,int);
192  vtkBooleanMacro(XAxisVisibility,int);
193  vtkSetMacro(YAxisVisibility,int);
194  vtkGetMacro(YAxisVisibility,int);
195  vtkBooleanMacro(YAxisVisibility,int);
196  vtkSetMacro(ZAxisVisibility,int);
197  vtkGetMacro(ZAxisVisibility,int);
198  vtkBooleanMacro(ZAxisVisibility,int);
200 
202 
203  vtkSetMacro(XAxisLabelVisibility,int);
204  vtkGetMacro(XAxisLabelVisibility,int);
205  vtkBooleanMacro(XAxisLabelVisibility,int);
207 
208  vtkSetMacro(YAxisLabelVisibility,int);
209  vtkGetMacro(YAxisLabelVisibility,int);
210  vtkBooleanMacro(YAxisLabelVisibility,int);
211 
212  vtkSetMacro(ZAxisLabelVisibility,int);
213  vtkGetMacro(ZAxisLabelVisibility,int);
214  vtkBooleanMacro(ZAxisLabelVisibility,int);
215 
217 
218  vtkSetMacro(XAxisTickVisibility,int);
219  vtkGetMacro(XAxisTickVisibility,int);
220  vtkBooleanMacro(XAxisTickVisibility,int);
222 
223  vtkSetMacro(YAxisTickVisibility,int);
224  vtkGetMacro(YAxisTickVisibility,int);
225  vtkBooleanMacro(YAxisTickVisibility,int);
226 
227  vtkSetMacro(ZAxisTickVisibility,int);
228  vtkGetMacro(ZAxisTickVisibility,int);
229  vtkBooleanMacro(ZAxisTickVisibility,int);
230 
232 
233  vtkSetMacro(XAxisMinorTickVisibility,int);
234  vtkGetMacro(XAxisMinorTickVisibility,int);
235  vtkBooleanMacro(XAxisMinorTickVisibility,int);
237 
238  vtkSetMacro(YAxisMinorTickVisibility,int);
239  vtkGetMacro(YAxisMinorTickVisibility,int);
240  vtkBooleanMacro(YAxisMinorTickVisibility,int);
241 
242  vtkSetMacro(ZAxisMinorTickVisibility,int);
243  vtkGetMacro(ZAxisMinorTickVisibility,int);
244  vtkBooleanMacro(ZAxisMinorTickVisibility,int);
245 
246  vtkSetMacro(DrawXGridlines,int);
247  vtkGetMacro(DrawXGridlines,int);
248  vtkBooleanMacro(DrawXGridlines,int);
249 
250  vtkSetMacro(DrawYGridlines,int);
251  vtkGetMacro(DrawYGridlines,int);
252  vtkBooleanMacro(DrawYGridlines,int);
253 
254  vtkSetMacro(DrawZGridlines,int);
255  vtkGetMacro(DrawZGridlines,int);
256  vtkBooleanMacro(DrawZGridlines,int);
257 
259 
260  vtkSetClampMacro(TickLocation, int, VTK_TICKS_INSIDE, VTK_TICKS_BOTH);
261  vtkGetMacro(TickLocation, int);
263 
264  void SetTickLocationToInside(void)
265  { this->SetTickLocation(VTK_TICKS_INSIDE); };
266  void SetTickLocationToOutside(void)
267  { this->SetTickLocation(VTK_TICKS_OUTSIDE); };
268  void SetTickLocationToBoth(void)
269  { this->SetTickLocation(VTK_TICKS_BOTH); };
270 
271  void SetLabelScaling(bool, int, int, int);
273  void ShallowCopy(vtkCubeAxesActor *actor);
274 
275 protected:
277  ~vtkCubeAxesActor();
278 
279  int LabelExponent(double min, double max);
280  int Digits(double min, double max);
281  double MaxOf(double, double);
282  double MaxOf(double, double, double, double);
283  double FFix(double);
284  double FSign(double, double);
285 
286  double Bounds[6]; //Define bounds explicitly
287 
289  int FlyMode;
290 
291  // to control all axes
292  // [0] always for 'Major' axis during non-static fly modes.
293  vtkAxisActor *XAxes[4];
294  vtkAxisActor *YAxes[4];
295  vtkAxisActor *ZAxes[4];
296 
297  char *XTitle;
298  char *XUnits;
299  char *YTitle;
300  char *YUnits;
301  char *ZTitle;
302  char *ZUnits;
303 
307 
309 
313 
317 
321 
325 
329 
333  double CornerOffset;
334  int Inertia;
336  int InertiaLocs[3];
337 
339 
340 private:
341  vtkCubeAxesActor(const vtkCubeAxesActor&); // Not implemented
342  void operator=(const vtkCubeAxesActor&); // Not implemented
343 
344  vtkSetStringMacro(ActualXLabel);
345  vtkSetStringMacro(ActualYLabel);
346  vtkSetStringMacro(ActualZLabel);
347 
348  vtkTimeStamp BuildTime;
349  int LastXPow;
350  int LastYPow;
351  int LastZPow;
352  int UserXPow;
353  int UserYPow;
354  int UserZPow;
355  bool AutoLabelScaling;
356  int LastXAxisDigits;
357  int LastYAxisDigits;
358  int LastZAxisDigits;
359  double LastXRange[2];
360  double LastYRange[2];
361  double LastZRange[2];
362  int LastFlyMode;
363 
364  int RenderAxesX[4];
365  int RenderAxesY[4];
366  int RenderAxesZ[4];
367  int NumberOfAxesX;
368  int NumberOfAxesY;
369  int NumberOfAxesZ;
370 
371  bool MustAdjustXValue;
372  bool MustAdjustYValue;
373  bool MustAdjustZValue;
374  bool ForceXLabelReset;
375  bool ForceYLabelReset;
376  bool ForceZLabelReset;
377 
378  double XAxisRange[2];
379  double YAxisRange[2];
380  double ZAxisRange[2];
381 
382  // various helper methods
383  void TransformBounds(vtkViewport *viewport, const double bounds[6],
384  double pts[8][3]);
385  void AdjustAxes(double bounds[6],
386  double xCoords[4][6], double yCoords[4][6],
387  double zCoords[4][6],
388  double xRange[2], double yRange[2], double zRange[2]);
389 
390  bool ComputeTickSize(double bounds[6]);
391  void AdjustValues(const double xRange[2],
392  const double yRange[2],
393  const double zRange[2]);
394  void AdjustRange(const double bounds[6]);
395  void BuildAxes(vtkViewport *);
396  void DetermineRenderAxes(vtkViewport *);
397  void SetNonDependentAttributes(void);
398  void BuildLabels(vtkAxisActor *axes[4]);
399  void AdjustTicksComputeRange(vtkAxisActor *axes[4],
400  double rangeMin, double rangeMax);
401 
402  // hide the superclass' ShallowCopy() from the user and the compiler.
403  void ShallowCopy(vtkProp *prop) { this->vtkProp::ShallowCopy( prop ); };
404 };
405 
406 
407 #endif