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 
30 class VTKREMOTINGVIEWS_EXPORT vtkGridAxes3DActor : public vtkProp3D
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
vtkObjectBase::operator=
void operator=(const vtkObjectBase &)
vtkGridAxes3DActor::SetNumberOfYLabels
void SetNumberOfYLabels(vtkIdType val)
Definition: vtkGridAxes3DActor.h:195
double
double
vtkGridAxes3DActor::SetYTitle
void SetYTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
Definition: vtkGridAxes3DActor.h:179
vtkGridAxes3DActor::ForceOpaque
bool ForceOpaque
Definition: vtkGridAxes3DActor.h:301
vtkGridAxes3DActor::CustomLabels
vtkTuple< vtkNew< vtkDoubleArray >, 3 > CustomLabels
Definition: vtkGridAxes3DActor.h:296
vtkGridAxes3DActor::SetYPrecision
void SetYPrecision(int val)
Get/set the numerical precision to use, default is 2.
Definition: vtkGridAxes3DActor.h:236
vtkGridAxes3DActor::SetXUseCustomLabels
void SetXUseCustomLabels(bool val)
Definition: vtkGridAxes3DActor.h:189
value
value
vtkIdType
int vtkIdType
vtkProp3D
vtkProp::RenderOverlay
virtual int RenderOverlay(vtkViewport *)
vtkGridAxes3DActor::SetZTitle
void SetZTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
Definition: vtkGridAxes3DActor.h:180
vtkObject::New
static vtkObject * New()
vtkGridAxes3DActor::SetYLabelTextProperty
void SetYLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
Definition: vtkGridAxes3DActor.h:213
vtkProp::RenderOpaqueGeometry
virtual int RenderOpaqueGeometry(vtkViewport *)
vtkGridAxes3DActor::SetYNotation
void SetYNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
Definition: vtkGridAxes3DActor.h:225
vtkGridAxes3DActor::LabelMask
unsigned int LabelMask
Definition: vtkGridAxes3DActor.h:293
vtkGridAxes3DActor::SetYTitleTextProperty
void SetYTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
Definition: vtkGridAxes3DActor.h:167
vtkGridAxes3DActor::SetYUseCustomLabels
void SetYUseCustomLabels(bool val)
Definition: vtkGridAxes3DActor.h:190
vtkGridAxes3DActor::SetXLabel
void SetXLabel(vtkIdType index, double value)
Definition: vtkGridAxes3DActor.h:199
vtkGridAxes3DActor::SetZPrecision
void SetZPrecision(int val)
Get/set the numerical precision to use, default is 2.
Definition: vtkGridAxes3DActor.h:237
vtkGridAxesHelper::MAX_Z
@ MAX_Z
Definition: vtkGridAxesHelper.h:73
vtkGridAxes3DActor::SetZUseCustomLabels
void SetZUseCustomLabels(bool val)
Definition: vtkGridAxes3DActor.h:191
vtkGridAxes3DActor::SetXLabelTextProperty
void SetXLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
Definition: vtkGridAxes3DActor.h:212
vtkGridAxes3DActor::SetXNotation
void SetXNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
Definition: vtkGridAxes3DActor.h:224
vtkWindow
vtkGridAxes3DActor::GridAxes2DActors
vtkTuple< vtkNew< vtkGridAxes2DActor >, 6 > GridAxes2DActors
Definition: vtkGridAxes3DActor.h:299
vtkMTimeType
vtkTypeUInt64 vtkMTimeType
vtkProp3D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent)
vtkGridAxes3DActor::FaceMasks
FaceMasks
Values for FaceMask.
Definition: vtkGridAxes3DActor.h:57
vtkGridAxes3DActor::SetNumberOfZLabels
void SetNumberOfZLabels(vtkIdType val)
Definition: vtkGridAxes3DActor.h:196
vtkGridAxesHelper.h
title
title
Update
virtual void Update()
vtkProp::GetActors
virtual void GetActors(vtkPropCollection *)
vtkGridAxes3DActor::SetYLabel
void SetYLabel(vtkIdType index, double value)
Definition: vtkGridAxes3DActor.h:200
vtkGridAxes3DActor::SetXTitleTextProperty
void SetXTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
Definition: vtkGridAxes3DActor.h:166
vtkIndent
vtkGridAxes3DActor
actor for a cube-axes like prop in the 3D view.
Definition: vtkGridAxes3DActor.h:30
vtkGridAxes3DActor::SetZLabel
void SetZLabel(vtkIdType index, double value)
Definition: vtkGridAxes3DActor.h:201
vtkGridAxesHelper::MIN_X
@ MIN_X
Definition: vtkGridAxesHelper.h:68
vtkProp::GetBounds
virtual double * GetBounds()
vtkViewport
vtkProp::RenderTranslucentPolygonalGeometry
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
vtkTextProperty
vtkProp
vtkGridAxesHelper::MIN_Z
@ MIN_Z
Definition: vtkGridAxesHelper.h:70
vtkGridAxes3DActor::UseCustomLabels
vtkTuple< bool, 3 > UseCustomLabels
Definition: vtkGridAxes3DActor.h:295
vtkProp3D::ShallowCopy
void ShallowCopy(vtkProp *prop)
vtkGridAxesHelper::MAX_Y
@ MAX_Y
Definition: vtkGridAxesHelper.h:72
vtkNew.h
vtkGridAxes3DActor::CustomLabelsMTime
vtkMTimeType CustomLabelsMTime
Definition: vtkGridAxes3DActor.h:297
vtkGridAxes3DActor::LabelMasks
LabelMasks
Definition: vtkGridAxes3DActor.h:77
vtkGridAxes3DActor::LabelUniqueEdgesOnly
bool LabelUniqueEdgesOnly
Definition: vtkGridAxes3DActor.h:294
vtkGridAxes2DActor
actor for an axes plane in a 3D view.
Definition: vtkGridAxes2DActor.h:39
vtkGridAxes3DActor::SetNumberOfXLabels
void SetNumberOfXLabels(vtkIdType val)
Definition: vtkGridAxes3DActor.h:194
vtkGridAxes3DActor::SetXTitle
void SetXTitle(const std::string &title)
Get/Set the text to use for titles for the axis.
Definition: vtkGridAxes3DActor.h:178
vtkDoubleArray
vtkProperty
vtkGridAxes3DActor::SetXPrecision
void SetXPrecision(int val)
Get/set the numerical precision to use, default is 2.
Definition: vtkGridAxes3DActor.h:235
vtkGridAxes3DActor::SetZTitleTextProperty
void SetZTitleTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty for the title for each the axes.
Definition: vtkGridAxes3DActor.h:168
vtkGridAxesHelper::MIN_Y
@ MIN_Y
Definition: vtkGridAxesHelper.h:69
vtkGridAxes3DActor::SetZLabelTextProperty
void SetZLabelTextProperty(vtkTextProperty *prop)
Get/Set the vtkTextProperty that governs how the axis labels are displayed.
Definition: vtkGridAxes3DActor.h:214
vtkTuple< bool, 3 >
vtkPropCollection
index
index
vtkProp::ReleaseGraphicsResources
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkProp::HasTranslucentPolygonalGeometry
virtual int HasTranslucentPolygonalGeometry()
vtkGridAxes3DActor::SetZNotation
void SetZNotation(int notation)
Get/set the numerical notation, standard, scientific or mixed (0, 1, 2).
Definition: vtkGridAxes3DActor.h:226
vtkGridAxes3DActor::FaceMask
unsigned int FaceMask
Definition: vtkGridAxes3DActor.h:292
vtkProp3D.h
vtkGridAxesHelper::MAX_X
@ MAX_X
Definition: vtkGridAxesHelper.h:71
vtkProp3D::GetBounds
virtual double * GetBounds()=0