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 =========================================================================*/
52 #ifndef vtkCubeAxesActor2D_h
53 #define vtkCubeAxesActor2D_h
54 
55 #include "vtkRenderingAnnotationModule.h" // For export macro
56 #include "vtkActor2D.h"
57 
58 class vtkAlgorithmOutput;
59 class vtkAxisActor2D;
60 class vtkCamera;
61 class vtkCubeAxesActor2DConnection;
62 class vtkDataSet;
63 class vtkTextProperty;
64 
65 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
66 {
67 public:
69  void PrintSelf(ostream& os, vtkIndent indent) override;
70 
76  static vtkCubeAxesActor2D *New();
77 
79 
82  int RenderOverlay(vtkViewport*) override;
83  int RenderOpaqueGeometry(vtkViewport*) override;
84  int RenderTranslucentPolygonalGeometry(vtkViewport *) override {return 0;}
86 
91 
93 
98  virtual void SetInputConnection(vtkAlgorithmOutput*);
99  virtual void SetInputData(vtkDataSet*);
100  virtual vtkDataSet* GetInput();
102 
104 
109  void SetViewProp(vtkProp* prop);
110  vtkGetObjectMacro(ViewProp, vtkProp);
112 
114 
120  vtkSetVector6Macro(Bounds,double);
121  double *GetBounds() VTK_SIZEHINT(6) override;
122  void GetBounds(double& xmin, double& xmax, double& ymin, double& ymax,
123  double& zmin, double& zmax);
124  void GetBounds(double bounds[6]);
126 
128 
133  vtkSetVector6Macro(Ranges,double);
134  double *GetRanges() VTK_SIZEHINT(6);
135  void GetRanges(double& xmin, double& xmax, double& ymin, double& ymax,
136  double& zmin, double& zmax);
137  void GetRanges(double ranges[6]);
139 
141 
146  vtkSetMacro( XOrigin, double );
147  vtkSetMacro( YOrigin, double );
148  vtkSetMacro( ZOrigin, double );
150 
152 
157  vtkSetMacro(UseRanges,vtkTypeBool);
158  vtkGetMacro(UseRanges,vtkTypeBool);
159  vtkBooleanMacro(UseRanges,vtkTypeBool);
161 
163 
167  virtual void SetCamera(vtkCamera*);
168  vtkGetObjectMacro(Camera,vtkCamera);
170 
171  enum FlyMode
172  {
173  VTK_FLY_OUTER_EDGES = 0,
174  VTK_FLY_CLOSEST_TRIAD = 1,
175  VTK_FLY_NONE = 2
176  };
177 
179 
184  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
185  vtkGetMacro(FlyMode, int);
187  {this->SetFlyMode(VTK_FLY_OUTER_EDGES);};
189  {this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD);};
191  {this->SetFlyMode(VTK_FLY_NONE);};
193 
195 
201  vtkSetMacro(Scaling,vtkTypeBool);
202  vtkGetMacro(Scaling,vtkTypeBool);
203  vtkBooleanMacro(Scaling,vtkTypeBool);
205 
207 
212  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
213  vtkGetMacro(NumberOfLabels, int);
215 
217 
221  vtkSetStringMacro(XLabel);
222  vtkGetStringMacro(XLabel);
223  vtkSetStringMacro(YLabel);
224  vtkGetStringMacro(YLabel);
225  vtkSetStringMacro(ZLabel);
226  vtkGetStringMacro(ZLabel);
228 
234  {return this->XAxis;}
236  {return this->YAxis;}
238  {return this->ZAxis;}
239 
241 
245  virtual void SetAxisTitleTextProperty(vtkTextProperty *p);
246  vtkGetObjectMacro(AxisTitleTextProperty,vtkTextProperty);
248 
250 
254  virtual void SetAxisLabelTextProperty(vtkTextProperty *p);
255  vtkGetObjectMacro(AxisLabelTextProperty,vtkTextProperty);
257 
259 
263  vtkSetStringMacro(LabelFormat);
264  vtkGetStringMacro(LabelFormat);
266 
268 
272  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
273  vtkGetMacro(FontFactor, double);
275 
277 
282  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
283  vtkGetMacro(Inertia, int);
285 
287 
295  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
296  vtkGetMacro(ShowActualBounds, int);
298 
300 
305  vtkSetMacro(CornerOffset, double);
306  vtkGetMacro(CornerOffset, double);
308 
314  void ReleaseGraphicsResources(vtkWindow *) override;
315 
317 
320  vtkSetMacro(XAxisVisibility,vtkTypeBool);
321  vtkGetMacro(XAxisVisibility,vtkTypeBool);
322  vtkBooleanMacro(XAxisVisibility,vtkTypeBool);
323  vtkSetMacro(YAxisVisibility,vtkTypeBool);
324  vtkGetMacro(YAxisVisibility,vtkTypeBool);
325  vtkBooleanMacro(YAxisVisibility,vtkTypeBool);
326  vtkSetMacro(ZAxisVisibility,vtkTypeBool);
327  vtkGetMacro(ZAxisVisibility,vtkTypeBool);
328  vtkBooleanMacro(ZAxisVisibility,vtkTypeBool);
330 
334  void ShallowCopy(vtkCubeAxesActor2D *actor);
335 
336 protected:
338  ~vtkCubeAxesActor2D() override;
339 
340  vtkCubeAxesActor2DConnection* ConnectionHolder;
341 
342  vtkProp *ViewProp; //Define bounds from actor/assembly, or
343  double Bounds[6]; //Define bounds explicitly
344  double Ranges[6]; //Define ranges explicitly
345  vtkTypeBool UseRanges; //Flag to use ranges or not
346 
348  int FlyMode;
350 
354 
357 
359 
361  char *XLabel;
362  char *YLabel;
363  char *ZLabel;
364  char *Labels[3];
365 
369 
370  char *LabelFormat;
371  double FontFactor;
372  double CornerOffset;
373  int Inertia;
375  int InertiaAxes[8];
376 
378 
379  // Always show the actual bounds of the object
381 
382  double XOrigin;
383  double YOrigin;
384  double ZOrigin;
385 
386  // various helper methods
387  void TransformBounds(vtkViewport *viewport, double bounds[6],
388  double pts[8][3]);
389  int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6]);
390  double EvaluatePoint(double planes[24], double x[3]);
391  double EvaluateBounds(double planes[24], double bounds[6]);
392  void AdjustAxes(double pts[8][3], double bounds[6],
393  int idx, int xIdx, int yIdx, int zIdx, int zIdx2,
394  int xAxes, int yAxes, int zAxes,
395  double xCoords[4], double yCoords[4], double zCoords[4],
396  double xRange[2], double yRange[2], double zRange[2]);
397 
398 private:
399  // hide the superclass' ShallowCopy() from the user and the compiler.
400  void ShallowCopy(vtkProp *prop) override { this->vtkProp::ShallowCopy( prop ); };
401 private:
402  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
403  void operator=(const vtkCubeAxesActor2D&) = delete;
404 };
405 
406 
407 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:52
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:47
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
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:159
a actor that draws 2D data
Definition: vtkActor2D.h:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
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:132
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
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:39
a virtual camera for 3D rendering
Definition: vtkCamera.h:50
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
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
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.