VTK  9.1.0
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 =========================================================================*/
65 #ifndef vtkCubeAxesActor2D_h
66 #define vtkCubeAxesActor2D_h
67 
68 #include "vtkActor2D.h"
69 #include "vtkRenderingAnnotationModule.h" // For export macro
70 
71 class vtkAlgorithmOutput;
72 class vtkAxisActor2D;
73 class vtkCamera;
74 class vtkCubeAxesActor2DConnection;
75 class vtkDataSet;
76 class vtkTextProperty;
77 
78 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
79 {
80 public:
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
90 
92 
95  int RenderOverlay(vtkViewport*) override;
97  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
99 
104 
106 
112  virtual void SetInputData(vtkDataSet*);
113  virtual vtkDataSet* GetInput();
115 
117 
122  void SetViewProp(vtkProp* prop);
123  vtkGetObjectMacro(ViewProp, vtkProp);
125 
127 
133  vtkSetVector6Macro(Bounds, double);
134  double* GetBounds() VTK_SIZEHINT(6) override;
135  void GetBounds(
136  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
137  void GetBounds(double bounds[6]);
139 
141 
146  vtkSetVector6Macro(Ranges, double);
147  double* GetRanges() VTK_SIZEHINT(6);
148  void GetRanges(
149  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
150  void GetRanges(double ranges[6]);
152 
154 
159  vtkSetMacro(XOrigin, double);
160  vtkSetMacro(YOrigin, double);
161  vtkSetMacro(ZOrigin, double);
163 
165 
170  vtkSetMacro(UseRanges, vtkTypeBool);
171  vtkGetMacro(UseRanges, vtkTypeBool);
172  vtkBooleanMacro(UseRanges, vtkTypeBool);
174 
176 
180  virtual void SetCamera(vtkCamera*);
181  vtkGetObjectMacro(Camera, vtkCamera);
183 
184  enum FlyMode
185  {
186  VTK_FLY_OUTER_EDGES = 0,
187  VTK_FLY_CLOSEST_TRIAD = 1,
188  VTK_FLY_NONE = 2
189  };
190 
192 
197  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
198  vtkGetMacro(FlyMode, int);
199  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
200  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
201  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
203 
205 
211  vtkSetMacro(Scaling, vtkTypeBool);
212  vtkGetMacro(Scaling, vtkTypeBool);
213  vtkBooleanMacro(Scaling, vtkTypeBool);
215 
217 
222  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
223  vtkGetMacro(NumberOfLabels, int);
225 
227 
231  vtkSetStringMacro(XLabel);
232  vtkGetStringMacro(XLabel);
233  vtkSetStringMacro(YLabel);
234  vtkGetStringMacro(YLabel);
235  vtkSetStringMacro(ZLabel);
236  vtkGetStringMacro(ZLabel);
238 
243  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
244  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
245  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
246 
248 
253  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
255 
257 
262  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
264 
266 
270  vtkSetStringMacro(LabelFormat);
271  vtkGetStringMacro(LabelFormat);
273 
275 
279  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
280  vtkGetMacro(FontFactor, double);
282 
284 
289  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
290  vtkGetMacro(Inertia, int);
292 
294 
302  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
303  vtkGetMacro(ShowActualBounds, int);
305 
307 
312  vtkSetMacro(CornerOffset, double);
313  vtkGetMacro(CornerOffset, double);
315 
322 
324 
327  vtkSetMacro(XAxisVisibility, vtkTypeBool);
328  vtkGetMacro(XAxisVisibility, vtkTypeBool);
329  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
330  vtkSetMacro(YAxisVisibility, vtkTypeBool);
331  vtkGetMacro(YAxisVisibility, vtkTypeBool);
332  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
333  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
334  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
335  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
337 
342 
343 protected:
346 
347  vtkCubeAxesActor2DConnection* ConnectionHolder;
348 
349  vtkProp* ViewProp; // Define bounds from actor/assembly, or
350  double Bounds[6]; // Define bounds explicitly
351  double Ranges[6]; // Define ranges explicitly
352  vtkTypeBool UseRanges; // Flag to use ranges or not
353 
355  int FlyMode;
357 
361 
364 
366 
368  char* XLabel;
369  char* YLabel;
370  char* ZLabel;
371  char* Labels[3];
372 
376 
377  char* LabelFormat;
378  double FontFactor;
379  double CornerOffset;
380  int Inertia;
382  int InertiaAxes[8];
383 
385 
386  // Always show the actual bounds of the object
388 
389  double XOrigin;
390  double YOrigin;
391  double ZOrigin;
392 
393  // various helper methods
394  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
395  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
396  double EvaluatePoint(double planes[24], double x[3]);
397  double EvaluateBounds(double planes[24], double bounds[6]);
398  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
399  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
400  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
401 
402 private:
403  // hide the superclass' ShallowCopy() from the user and the compiler.
404  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
405 
406 private:
407  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
408  void operator=(const vtkCubeAxesActor2D&) = delete;
409 };
410 
411 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:149
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
a virtual camera for 3D rendering
Definition: vtkCamera.h:155
create a 2D plot of a bounding box edges - used for navigation
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RenderOverlay(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
void SetViewProp(vtkProp *prop)
Use the bounding box of this prop to draw the cube axes.
vtkAxisActor2D * YAxis
virtual void SetAxisTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property of all axes.
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
double EvaluatePoint(double planes[24], double x[3])
double EvaluateBounds(double planes[24], double bounds[6])
virtual void SetInputData(vtkDataSet *)
Use the bounding box of this input dataset to draw the cube axes.
int RenderOpaqueGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
virtual void SetAxisLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property of all axes.
void SetFlyModeToClosestTriad()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
double * GetBounds() override
Explicitly specify the region in space around which to draw the bounds.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
void SetFlyModeToNone()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
static vtkCubeAxesActor2D * New()
Instantiate object with bold, italic, and shadow enabled; font family set to Arial; and label format ...
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkAxisActor2D * GetZAxisActor2D()
int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6])
vtkAxisActor2D * ZAxis
vtkTextProperty * AxisLabelTextProperty
void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx, int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4], double zCoords[4], double xRange[2], double yRange[2], double zRange[2])
vtkAxisActor2D * GetXAxisActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example)
vtkAxisActor2D * XAxis
virtual vtkDataSet * GetInput()
Use the bounding box of this input dataset to draw the cube axes.
virtual void SetInputConnection(vtkAlgorithmOutput *)
Use the bounding box of this input dataset to draw the cube axes.
vtkAxisActor2D * GetYAxisActor2D()
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkCubeAxesActor2DConnection * ConnectionHolder
~vtkCubeAxesActor2D() override
vtkTextProperty * AxisTitleTextProperty
void TransformBounds(vtkViewport *viewport, double bounds[6], double pts[8][3])
void ShallowCopy(vtkCubeAxesActor2D *actor)
Shallow copy of a CubeAxesActor2D.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
a simple class to control print indentation
Definition: vtkIndent.h:113
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:67
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:52
abstract specification for Viewports
Definition: vtkViewport.h:47
window superclass for vtkRenderWindow
Definition: vtkWindow.h:36
void GetBounds(T a, double bds[6])
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_SIZEHINT(...)