vtkGridAxes3DActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGridAxes3DActor.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
25 #ifndef vtkGridAxes3DActor_h
26 #define vtkGridAxes3DActor_h
27 
28 #include "vtkProp3D.h"
29 #include "vtkRemotingViewsModule.h" //needed for exports
30 
31 #include "vtkGridAxesHelper.h" // needed for vtkGridAxesHelper.
32 #include "vtkNew.h" // needed for vtkNew.
33 
34 #include <functional> // for std::function
35 
36 class vtkDoubleArray;
37 class vtkGridAxes2DActor;
38 class vtkProperty;
39 class vtkTextProperty;
40 
42 {
43 public:
44  static vtkGridAxes3DActor* New();
45  vtkTypeMacro(vtkGridAxes3DActor, vtkProp3D);
46  void PrintSelf(ostream& os, vtkIndent indent) override;
47 
51  void ShallowCopy(vtkProp* prop) override;
52 
54 
59  vtkSetVector6Macro(GridBounds, double);
60  vtkGetVector6Macro(GridBounds, double);
62 
68  enum FaceMasks
69  {
70  MIN_YZ = 0x01,
71  MIN_ZX = 0x02,
72  MIN_XY = 0x04,
73  MAX_YZ = 0x08,
74  MAX_ZX = 0x010,
75  MAX_XY = 0x020
76  };
77 
79 
84  virtual void SetFaceMask(unsigned int mask);
85  vtkGetMacro(FaceMask, unsigned int);
87 
89  {
96  };
97 
99 
102  virtual void SetLabelMask(unsigned int mask);
103  unsigned int GetLabelMask();
105 
114  void GetActors(vtkPropCollection*) override;
115 
120  void UpdateGeometry(vtkViewport* vp);
121 
123 
127  vtkSetMacro(LabelUniqueEdgesOnly, bool);
128  vtkGetMacro(LabelUniqueEdgesOnly, bool);
130 
132 
135  void SetGenerateGrid(bool val);
136  bool GetGenerateGrid();
137  vtkBooleanMacro(GenerateGrid, bool);
139 
141 
145  void SetGenerateEdges(bool val);
146  bool GetGenerateEdges();
147  vtkBooleanMacro(GenerateEdges, bool);
149 
151 
155  void SetGenerateTicks(bool val);
156  bool GetGenerateTicks();
157  vtkBooleanMacro(GenerateTicks, bool);
159 
161 
164  void SetProperty(vtkProperty*);
165  vtkProperty* GetProperty();
167 
168  //---------------------------------------------------------------------------
169  // *** Properties to control the axis titles ***
170 
172 
176  void SetTitleTextProperty(int axis, vtkTextProperty*);
177  void SetXTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(0, prop); }
178  void SetYTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(1, prop); }
179  void SetZTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(2, prop); }
180  vtkTextProperty* GetTitleTextProperty(int axis);
182 
184 
188  void SetTitle(int axis, const std::string& title);
189  void SetXTitle(const std::string& title) { this->SetTitle(0, title); }
190  void SetYTitle(const std::string& title) { this->SetTitle(1, title); }
191  void SetZTitle(const std::string& title) { this->SetTitle(2, title); }
192  const std::string& GetTitle(int axis);
194 
199  void SetUseCustomLabels(int axis, bool val);
200  void SetXUseCustomLabels(bool val) { this->SetUseCustomLabels(0, val); }
201  void SetYUseCustomLabels(bool val) { this->SetUseCustomLabels(1, val); }
202  void SetZUseCustomLabels(bool val) { this->SetUseCustomLabels(2, val); }
203 
204  void SetNumberOfLabels(int axis, vtkIdType val);
205  void SetNumberOfXLabels(vtkIdType val) { this->SetNumberOfLabels(0, val); }
206  void SetNumberOfYLabels(vtkIdType val) { this->SetNumberOfLabels(1, val); }
207  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 
214  //---------------------------------------------------------------------------
215  // *** Properties to control the axis data labels ***
216 
218 
222  void SetLabelTextProperty(int axis, vtkTextProperty*);
223  void SetXLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(0, prop); }
224  void SetYLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(1, prop); }
225  void SetZLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(2, prop); }
226  vtkTextProperty* GetLabelTextProperty(int axis);
228 
230 
234  void SetNotation(int axis, int notation);
235  void SetXNotation(int notation) { this->SetNotation(0, notation); }
236  void SetYNotation(int notation) { this->SetNotation(1, notation); }
237  void SetZNotation(int notation) { this->SetNotation(2, notation); }
238  int GetNotation(int axis);
240 
242 
245  void SetPrecision(int axis, int val);
246  void SetXPrecision(int val) { this->SetPrecision(0, val); }
247  void SetYPrecision(int val) { this->SetPrecision(1, val); }
248  void SetZPrecision(int val) { this->SetPrecision(2, val); }
249  int GetPrecision(int axis);
251 
253 
259  void SetTickLabelFunction(int axis, std::function<double(double)> func);
260  std::function<double(double)> GetTickLabelFunction(int axis);
262 
263  //--------------------------------------------------------------------------
264  // Methods for vtkProp3D API.
265  //--------------------------------------------------------------------------
266 
268 
271  double* GetBounds() override;
272  using Superclass::GetBounds;
274 
279  virtual void GetRenderedBounds(double bounds[6]);
280 
282 
285  vtkSetMacro(ForceOpaque, bool);
286  vtkGetMacro(ForceOpaque, bool);
287  vtkBooleanMacro(ForceOpaque, bool);
289 
290  int RenderOpaqueGeometry(vtkViewport*) override;
291  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
292  int RenderOverlay(vtkViewport* viewport) override;
293  int HasTranslucentPolygonalGeometry() override;
294  void ReleaseGraphicsResources(vtkWindow*) override;
295 
296 protected:
298  ~vtkGridAxes3DActor() override;
299 
300  virtual void Update(vtkViewport* viewport);
301 
302  double GridBounds[6];
303  unsigned int FaceMask;
304  unsigned int LabelMask;
309 
311 
313 
314 private:
315  vtkGridAxes3DActor(const vtkGridAxes3DActor&) = delete;
316  void operator=(const vtkGridAxes3DActor&) = delete;
317 
318  vtkMTimeType GetBoundsMTime;
319 };
320 
321 #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