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 class vtkDoubleArray;
35 class vtkGridAxes2DActor;
36 class vtkProperty;
37 class vtkTextProperty;
38 
40 {
41 public:
42  static vtkGridAxes3DActor* New();
43  vtkTypeMacro(vtkGridAxes3DActor, vtkProp3D);
44  void PrintSelf(ostream& os, vtkIndent indent) override;
45 
49  void ShallowCopy(vtkProp* prop) override;
50 
52 
57  vtkSetVector6Macro(GridBounds, double);
58  vtkGetVector6Macro(GridBounds, double);
60 
66  enum FaceMasks
67  {
68  MIN_YZ = 0x01,
69  MIN_ZX = 0x02,
70  MIN_XY = 0x04,
71  MAX_YZ = 0x08,
72  MAX_ZX = 0x010,
73  MAX_XY = 0x020
74  };
75 
77 
82  virtual void SetFaceMask(unsigned int mask);
83  vtkGetMacro(FaceMask, unsigned int);
85 
87  {
94  };
95 
97 
100  virtual void SetLabelMask(unsigned int mask);
101  unsigned int GetLabelMask();
103 
112  void GetActors(vtkPropCollection*) override;
113 
118  void UpdateGeometry(vtkViewport* vp);
119 
121 
125  vtkSetMacro(LabelUniqueEdgesOnly, bool);
126  vtkGetMacro(LabelUniqueEdgesOnly, bool);
128 
130 
133  void SetGenerateGrid(bool val);
134  bool GetGenerateGrid();
135  vtkBooleanMacro(GenerateGrid, bool);
137 
139 
143  void SetGenerateEdges(bool val);
144  bool GetGenerateEdges();
145  vtkBooleanMacro(GenerateEdges, bool);
147 
149 
153  void SetGenerateTicks(bool val);
154  bool GetGenerateTicks();
155  vtkBooleanMacro(GenerateTicks, bool);
157 
159 
162  void SetProperty(vtkProperty*);
163  vtkProperty* GetProperty();
165 
166  //---------------------------------------------------------------------------
167  // *** Properties to control the axis titles ***
168 
170 
174  void SetTitleTextProperty(int axis, vtkTextProperty*);
175  void SetXTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(0, prop); }
176  void SetYTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(1, prop); }
177  void SetZTitleTextProperty(vtkTextProperty* prop) { this->SetTitleTextProperty(2, prop); }
178  vtkTextProperty* GetTitleTextProperty(int axis);
180 
182 
186  void SetTitle(int axis, const std::string& title);
187  void SetXTitle(const std::string& title) { this->SetTitle(0, title); }
188  void SetYTitle(const std::string& title) { this->SetTitle(1, title); }
189  void SetZTitle(const std::string& title) { this->SetTitle(2, title); }
190  const std::string& GetTitle(int axis);
192 
197  void SetUseCustomLabels(int axis, bool val);
198  void SetXUseCustomLabels(bool val) { this->SetUseCustomLabels(0, val); }
199  void SetYUseCustomLabels(bool val) { this->SetUseCustomLabels(1, val); }
200  void SetZUseCustomLabels(bool val) { this->SetUseCustomLabels(2, val); }
201 
202  void SetNumberOfLabels(int axis, vtkIdType val);
203  void SetNumberOfXLabels(vtkIdType val) { this->SetNumberOfLabels(0, val); }
204  void SetNumberOfYLabels(vtkIdType val) { this->SetNumberOfLabels(1, val); }
205  void SetNumberOfZLabels(vtkIdType val) { this->SetNumberOfLabels(2, val); }
206 
207  void SetLabel(int axis, vtkIdType index, double value);
208  void SetXLabel(vtkIdType index, double value) { this->SetLabel(0, index, value); }
209  void SetYLabel(vtkIdType index, double value) { this->SetLabel(1, index, value); }
210  void SetZLabel(vtkIdType index, double value) { this->SetLabel(2, index, value); }
211 
212  //---------------------------------------------------------------------------
213  // *** Properties to control the axis data labels ***
214 
216 
220  void SetLabelTextProperty(int axis, vtkTextProperty*);
221  void SetXLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(0, prop); }
222  void SetYLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(1, prop); }
223  void SetZLabelTextProperty(vtkTextProperty* prop) { this->SetLabelTextProperty(2, prop); }
224  vtkTextProperty* GetLabelTextProperty(int axis);
226 
228 
232  void SetNotation(int axis, int notation);
233  void SetXNotation(int notation) { this->SetNotation(0, notation); }
234  void SetYNotation(int notation) { this->SetNotation(1, notation); }
235  void SetZNotation(int notation) { this->SetNotation(2, notation); }
236  int GetNotation(int axis);
238 
240 
243  void SetPrecision(int axis, int val);
244  void SetXPrecision(int val) { this->SetPrecision(0, val); }
245  void SetYPrecision(int val) { this->SetPrecision(1, val); }
246  void SetZPrecision(int val) { this->SetPrecision(2, val); }
247  int GetPrecision(int axis);
249 
250  //--------------------------------------------------------------------------
251  // Methods for vtkProp3D API.
252  //--------------------------------------------------------------------------
253 
255 
258  double* GetBounds() override;
259  using Superclass::GetBounds;
261 
266  virtual void GetRenderedBounds(double bounds[6]);
267 
269 
272  vtkSetMacro(ForceOpaque, bool);
273  vtkGetMacro(ForceOpaque, bool);
274  vtkBooleanMacro(ForceOpaque, bool);
276 
277  int RenderOpaqueGeometry(vtkViewport*) override;
278  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
279  int RenderOverlay(vtkViewport* viewport) override;
280  int HasTranslucentPolygonalGeometry() override;
281  void ReleaseGraphicsResources(vtkWindow*) override;
282 
283 protected:
285  ~vtkGridAxes3DActor() override;
286 
287  virtual void Update(vtkViewport* viewport);
288 
289  double GridBounds[6];
290  unsigned int FaceMask;
291  unsigned int LabelMask;
296 
298 
300 
301 private:
302  vtkGridAxes3DActor(const vtkGridAxes3DActor&) = delete;
303  void operator=(const vtkGridAxes3DActor&) = delete;
304 
305  vtkMTimeType GetBoundsMTime;
306 };
307 
308 #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