vtkGridAxes2DActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGridAxes2DActor.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 =========================================================================*/
31 #ifndef vtkGridAxes2DActor_h
32 #define vtkGridAxes2DActor_h
33 
34 #include "vtkProp3D.h"
35 #include "vtkRemotingViewsModule.h" //needed for exports
36 
37 #include "vtkGridAxesHelper.h" // needed of Helper
38 #include "vtkGridAxesPlane2DActor.h" // needed for inline methods
39 #include "vtkNew.h" // needed for vtkNew.
40 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
41 #include "vtkStdString.h" // needed for vtkStdString.
42 
43 class vtkAxis;
44 class vtkContextScene;
45 class vtkDoubleArray;
46 class vtkProperty;
47 class vtkTextProperty;
48 
49 class VTKREMOTINGVIEWS_EXPORT vtkGridAxes2DActor : public vtkProp3D
50 {
51 public:
52  static vtkGridAxes2DActor* New();
53  vtkTypeMacro(vtkGridAxes2DActor, vtkProp3D);
54  void PrintSelf(ostream& os, vtkIndent indent) override;
55 
57 
62  vtkSetVector6Macro(GridBounds, double);
63  vtkGetVector6Macro(GridBounds, double);
65 
66  // These are in the same order as the faces of a vtkVoxel.
67  enum Faces
68  {
75  };
76 
78 
81  vtkSetClampMacro(Face, int, MIN_YZ, MAX_XY);
82  vtkGetMacro(Face, int);
84 
89  {
96  };
97 
99 
105  vtkSetMacro(LabelMask, unsigned int);
106  vtkGetMacro(LabelMask, unsigned int);
108 
110 
114  void SetProperty(vtkProperty*);
115  vtkProperty* GetProperty();
117 
119 
123  void SetTitleTextProperty(int axis, vtkTextProperty*);
124  vtkTextProperty* GetTitleTextProperty(int axis);
126 
128 
132  void SetLabelTextProperty(int axis, vtkTextProperty*);
133  vtkTextProperty* GetLabelTextProperty(int axis);
135 
137 
140  void SetTitle(int axis, const vtkStdString& title);
141  const vtkStdString& GetTitle(int axis);
143 
145 
149  void SetNotation(int axis, int notation);
150  int GetNotation(int axis);
152 
154 
157  void SetPrecision(int axis, int val);
158  int GetPrecision(int axis);
160 
166  void SetCustomTickPositions(int axis, vtkDoubleArray* positions);
167 
168  //---------------------------------------------------------------------------
169  // *** Properties to control grid rendering ***
170  //---------------------------------------------------------------------------
171 
173 
176  void SetGenerateGrid(bool val) { this->PlaneActor->SetGenerateGrid(val); }
177  bool GetGenerateGrid() { return this->PlaneActor->GetGenerateGrid(); }
178  vtkBooleanMacro(GenerateGrid, bool);
180 
182 
185  void SetGenerateEdges(bool val) { this->PlaneActor->SetGenerateEdges(val); }
186  bool GetGenerateEdges() { return this->PlaneActor->GetGenerateEdges(); }
187  vtkBooleanMacro(GenerateEdges, bool);
189 
191 
195  void SetGenerateTicks(bool val) { this->PlaneActor->SetGenerateTicks(val); }
196  bool GetGenerateTicks() { return this->PlaneActor->GetGenerateTicks(); }
197  vtkBooleanMacro(GenerateTicks, bool);
199 
200  //--------------------------------------------------------------------------
201  // Methods for vtkProp3D API.
202  //--------------------------------------------------------------------------
203 
205 
208  double* GetBounds() override
209  {
210  this->GetGridBounds(this->Bounds);
211  return this->Bounds;
212  }
214 
216 
219  vtkSetMacro(ForceOpaque, bool);
220  vtkGetMacro(ForceOpaque, bool);
221  vtkBooleanMacro(ForceOpaque, bool);
223 
224  int RenderOpaqueGeometry(vtkViewport*) override;
225  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
226  int RenderOverlay(vtkViewport* viewport) override;
227  int HasTranslucentPolygonalGeometry() override;
228  void ReleaseGraphicsResources(vtkWindow*) override;
229 
233  vtkMTimeType GetMTime() override;
234 
235 protected:
237  ~vtkGridAxes2DActor() override;
238 
239  bool Update(vtkViewport* viewport);
240  void UpdateTextProperties(vtkViewport* viewport);
241  void UpdateLabelPositions(vtkViewport* viewport);
242  void UpdateTextActors(vtkViewport* viewport);
243  friend class vtkGridAxes3DActor;
244 
245  double GridBounds[6];
246  int Face;
247  unsigned int LabelMask;
248 
252 
255  vtkNew<vtkAxis> AxisHelpers[3];
258 
260 
261 private:
262  vtkGridAxes2DActor(const vtkGridAxes2DActor&) = delete;
263  void operator=(const vtkGridAxes2DActor&) = delete;
264 
265  class vtkLabels;
266  vtkLabels* Labels;
267  friend class vtkLabels;
268 
269  bool DoRender;
270 };
271 
272 #endif
bool GetGenerateTicks()
Turn off to not generate the markers for the tick positions.
vtkTimeStamp UpdateLabelTextPropertiesMTime
vtkTuple< vtkStdString, 3 > Titles
bool GetGenerateGrid()
Turn off to not generate polydata for the plane's grid.
vtkNew< vtkGridAxesHelper > Helper
vtkTuple< vtkSmartPointer< vtkTextProperty >, 3 > TitleTextProperty
bool GetGenerateEdges()
Turn off to not generate the polydata for the plane's edges.
virtual int RenderOpaqueGeometry(vtkViewport *)
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOverlay(vtkViewport *)
vtkSmartPointer< vtkGridAxesPlane2DActor > PlaneActor
virtual void Update()
vtkTuple< vtkSmartPointer< vtkTextProperty >, 3 > LabelTextProperty
vtkTypeUInt64 vtkMTimeType
void SetGenerateGrid(bool val)
Turn off to not generate polydata for the plane's grid.
virtual void ReleaseGraphicsResources(vtkWindow *)
void PrintSelf(ostream &os, vtkIndent indent)
double Bounds[6]
actor for a cube-axes like prop in the 3D view.
void SetGenerateTicks(bool val)
Turn off to not generate the markers for the tick positions.
LabelMasks
Valid values for LabelMask.
void SetGenerateEdges(bool val)
Turn off to not generate the polydata for the plane's edges.
vtkMTimeType GetMTime()
double * GetBounds() override
Returns the prop bounds.
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
actor for an axes plane in a 3D view.
vtkNew< vtkContextScene > AxisHelperScene
static vtkObject * New()
void operator=(const vtkObjectBase &)