vtkGridAxes3DActor.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
14 #ifndef vtkGridAxes3DActor_h
15 #define vtkGridAxes3DActor_h
16 
17 #include "vtkProp3D.h"
18 #include "vtkRemotingViewsModule.h" //needed for exports
19 
20 #include "vtkGridAxesHelper.h" // needed for vtkGridAxesHelper.
21 #include "vtkNew.h" // needed for vtkNew.
22 
23 #include <functional> // for std::function
24 
25 class vtkDoubleArray;
26 class vtkGridAxes2DActor;
27 class vtkProperty;
28 class vtkTextProperty;
29 
31 {
32 public:
33  static vtkGridAxes3DActor* New();
34  vtkTypeMacro(vtkGridAxes3DActor, vtkProp3D);
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
40  void ShallowCopy(vtkProp* prop) override;
41 
43 
48  vtkSetVector6Macro(GridBounds, double);
49  vtkGetVector6Macro(GridBounds, double);
51 
57  enum FaceMasks
58  {
59  MIN_YZ = 0x01,
60  MIN_ZX = 0x02,
61  MIN_XY = 0x04,
62  MAX_YZ = 0x08,
63  MAX_ZX = 0x010,
64  MAX_XY = 0x020
65  };
66 
68 
73  virtual void SetFaceMask(unsigned int mask);
74  vtkGetMacro(FaceMask, unsigned int);
76 
78  {
85  };
86 
88 
91  virtual void SetLabelMask(unsigned int mask);
92  unsigned int GetLabelMask();
94 
103  void GetActors(vtkPropCollection*) override;
104 
109  void UpdateGeometry(vtkViewport* vp);
110 
112 
116  vtkSetMacro(LabelUniqueEdgesOnly, bool);
117  vtkGetMacro(LabelUniqueEdgesOnly, bool);
119 
121 
124  void SetGenerateGrid(bool val);
125  bool GetGenerateGrid();
126  vtkBooleanMacro(GenerateGrid, bool);
128 
130 
134  void SetGenerateEdges(bool val);
135  bool GetGenerateEdges();
136  vtkBooleanMacro(GenerateEdges, bool);
138 
140 
144  void SetGenerateTicks(bool val);
145  bool GetGenerateTicks();
146  vtkBooleanMacro(GenerateTicks, bool);
148 
150 
153  void SetProperty(vtkProperty*);
154  vtkProperty* GetProperty();
156 
157  //---------------------------------------------------------------------------
158  // *** Properties to control the axis titles ***
159 
161 
165  void SetTitleTextProperty(int axis, vtkTextProperty*);
166  void SetXTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(0, prop); }
167  void SetYTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(1, prop); }
168  void SetZTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(2, prop); }
169  vtkTextProperty* GetTitleTextProperty(int axis);
171 
173 
177  void SetTitle(int axis, const std::string& title);
178  void SetXTitle(const std::string& title) { this->SetTitle(0, title); }
179  void SetYTitle(const std::string& title) { this->SetTitle(1, title); }
180  void SetZTitle(const std::string& title) { this->SetTitle(2, title); }
181  const std::string& GetTitle(int axis);
183 
188  void SetUseCustomLabels(int axis, bool val);
189  void SetXUseCustomLabels(bool val) { this->SetUseCustomLabels(0, val); }
190  void SetYUseCustomLabels(bool val) { this->SetUseCustomLabels(1, val); }
191  void SetZUseCustomLabels(bool val) { this->SetUseCustomLabels(2, val); }
192 
193  void SetNumberOfLabels(int axis, vtkIdType val);
194  void SetNumberOfXLabels(vtkIdType val) { this->SetNumberOfLabels(0, val); }
195  void SetNumberOfYLabels(vtkIdType val) { this->SetNumberOfLabels(1, val); }
196  void SetNumberOfZLabels(vtkIdType val) { this->SetNumberOfLabels(2, val); }
197 
198  void SetLabel(int axis, vtkIdType index, double value);
199  void SetXLabel(vtkIdType index, double value) { this->SetLabel(0, index, value); }
200  void SetYLabel(vtkIdType index, double value) { this->SetLabel(1, index, value); }
201  void SetZLabel(vtkIdType index, double value) { this->SetLabel(2, index, value); }
202 
203  //---------------------------------------------------------------------------
204  // *** Properties to control the axis data labels ***
205 
207 
211  void SetLabelTextProperty(int axis, vtkTextProperty*);
212  void SetXLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(0, prop); }
213  void SetYLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(1, prop); }
214  void SetZLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(2, prop); }
215  vtkTextProperty* GetLabelTextProperty(int axis);
217 
219 
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 
274  vtkSetMacro(ForceOpaque, bool);
275  vtkGetMacro(ForceOpaque, bool);
276  vtkBooleanMacro(ForceOpaque, bool);
278 
279  int RenderOpaqueGeometry(vtkViewport*) override;
280  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
281  int RenderOverlay(vtkViewport* viewport) override;
282  int HasTranslucentPolygonalGeometry() override;
283  void ReleaseGraphicsResources(vtkWindow*) override;
284 
285 protected:
287  ~vtkGridAxes3DActor() override;
288 
289  virtual void Update(vtkViewport* viewport);
290 
291  double GridBounds[6];
292  unsigned int FaceMask;
293  unsigned int LabelMask;
298 
300 
302 
303 private:
304  vtkGridAxes3DActor(const vtkGridAxes3DActor&) = delete;
305  void operator=(const vtkGridAxes3DActor&) = delete;
306 
307  vtkMTimeType GetBoundsMTime;
308 };
309 
310 #endif
void SetNumberOfXLabels(vtkIdType val)
void SetZTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
void SetYLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
void SetYUseCustomLabels(bool val)
void SetZNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
#define VTKREMOTINGVIEWS_EXPORT
virtual int RenderOpaqueGeometry(vtkViewport *)
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOverlay(vtkViewport *)
void SetNumberOfZLabels(vtkIdType val)
void SetYTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
FaceMasks
Values for FaceMask.
vtkTuple< vtkNew< vtkDoubleArray >, 3 > CustomLabels
void SetXUseCustomLabels(bool val)
virtual void Update()
int vtkIdType
void SetYLabel(vtkIdType index, double value)
vtkTypeUInt64 vtkMTimeType
void SetYNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
void SetZLabel(vtkIdType index, double value)
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual double * GetBounds()
void SetXLabel(vtkIdType index, double value)
void SetYTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
void ShallowCopy(vtkProp *prop)
void SetZPrecision(int val)
Get/set the numerical precision to use, default is 2.
void PrintSelf(ostream &os, vtkIndent indent)
void SetZUseCustomLabels(bool val)
vtkMTimeType CustomLabelsMTime
void SetXLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
void SetXNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
vtkTuple< bool, 3 > UseCustomLabels
vtkTuple< vtkNew< vtkGridAxes2DActor >, 6 > GridAxes2DActors
actor for a cube-axes like prop in the 3D view.
void SetZTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
void SetXPrecision(int val)
Get/set the numerical precision to use, default is 2.
value
void SetZLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
void SetXTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
actor for an axes plane in a 3D view.
virtual double * GetBounds()=0
static vtkObject * New()
index
void SetYPrecision(int val)
Get/set the numerical precision to use, default is 2.
void SetNumberOfYLabels(vtkIdType val)
void operator=(const vtkObjectBase &)
virtual void GetActors(vtkPropCollection *)
void SetXTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
title