VTK
vtkCubeAxesActor2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCubeAxesActor2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
46 #ifndef vtkCubeAxesActor2D_h
47 #define vtkCubeAxesActor2D_h
48 
49 #include "vtkRenderingAnnotationModule.h" // For export macro
50 #include "vtkActor2D.h"
51 
52 class vtkAlgorithmOutput;
53 class vtkAxisActor2D;
54 class vtkCamera;
55 class vtkCubeAxesActor2DConnection;
56 class vtkDataSet;
57 class vtkTextProperty;
58 
59 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
70  static vtkCubeAxesActor2D *New();
71 
73 
76  int RenderOverlay(vtkViewport*) override;
77  int RenderOpaqueGeometry(vtkViewport*) override;
78  int RenderTranslucentPolygonalGeometry(vtkViewport *) override {return 0;}
80 
84  int HasTranslucentPolygonalGeometry() override;
85 
87 
92  virtual void SetInputConnection(vtkAlgorithmOutput*);
93  virtual void SetInputData(vtkDataSet*);
94  virtual vtkDataSet* GetInput();
96 
98 
103  void SetViewProp(vtkProp* prop);
104  vtkGetObjectMacro(ViewProp, vtkProp);
106 
108 
114  vtkSetVector6Macro(Bounds,double);
115  double *GetBounds() VTK_SIZEHINT(6) override;
116  void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax,
117  double& zmin, double& zmax);
118  void GetBounds(double bounds[6]);
120 
122 
127  vtkSetVector6Macro(Ranges,double);
128  double *GetRanges() VTK_SIZEHINT(6);
129  void GetRanges(double& xmin, double& xmax, double& ymin, double& ymax,
130  double& zmin, double& zmax);
131  void GetRanges(double ranges[6]);
133 
135 
140  vtkSetMacro( XOrigin, double );
141  vtkSetMacro( YOrigin, double );
142  vtkSetMacro( ZOrigin, double );
144 
146 
151  vtkSetMacro(UseRanges,vtkTypeBool);
152  vtkGetMacro(UseRanges,vtkTypeBool);
153  vtkBooleanMacro(UseRanges,vtkTypeBool);
155 
157 
161  virtual void SetCamera(vtkCamera*);
162  vtkGetObjectMacro(Camera,vtkCamera);
164 
165  enum FlyMode
166  {
167  VTK_FLY_OUTER_EDGES = 0,
168  VTK_FLY_CLOSEST_TRIAD = 1,
169  VTK_FLY_NONE = 2
170  };
171 
173 
178  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
179  vtkGetMacro(FlyMode, int);
181  {this->SetFlyMode(VTK_FLY_OUTER_EDGES);};
183  {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);};
185  {this->SetFlyMode(VTK_FLY_NONE);};
187 
189 
195  vtkSetMacro(Scaling,vtkTypeBool);
196  vtkGetMacro(Scaling,vtkTypeBool);
197  vtkBooleanMacro(Scaling,vtkTypeBool);
199 
201 
206  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
207  vtkGetMacro(NumberOfLabels, int);
209 
211 
215  vtkSetStringMacro(XLabel);
216  vtkGetStringMacro(XLabel);
217  vtkSetStringMacro(YLabel);
218  vtkGetStringMacro(YLabel);
219  vtkSetStringMacro(ZLabel);
220  vtkGetStringMacro(ZLabel);
222 
228  {return this->XAxis;}
230  {return this->YAxis;}
232  {return this->ZAxis;}
233 
235 
239  virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
240  vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
242 
244 
248  virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
249  vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
251 
253 
257  vtkSetStringMacro(LabelFormat);
258  vtkGetStringMacro(LabelFormat);
260 
262 
266  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
267  vtkGetMacro(FontFactor, double);
269 
271 
276  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
277  vtkGetMacro(Inertia, int);
279 
281 
289  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
290  vtkGetMacro(ShowActualBounds, int);
292 
294 
299  vtkSetMacro(CornerOffset, double);
300  vtkGetMacro(CornerOffset, double);
302 
308  void ReleaseGraphicsResources(vtkWindow *) override;
309 
311 
314  vtkSetMacro(XAxisVisibility,vtkTypeBool);
315  vtkGetMacro(XAxisVisibility,vtkTypeBool);
316  vtkBooleanMacro(XAxisVisibility,vtkTypeBool);
317  vtkSetMacro(YAxisVisibility,vtkTypeBool);
318  vtkGetMacro(YAxisVisibility,vtkTypeBool);
319  vtkBooleanMacro(YAxisVisibility,vtkTypeBool);
320  vtkSetMacro(ZAxisVisibility,vtkTypeBool);
321  vtkGetMacro(ZAxisVisibility,vtkTypeBool);
322  vtkBooleanMacro(ZAxisVisibility,vtkTypeBool);
324 
328  void ShallowCopy(vtkCubeAxesActor2D *actor);
329 
330 protected:
332  ~vtkCubeAxesActor2D() override;
333 
334  vtkCubeAxesActor2DConnection* ConnectionHolder;
335 
336  vtkProp *ViewProp; //Define bounds from actor/assembly, or
337  double Bounds[6]; //Define bounds explicitly
338  double Ranges[6]; //Define ranges explicitly
339  vtkTypeBool UseRanges; //Flag to use ranges or not
340 
342  int FlyMode;
344 
348 
351 
353 
355  char *XLabel;
356  char *YLabel;
357  char *ZLabel;
358  char *Labels[3];
359 
363 
364  char *LabelFormat;
365  double FontFactor;
366  double CornerOffset;
367  int Inertia;
369  int InertiaAxes[8];
370 
372 
373  // Always show the actual bounds of the object
375 
376  double XOrigin;
377  double YOrigin;
378  double ZOrigin;
379 
380  // various helper methods
381  void TransformBounds(vtkViewport *viewport, double bounds[6],
382  double pts[8][3]);
383  int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6]);
384  double EvaluatePoint(double planes[24], double x[3]);
385  double EvaluateBounds(double planes[24], double bounds[6]);
386  void AdjustAxes(double pts[8][3], double bounds[6],
387  int idx, int xIdx, int yIdx, int zIdx, int zIdx2,
388  int xAxes, int yAxes, int zAxes,
389  double xCoords[4], double yCoords[4], double zCoords[4],
390  double xRange[2], double yRange[2], double zRange[2]);
391 
392 private:
393  // hide the superclass' ShallowCopy() from the user and the compiler.
394  void ShallowCopy(vtkProp *prop) override { this->vtkProp::ShallowCopy( prop ); };
395 private:
396  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
397  void operator=(const vtkCubeAxesActor2D&) = delete;
398 };
399 
400 
401 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:44
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
vtkAxisActor2D * ZAxis
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
abstract specification for Viewports
Definition: vtkViewport.h:44
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkAxisActor2D * GetXAxisActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example)
#define VTK_INT_MAX
Definition: vtkType.h:157
a actor that draws 2D data
Definition: vtkActor2D.h:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
Create an axis with tick marks and labels.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:69
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:124
window superclass for vtkRenderWindow
Definition: vtkWindow.h:34
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
a simple class to control print indentation
Definition: vtkIndent.h:33
int HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
a virtual camera for 3D rendering
Definition: vtkCamera.h:44
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
void SetFlyModeToClosestTriad()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
#define VTK_SIZEHINT(...)
represent text properties.
create a 2D plot of a bounding box edges - used for navigation
vtkAxisActor2D * GetZAxisActor2D()
vtkCubeAxesActor2DConnection * ConnectionHolder
vtkTextProperty * AxisLabelTextProperty
vtkTextProperty * AxisTitleTextProperty
vtkAxisActor2D * XAxis
void SetFlyModeToNone()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkAxisActor2D * GetYAxisActor2D()
vtkAxisActor2D * YAxis
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.