VTK  9.7.1
vtkGridAxesHelper.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
19 #ifndef vtkGridAxesHelper_h
20 #define vtkGridAxesHelper_h
21 
22 #include "vtkObject.h"
23 
24 #include "vtkRenderingGridAxesModule.h" //needed for exports
25 #include "vtkVector.h" // needed for vtkVector.
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkMatrix4x4;
29 class vtkViewport;
30 
31 class VTKRENDERINGGRIDAXES_EXPORT vtkGridAxesHelper : public vtkObject
32 {
33 public:
34  static vtkGridAxesHelper* New();
35  vtkTypeMacro(vtkGridAxesHelper, vtkObject);
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
39 
46  vtkSetVector6Macro(GridBounds, double);
47  vtkGetVector6Macro(GridBounds, double);
49 
50  // These are deliberately in the same order as the faces of a vtkVoxel.
51  enum Faces : unsigned char
52  {
53  MIN_YZ = 0x01,
54  MIN_ZX = 0x02,
55  MIN_XY = 0x04,
56  MAX_YZ = 0x08,
57  MAX_ZX = 0x010,
58  MAX_XY = 0x020
59  };
60 
62 
67  vtkSetClampMacro(Face, int, MIN_YZ, MAX_XY);
68  vtkGetMacro(Face, int);
70 
74  enum LabelMasks : unsigned char
75  {
76  MIN_X = 0x01,
77  MIN_Y = 0x02,
78  MIN_Z = 0x04,
79  MAX_X = 0x08,
80  MAX_Y = 0x010,
81  MAX_Z = 0x020
82  };
83 
85 
90  vtkSetMacro(LabelMask, unsigned int);
91  vtkGetMacro(LabelMask, unsigned int);
93 
99  vtkTuple<vtkVector3d, 4> GetPoints();
100 
107  vtkVector2i GetActiveAxes();
108 
113  vtkTuple<bool, 4> GetLabelVisibilities();
114 
116 
121  void SetMatrix(vtkMatrix4x4*);
122  vtkGetObjectMacro(Matrix, vtkMatrix4x4);
124 
131  vtkTuple<vtkVector3d, 4> GetTransformedPoints();
132 
136  vtkVector3d TransformPoint(const vtkVector3d& point);
137 
144  vtkVector3d GetTransformedFaceNormal();
145 
151  bool UpdateForViewport(vtkViewport* viewport);
152 
156  vtkTuple<vtkVector2i, 4> GetViewportPoints() const { return this->ViewportPoints; }
158  {
159  return this->ViewportPointsAsDouble;
160  }
161 
166  vtkTuple<vtkVector2d, 4> GetViewportVectors() const { return this->ViewportVectors; }
167 
172  vtkTuple<vtkVector2d, 4> GetViewportNormals() const { return this->ViewportNormals; }
173 
175 
178  vtkGetMacro(Backface, bool);
180 
181 protected:
183  ~vtkGridAxesHelper() override;
184 
191  {
192  this->LabelVisibilityOverrides = overrides;
193  }
194  vtkTuple<bool, 4> GetLabelVisibilityOverrides() { return this->LabelVisibilityOverrides; }
195  friend class vtkGridAxesActor3D;
196 
197 private:
198  vtkGridAxesHelper(const vtkGridAxesHelper&) = delete;
199  void operator=(const vtkGridAxesHelper&) = delete;
200 
201  double GridBounds[6];
202  int Face;
203  unsigned int LabelMask;
205 
207  vtkVector2i ActiveAxes;
208  vtkTuple<bool, 4> LabelVisibilities;
209  vtkTuple<bool, 4> ComputedLabelVisibilities;
210  vtkTuple<bool, 4> LabelVisibilityOverrides;
211 
212  vtkTuple<vtkVector3d, 4> TransformedPoints;
213  vtkVector3d TransformedFaceNormal;
214 
215  vtkTuple<vtkVector2i, 4> ViewportPoints;
216  vtkTuple<vtkVector2d, 4> ViewportPointsAsDouble;
217  vtkTuple<vtkVector2d, 4> ViewportVectors;
218  vtkTuple<vtkVector2d, 4> ViewportNormals;
219  bool Backface;
220 
221  vtkMTimeType GetPointsMTime = 0;
222  vtkMTimeType GetTransformedPointsMTime = 0;
223 };
224 
225 VTK_ABI_NAMESPACE_END
226 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
represent and manipulate 4x4 transformation matrices
Definition: vtkMatrix4x4.h:31
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTypeUInt32 vtkMTimeType
Definition: vtkType.h:318
abstract specification for Viewports
Definition: vtkViewport.h:46
void SetLabelVisibilityOverrides(const vtkTuple< bool, 4 > &overrides)
Get/Set label visibility overrides.
vtkTuple< vtkVector2d, 4 > GetViewportNormals() const
Get the normals to the axis vectors in viewport space.
vtkTuple< bool, 4 > GetLabelVisibilityOverrides()
vtkTuple< vtkVector2d, 4 > GetViewportPointsAsDouble() const
LabelMasks
Valid values for LabelMask.
actor for a cube-axes like prop in the 3D view.
a simple class to control print indentation
Definition: vtkIndent.h:28
Some derived classes for the different vectors commonly used.
Definition: vtkVector.h:410
vtkTuple< vtkVector2i, 4 > GetViewportPoints() const
Get the positions for the plane points in viewport coordinates.
is a helper object used by vtkGridAxesActor2D, vtkGridAxesActor3D, and vtkGridAxesPlane2DActor.
vtkTuple< vtkVector2d, 4 > GetViewportVectors() const
Get the axis vectors formed using the points returned by GetViewportPoints().
vtkMatrix4x4 * Matrix
Definition: vtkProp3D.h:392
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...