VTK  9.5.2
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
26#include <functional> // for std::function
27
28VTK_ABI_NAMESPACE_BEGIN
29class vtkDoubleArray;
31class vtkProperty;
32class vtkTextProperty;
33
34class VTKRENDERINGGRIDAXES_EXPORT vtkGridAxesActor3D : public vtkProp3D
35{
36public:
39 void PrintSelf(ostream& os, vtkIndent indent) override;
40
44 void ShallowCopy(vtkProp* prop) override;
45
47
52 vtkSetVector6Macro(GridBounds, double);
53 vtkGetVector6Macro(GridBounds, double);
55
57
64 virtual void SetFaceMask(unsigned int mask);
65 vtkGetMacro(FaceMask, unsigned int);
67
69
74 virtual void SetLabelMask(unsigned int mask);
75 unsigned int GetLabelMask();
77
87
93
95
101 vtkSetMacro(LabelUniqueEdgesOnly, bool);
102 vtkGetMacro(LabelUniqueEdgesOnly, bool);
104
106
111 void SetGenerateGrid(bool val);
113 vtkBooleanMacro(GenerateGrid, bool);
115
117
123 void SetGenerateEdges(bool val);
125 vtkBooleanMacro(GenerateEdges, bool);
127
129
135 void SetGenerateTicks(bool val);
137 vtkBooleanMacro(GenerateTicks, bool);
139
141
147
148 //---------------------------------------------------------------------------
149 // *** Properties to control the axis titles ***
150
152
157 void SetXTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(0, prop); }
158 void SetYTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(1, prop); }
159 void SetZTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(2, prop); }
162
164
170 void SetTitle(int axis, const std::string& title);
171 void SetXTitle(const std::string& title) { this->SetTitle(0, title); }
172 void SetYTitle(const std::string& title) { this->SetTitle(1, title); }
173 void SetZTitle(const std::string& title) { this->SetTitle(2, title); }
174 const std::string& GetTitle(int axis);
176
178
184 void SetUseCustomLabels(int axis, bool val);
185 void SetXUseCustomLabels(bool val) { this->SetUseCustomLabels(0, val); }
186 void SetYUseCustomLabels(bool val) { this->SetUseCustomLabels(1, val); }
187 void SetZUseCustomLabels(bool val) { this->SetUseCustomLabels(2, val); }
188
189 void SetNumberOfLabels(int axis, vtkIdType val);
190 void SetNumberOfXLabels(vtkIdType val) { this->SetNumberOfLabels(0, val); }
191 void SetNumberOfYLabels(vtkIdType val) { this->SetNumberOfLabels(1, val); }
192 void SetNumberOfZLabels(vtkIdType val) { this->SetNumberOfLabels(2, val); }
193
194 void SetLabel(int axis, vtkIdType index, double value);
195 void SetXLabel(vtkIdType index, double value) { this->SetLabel(0, index, value); }
196 void SetYLabel(vtkIdType index, double value) { this->SetLabel(1, index, value); }
197 void SetZLabel(vtkIdType index, double value) { this->SetLabel(2, index, value); }
199
200 //---------------------------------------------------------------------------
201 // *** Properties to control the axis data labels ***
202
204
209 void SetXLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(0, prop); }
210 void SetYLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(1, prop); }
211 void SetZLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(2, prop); }
214
216
222 void SetNotation(int axis, int notation);
223 void SetXNotation(int notation) { this->SetNotation(0, notation); }
224 void SetYNotation(int notation) { this->SetNotation(1, notation); }
225 void SetZNotation(int notation) { this->SetNotation(2, notation); }
226 int GetNotation(int axis);
228
230
233 void SetPrecision(int axis, int val);
234 void SetXPrecision(int val) { this->SetPrecision(0, val); }
235 void SetYPrecision(int val) { this->SetPrecision(1, val); }
236 void SetZPrecision(int val) { this->SetPrecision(2, val); }
237 int GetPrecision(int axis);
239
241
247 void SetTickLabelFunction(int axis, std::function<double(double)> func);
248 std::function<double(double)> GetTickLabelFunction(int axis);
250
251 //--------------------------------------------------------------------------
252 // Methods for vtkProp3D API.
253 //--------------------------------------------------------------------------
254
256
259 double* GetBounds() override;
260 using Superclass::GetBounds;
262
267 virtual void GetRenderedBounds(double bounds[6]);
268
270
275 vtkSetMacro(ForceOpaque, bool);
276 vtkGetMacro(ForceOpaque, bool);
277 vtkBooleanMacro(ForceOpaque, bool);
279
281
286 int RenderOverlay(vtkViewport* viewport) override;
289
296
298
305 virtual void SetLabelDisplayOffset(int xoffset, int yoffset);
306 virtual void SetLabelDisplayOffset(const int offset[2]);
308 VTK_WRAPEXCLUDE virtual void GetLabelDisplayOffset(int& xoffset, int& yoffset);
309 VTK_WRAPEXCLUDE virtual void GetLabelDisplayOffset(int offset[2]);
311
312protected:
315
316 virtual void Update(vtkViewport* viewport);
317
318private:
319 vtkGridAxesActor3D(const vtkGridAxesActor3D&) = delete;
320 void operator=(const vtkGridAxesActor3D&) = delete;
321
322 vtkMTimeType GetBoundsMTime = 0;
323 double GridBounds[6] = { -1.0, 1.0, -1.0, 1.0, -1.0, 1.0 };
324 unsigned int FaceMask = 0;
325 bool LabelUniqueEdgesOnly = true;
326 vtkTuple<bool, 3> UseCustomLabels;
327 vtkTuple<vtkNew<vtkDoubleArray>, 3> CustomLabels;
328 vtkMTimeType CustomLabelsMTime = 0;
329
330 vtkTuple<vtkNew<vtkGridAxesActor2D>, 6> GridAxes2DActors;
331
332 bool ForceOpaque = false;
333};
334
335VTK_ABI_NAMESPACE_END
336#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_WRAPEXCLUDE