VTK  9.6.20260422
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
16
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
166
168
174 void SetTitle(int axis, const std::string& title);
175 void SetXTitle(const std::string& title) { this->SetTitle(0, title); }
176 void SetYTitle(const std::string& title) { this->SetTitle(1, title); }
177 void SetZTitle(const std::string& title) { this->SetTitle(2, title); }
178 const std::string& GetTitle(int axis);
179 const std::string& GetXTitle() { return this->GetTitle(0); }
180 const std::string& GetYTitle() { return this->GetTitle(1); }
181 const std::string& GetZTitle() { return this->GetTitle(2); }
183
185
191 void SetUseCustomLabels(int axis, bool val);
192 void SetXUseCustomLabels(bool val) { this->SetUseCustomLabels(0, val); }
193 void SetYUseCustomLabels(bool val) { this->SetUseCustomLabels(1, val); }
194 void SetZUseCustomLabels(bool val) { this->SetUseCustomLabels(2, val); }
195 bool GetUseCustomLabels(int axis);
196 bool GetXUseCustomLabels() { return this->GetUseCustomLabels(0); }
197 bool GetYUseCustomLabels() { return this->GetUseCustomLabels(1); }
198 bool GetZUseCustomLabels() { return this->GetUseCustomLabels(2); }
199
200 void SetNumberOfLabels(int axis, vtkIdType val);
201 void SetNumberOfXLabels(vtkIdType val) { this->SetNumberOfLabels(0, val); }
202 void SetNumberOfYLabels(vtkIdType val) { this->SetNumberOfLabels(1, val); }
203 void SetNumberOfZLabels(vtkIdType val) { this->SetNumberOfLabels(2, val); }
208
209 void SetLabel(int axis, vtkIdType index, double value);
210 void SetXLabel(vtkIdType index, double value) { this->SetLabel(0, index, value); }
211 void SetYLabel(vtkIdType index, double value) { this->SetLabel(1, index, value); }
212 void SetZLabel(vtkIdType index, double value) { this->SetLabel(2, index, value); }
213 double GetLabel(int axis, vtkIdType index);
214 double GetXLabel(vtkIdType index) { return this->GetLabel(0, index); }
215 double GetYLabel(vtkIdType index) { return this->GetLabel(1, index); }
216 double GetZLabel(vtkIdType index) { return this->GetLabel(2, index); }
218
219 //---------------------------------------------------------------------------
220 // *** Properties to control the axis data labels ***
221
223
236
238
244 void SetNotation(int axis, int notation);
245 void SetXNotation(int notation) { this->SetNotation(0, notation); }
246 void SetYNotation(int notation) { this->SetNotation(1, notation); }
247 void SetZNotation(int notation) { this->SetNotation(2, notation); }
248 int GetNotation(int axis);
249 int GetXNotation() { return this->GetNotation(0); }
250 int GetYNotation() { return this->GetNotation(1); }
251 int GetZNotation() { return this->GetNotation(2); }
253
255
258 void SetPrecision(int axis, int val);
259 void SetXPrecision(int val) { this->SetPrecision(0, val); }
260 void SetYPrecision(int val) { this->SetPrecision(1, val); }
261 void SetZPrecision(int val) { this->SetPrecision(2, val); }
262 int GetPrecision(int axis);
263 int GetXPrecision() { return this->GetPrecision(0); }
264 int GetYPrecision() { return this->GetPrecision(1); }
265 int GetZPrecision() { return this->GetPrecision(2); }
267
269
275 void SetTickLabelFunction(int axis, std::function<double(double)> func);
276 std::function<double(double)> GetTickLabelFunction(int axis);
278
279 //--------------------------------------------------------------------------
280 // Methods for vtkProp3D API.
281 //--------------------------------------------------------------------------
282
284
287 double* GetBounds() override;
290
295 virtual void GetRenderedBounds(double bounds[6]);
296
298
303 vtkSetMacro(ForceOpaque, bool);
304 vtkGetMacro(ForceOpaque, bool);
305 vtkBooleanMacro(ForceOpaque, bool);
307
309
314 int RenderOverlay(vtkViewport* viewport) override;
317
324
326
333 virtual void SetLabelDisplayOffset(int xoffset, int yoffset);
334 virtual void SetLabelDisplayOffset(const int offset[2]);
336 VTK_WRAPEXCLUDE virtual void GetLabelDisplayOffset(int& xoffset, int& yoffset);
337 VTK_WRAPEXCLUDE virtual void GetLabelDisplayOffset(int offset[2]);
339
340protected:
343
344 virtual void Update(vtkViewport* viewport);
345
346private:
347 vtkGridAxesActor3D(const vtkGridAxesActor3D&) = delete;
348 void operator=(const vtkGridAxesActor3D&) = delete;
349
350 vtkMTimeType GetBoundsMTime = 0;
351 double GridBounds[6] = { -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 };
352 unsigned int FaceMask = 0;
353 bool LabelUniqueEdgesOnly = true;
354 vtkTuple<bool, 3> UseCustomLabels;
355 vtkTuple<vtkNew<vtkDoubleArray>, 3> CustomLabels;
356 vtkMTimeType CustomLabelsMTime = 0;
357
358 vtkTuple<vtkNew<vtkGridAxesActor2D>, 6> GridAxes2DActors;
359
360 bool ForceOpaque = false;
361};
362
363VTK_ABI_NAMESPACE_END
364#endif
dynamic, self-adjusting array of double
actor for an axes plane in a 3D view.
vtkTextProperty * GetZLabelTextProperty()
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
void SetLabel(int axis, vtkIdType index, double value)
Set whether the specified axis should use custom labels instead of automatically determined ones.
virtual void Update(vtkViewport *viewport)
void SetPrecision(int axis, int val)
Get/set the numerical precision to use, default is 2.
vtkTextProperty * GetZTitleTextProperty()
Get/Set the vtkTextProperty for the title for each the axes.
vtkTextProperty * GetYTitleTextProperty()
Get/Set the vtkTextProperty for the title for each the axes.
virtual void SetLabelDisplayOffset(int xoffset, int yoffset)
Set/Get the label display offset.
int GetZNotation()
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
vtkIdType GetNumberOfYLabels()
Set whether the specified axis should use custom labels instead of automatically determined ones.
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.
double GetYLabel(vtkIdType index)
Set whether the specified axis should use custom labels instead of automatically determined ones.
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.
int GetXNotation()
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
int GetYNotation()
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
const std::string & GetXTitle()
Get/Set the text to use for titles for the axis.
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).
double GetLabel(int axis, vtkIdType index)
Set whether the specified axis should use custom labels instead of automatically determined ones.
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.
bool GetYUseCustomLabels()
Set whether the specified axis should use custom labels instead of automatically determined ones.
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.
double GetXLabel(vtkIdType index)
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetXTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
bool GetUseCustomLabels(int axis)
Set whether the specified axis should use custom labels instead of automatically determined ones.
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 ...
vtkTextProperty * GetXTitleTextProperty()
Get/Set the vtkTextProperty for the title for each the axes.
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.
vtkIdType GetNumberOfZLabels()
Set whether the specified axis should use custom labels instead of automatically determined ones.
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.
int GetYPrecision()
Get/set the numerical precision to use, default is 2.
vtkIdType GetNumberOfLabels(int axis)
Set whether the specified axis should use custom labels instead of automatically determined ones.
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.
const std::string & GetZTitle()
Get/Set the text to use for titles for the axis.
const std::string & GetYTitle()
Get/Set the text to use for titles for the axis.
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 GetXPrecision()
Get/set the numerical precision to use, default is 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.
bool GetXUseCustomLabels()
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.
vtkTextProperty * GetXLabelTextProperty()
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.
vtkTextProperty * GetYLabelTextProperty()
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
double GetZLabel(vtkIdType index)
Set whether the specified axis should use custom labels instead of automatically determined ones.
vtkIdType GetNumberOfXLabels()
Set whether the specified axis should use custom labels instead of automatically determined ones.
void SetYLabel(vtkIdType index, double value)
Set whether the specified axis should use custom labels instead of automatically determined ones.
bool GetZUseCustomLabels()
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.
int GetZPrecision()
Get/set the numerical precision to use, default is 2.
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
void GetBounds(double bounds[6])
Return a reference to the Prop3D's composite transform.
an ordered list of Props
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:61
int vtkTypeBool
Definition vtkABI.h:64
int vtkIdType
Definition vtkType.h:363
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:318
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO
#define VTK_WRAPEXCLUDE