VTK  9.5.20250803
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
27VTK_ABI_NAMESPACE_BEGIN
28class vtkMatrix4x4;
29class vtkViewport;
30
31class VTKRENDERINGGRIDAXES_EXPORT vtkGridAxesHelper : public vtkObject
32{
33public:
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
100
108
114
116
122 vtkGetObjectMacro(Matrix, vtkMatrix4x4);
124
132
137
145
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
181protected:
184
191 {
192 this->LabelVisibilityOverrides = overrides;
193 }
194 vtkTuple<bool, 4> GetLabelVisibilityOverrides() { return this->LabelVisibilityOverrides; }
195 friend class vtkGridAxesActor3D;
196
197private:
198 vtkGridAxesHelper(const vtkGridAxesHelper&) = delete;
199 void operator=(const vtkGridAxesHelper&) = delete;
200
201 double GridBounds[6];
202 int Face;
203 unsigned int LabelMask;
204 vtkMatrix4x4* Matrix;
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
225VTK_ABI_NAMESPACE_END
226#endif
actor for a cube-axes like prop in the 3D view.
is a helper object used by vtkGridAxesActor2D, vtkGridAxesActor3D, and vtkGridAxesPlane2DActor.
static vtkGridAxesHelper * New()
LabelMasks
Valid values for LabelMask.
void SetMatrix(vtkMatrix4x4 *)
Set the transform matrix to use to transform the points.
vtkTuple< vtkVector2i, 4 > GetViewportPoints() const
Get the positions for the plane points in viewport coordinates.
vtkVector2i GetActiveAxes()
Returns which of the 3 coordinate axes for the 2 axes for this plane: 0 for X axis,...
vtkTuple< bool, 4 > GetLabelVisibilityOverrides()
vtkTuple< vtkVector2d, 4 > GetViewportNormals() const
Get the normals to the axis vectors in viewport space.
vtkVector3d TransformPoint(const vtkVector3d &point)
Transforms the give point using the Matrix.
vtkTuple< vtkVector2d, 4 > GetViewportPointsAsDouble() const
vtkTuple< vtkVector3d, 4 > GetPoints()
Get the 4 points in world coordinates that define the grid plane.
bool UpdateForViewport(vtkViewport *viewport)
Call this method before accessing any of the attributes in viewport space.
vtkTuple< vtkVector2d, 4 > GetViewportVectors() const
Get the axis vectors formed using the points returned by GetViewportPoints().
vtkVector3d GetTransformedFaceNormal()
Get the normal to the grid plane face after applying the transform specified using transformation mat...
~vtkGridAxesHelper() override
vtkTuple< bool, 4 > GetLabelVisibilities()
Returns the visibility for labels for each of the 4 axis defined by the face points based on the Labe...
void SetLabelVisibilityOverrides(const vtkTuple< bool, 4 > &overrides)
Get/Set label visibility overrides.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkTuple< vtkVector3d, 4 > GetTransformedPoints()
Get the 4 points of the plane transformed using the transformation matrix set using SetMatrix(),...
a simple class to control print indentation
Definition vtkIndent.h:108
represent and manipulate 4x4 transformation matrices
abstract base class for most VTK objects
Definition vtkObject.h:162
templated base type for containers of constant size.
Definition vtkTuple.h:30
Some derived classes for the different vectors commonly used.
Definition vtkVector.h:450
abstract specification for Viewports
Definition vtkViewport.h:66
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287