VTK  9.5.20250715
vtkGridAxesActor3D.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
17#ifndef vtkGridAxesActor3D_h
18#define vtkGridAxesActor3D_h
19
20#include "vtkProp3D.h"
21#include "vtkRenderingGridAxesModule.h" //needed for exports
22
23#include "vtkGridAxesHelper.h" // needed for vtkGridAxesHelper.
24#include "vtkNew.h" // needed for vtkNew.
25#include "vtkWrappingHints.h"
26
27#include <functional> // for std::function
28
29VTK_ABI_NAMESPACE_BEGIN
30class vtkDoubleArray;
32class vtkProperty;
33class vtkTextProperty;
34
35class VTKRENDERINGGRIDAXES_EXPORT VTK_MARSHALAUTO vtkGridAxesActor3D : public vtkProp3D
36{
37public:
40 void PrintSelf(ostream& os, vtkIndent indent) override;
41
45 void ShallowCopy(vtkProp* prop) override;
46
48
53 vtkSetVector6Macro(GridBounds, double);
54 vtkGetVector6Macro(GridBounds, double);
56
58
65 virtual void SetFaceMask(unsigned int mask);
66 vtkGetMacro(FaceMask, unsigned int);
68
70
75 virtual void SetLabelMask(unsigned int mask);
76 unsigned int GetLabelMask();
78
88
94
96
102 vtkSetMacro(LabelUniqueEdgesOnly, bool);
103 vtkGetMacro(LabelUniqueEdgesOnly, bool);
105
107
112 void SetGenerateGrid(bool val);
114 vtkBooleanMacro(GenerateGrid, bool);
116
118
124 void SetGenerateEdges(bool val);
126 vtkBooleanMacro(GenerateEdges, bool);
128
130
136 void SetGenerateTicks(bool val);
138 vtkBooleanMacro(GenerateTicks, bool);
140
142
148
149 //---------------------------------------------------------------------------
150 // *** Properties to control the axis titles ***
151
153
158 void SetXTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(0, prop); }
159 void SetYTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(1, prop); }
160 void SetZTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(2, prop); }
163
165
171 void SetTitle(int axis, const std::string& title);
172 void SetXTitle(const std::string& title) { this->SetTitle(0, title); }
173 void SetYTitle(const std::string& title) { this->SetTitle(1, title); }
174 void SetZTitle(const std::string& title) { this->SetTitle(2, title); }
175 const std::string& GetTitle(int axis);
177
179
185 void SetUseCustomLabels(int axis, bool val);
186 void SetXUseCustomLabels(bool val) { this->SetUseCustomLabels(0, val); }
187 void SetYUseCustomLabels(bool val) { this->SetUseCustomLabels(1, val); }
188 void SetZUseCustomLabels(bool val) { this->SetUseCustomLabels(2, val); }
189
190 void SetNumberOfLabels(int axis, vtkIdType val);
191 void SetNumberOfXLabels(vtkIdType val) { this->SetNumberOfLabels(0, val); }
192 void SetNumberOfYLabels(vtkIdType val) { this->SetNumberOfLabels(1, val); }
193 void SetNumberOfZLabels(vtkIdType val) { this->SetNumberOfLabels(2, val); }
194
195 void SetLabel(int axis, vtkIdType index, double value);
196 void SetXLabel(vtkIdType index, double value) { this->SetLabel(0, index, value); }
197 void SetYLabel(vtkIdType index, double value) { this->SetLabel(1, index, value); }
198 void SetZLabel(vtkIdType index, double value) { this->SetLabel(2, index, value); }
200
201 //---------------------------------------------------------------------------
202 // *** Properties to control the axis data labels ***
203
205
210 void SetXLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(0, prop); }
211 void SetYLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(1, prop); }
212 void SetZLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(2, prop); }
215
217
223 void SetNotation(int axis, int notation);
224 void SetXNotation(int notation) { this->SetNotation(0, notation); }
225 void SetYNotation(int notation) { this->SetNotation(1, notation); }
226 void SetZNotation(int notation) { this->SetNotation(2, notation); }
227 int GetNotation(int axis);
229
231
234 void SetPrecision(int axis, int val);
235 void SetXPrecision(int val) { this->SetPrecision(0, val); }
236 void SetYPrecision(int val) { this->SetPrecision(1, val); }
237 void SetZPrecision(int val) { this->SetPrecision(2, val); }
238 int GetPrecision(int axis);
240
242
248 void SetTickLabelFunction(int axis, std::function<double(double)> func);
249 std::function<double(double)> GetTickLabelFunction(int axis);
251
252 //--------------------------------------------------------------------------
253 // Methods for vtkProp3D API.
254 //--------------------------------------------------------------------------
255
257
260 double* GetBounds() override;
261 using Superclass::GetBounds;
263
268 virtual void GetRenderedBounds(double bounds[6]);
269
271
276 vtkSetMacro(ForceOpaque, bool);
277 vtkGetMacro(ForceOpaque, bool);
278 vtkBooleanMacro(ForceOpaque, bool);
280
282
287 int RenderOverlay(vtkViewport* viewport) override;
290
297
299
306 virtual void SetLabelDisplayOffset(int xoffset, int yoffset);
307 virtual void SetLabelDisplayOffset(const int offset[2]);
309 VTK_WRAPEXCLUDE virtual void GetLabelDisplayOffset(int& xoffset, int& yoffset);
310 VTK_WRAPEXCLUDE virtual void GetLabelDisplayOffset(int offset[2]);
312
313protected:
316
317 virtual void Update(vtkViewport* viewport);
318
319private:
320 vtkGridAxesActor3D(const vtkGridAxesActor3D&) = delete;
321 void operator=(const vtkGridAxesActor3D&) = delete;
322
323 vtkMTimeType GetBoundsMTime = 0;
324 double GridBounds[6] = { -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 };
325 unsigned int FaceMask = 0;
326 bool LabelUniqueEdgesOnly = true;
327 vtkTuple<bool, 3> UseCustomLabels;
328 vtkTuple<vtkNew<vtkDoubleArray>, 3> CustomLabels;
329 vtkMTimeType CustomLabelsMTime = 0;
330
331 vtkTuple<vtkNew<vtkGridAxesActor2D>, 6> GridAxes2DActors;
332
333 bool ForceOpaque = false;
334};
335
336VTK_ABI_NAMESPACE_END
337#endif
dynamic, self-adjusting array of double
actor for an axes plane in a 3D view.
actor for a cube-axes like prop in the 3D view.
void SetLabel(int axis, vtkIdType index, double value)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetPrecision(int axis, int val)
Get/set the numerical precision to use, default is 2.
virtual void SetLabelDisplayOffset(int xoffset, int yoffset)
Set/Get the label display offset.
virtual void SetFaceMask(unsigned int mask)
Set the mask to select faces.
int RenderOpaqueGeometry(vtkViewport *) override
Standard render methods for different types of geometry.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetLabelTextProperty(int axis, vtkTextProperty *)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
int GetPrecision(int axis)
Get/set the numerical precision to use, default is 2.
void SetYTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
void SetZNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
void SetZTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
vtkProperty * GetProperty()
Get/Set the property used to control the appearance of the rendered grid.
void SetZLabel(vtkIdType index, double value)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetYUseCustomLabels(bool val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetNumberOfZLabels(vtkIdType val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Standard render methods for different types of geometry.
void SetGenerateGrid(bool val)
Turn off to not generate polydata for the plane's grid.
void SetZUseCustomLabels(bool val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetZLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
int GetNotation(int axis)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
vtkTextProperty * GetTitleTextProperty(int axis)
Get/Set the vtkTextProperty for the title for each the axes.
void SetTitleTextProperty(int axis, vtkTextProperty *)
Get/Set the vtkTextProperty for the title for each the axes.
void SetNumberOfLabels(int axis, vtkIdType val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetUseCustomLabels(int axis, bool val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
const std::string & GetTitle(int axis)
Get/Set the text to use for titles for the axis.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this prop.
unsigned int GetLabelMask()
Set the axis to label.
virtual void SetLabelMask(unsigned int mask)
Set the axis to label.
void SetXTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
bool GetGenerateEdges()
Turn off to not generate the polydata for the plane's edges.
void SetNumberOfXLabels(vtkIdType val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
bool GetGenerateGrid()
Turn off to not generate polydata for the plane's grid.
void SetNotation(int axis, int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
double * GetBounds() override
Returns the prop bounds.
virtual int * GetLabelDisplayOffset()
Set/Get the label display offset.
virtual void GetRenderedBounds(double bounds[6])
Get an bounding box that is expected to contain all rendered elements, since GetBounds() returns the ...
void SetNumberOfYLabels(vtkIdType val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetProperty(vtkProperty *)
Get/Set the property used to control the appearance of the rendered grid.
void SetZTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
virtual void SetLabelDisplayOffset(const int offset[2])
Set/Get the label display offset.
void SetTitle(int axis, const std::string &title)
Get/Set the text to use for titles for the axis.
void SetGenerateEdges(bool val)
Turn off to not generate the polydata for the plane's edges.
std::function< double(double)> GetTickLabelFunction(int axis)
Get/Set the function that will be applied to the tick label of each axis.
void SetXNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
static vtkGridAxesActor3D * New()
void ShallowCopy(vtkProp *prop) override
Shallow copy from another vtkGridAxesActor3D.
void SetXLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
void UpdateGeometry(vtkViewport *vp)
Updates the billboard geometry without performing any rendering, to assist GetActors().
void SetYNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
int RenderOverlay(vtkViewport *viewport) override
Standard render methods for different types of geometry.
void SetXPrecision(int val)
Get/set the numerical precision to use, default is 2.
void SetXLabel(vtkIdType index, double value)
Set whether the specified axis should use custom labels instead of automatically determined ones.
vtkTextProperty * GetLabelTextProperty(int axis)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
bool GetGenerateTicks()
Turn off to not generate the markers for the tick positions.
void SetXUseCustomLabels(bool val)
Set whether the specified axis should use custom labels instead of automatically determined ones.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Standard render methods for different types of geometry.
void SetYPrecision(int val)
Get/set the numerical precision to use, default is 2.
void SetGenerateTicks(bool val)
Turn off to not generate the markers for the tick positions.
void SetZPrecision(int val)
Get/set the numerical precision to use, default is 2.
void SetYLabel(vtkIdType index, double value)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetTickLabelFunction(int axis, std::function< double(double)> func)
Get/Set the function that will be applied to the tick label of each axis.
void SetYTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
void SetYLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
void SetXTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
a simple class to control print indentation
Definition vtkIndent.h:108
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:89
an ordered list of Props
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
represent surface properties of a geometric object
represent text properties.
templated base type for containers of constant size.
Definition vtkTuple.h:30
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:332
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:287
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO
#define VTK_WRAPEXCLUDE