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 
42 class vtkAxis;
43 class vtkContextScene;
44 class vtkDoubleArray;
45 class vtkProperty;
46 class vtkTextProperty;
47 
49 {
50 public:
51  static vtkGridAxes2DActor* New();
52  vtkTypeMacro(vtkGridAxes2DActor, vtkProp3D);
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
56 
61  vtkSetVector6Macro(GridBounds, double);
62  vtkGetVector6Macro(GridBounds, double);
64 
65  // These are in the same order as the faces of a vtkVoxel.
66  enum Faces
67  {
74  };
75 
77 
80  vtkSetClampMacro(Face, int, MIN_YZ, MAX_XY);
81  vtkGetMacro(Face, int);
83 
88  {
95  };
96 
98 
104  vtkSetMacro(LabelMask, unsigned int);
105  vtkGetMacro(LabelMask, unsigned int);
107 
116  void GetActors(vtkPropCollection*) override;
117 
122  void UpdateGeometry(vtkViewport* viewport, bool doRegularUpdate);
123 
125 
129  void SetProperty(vtkProperty*);
130  vtkProperty* GetProperty();
132 
134 
138  void SetTitleTextProperty(int axis, vtkTextProperty*);
139  vtkTextProperty* GetTitleTextProperty(int axis);
141 
143 
147  void SetLabelTextProperty(int axis, vtkTextProperty*);
148  vtkTextProperty* GetLabelTextProperty(int axis);
150 
152 
155  void SetTitle(int axis, const std::string& title);
156  const std::string& GetTitle(int axis);
158 
160 
164  void SetNotation(int axis, int notation);
165  int GetNotation(int axis);
167 
169 
172  void SetPrecision(int axis, int val);
173  int GetPrecision(int axis);
175 
181  void SetCustomTickPositions(int axis, vtkDoubleArray* positions);
182 
183  //---------------------------------------------------------------------------
184  // *** Properties to control grid rendering ***
185  //---------------------------------------------------------------------------
186 
188 
191  void SetGenerateGrid(bool val) { this->PlaneActor->SetGenerateGrid(val); }
192  bool GetGenerateGrid() { return this->PlaneActor->GetGenerateGrid(); }
193  vtkBooleanMacro(GenerateGrid, bool);
195 
197 
200  void SetGenerateEdges(bool val) { this->PlaneActor->SetGenerateEdges(val); }
201  bool GetGenerateEdges() { return this->PlaneActor->GetGenerateEdges(); }
202  vtkBooleanMacro(GenerateEdges, bool);
204 
206 
210  void SetGenerateTicks(bool val) { this->PlaneActor->SetGenerateTicks(val); }
211  bool GetGenerateTicks() { return this->PlaneActor->GetGenerateTicks(); }
212  vtkBooleanMacro(GenerateTicks, bool);
214 
215  //--------------------------------------------------------------------------
216  // Methods for vtkProp3D API.
217  //--------------------------------------------------------------------------
218 
220 
223  double* GetBounds() override
224  {
225  this->GetGridBounds(this->Bounds);
226  return this->Bounds;
227  }
229 
231 
234  vtkSetMacro(ForceOpaque, bool);
235  vtkGetMacro(ForceOpaque, bool);
236  vtkBooleanMacro(ForceOpaque, bool);
238 
239  int RenderOpaqueGeometry(vtkViewport*) override;
240  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
241  int RenderOverlay(vtkViewport* viewport) override;
242  int HasTranslucentPolygonalGeometry() override;
243  void ReleaseGraphicsResources(vtkWindow*) override;
244 
248  vtkMTimeType GetMTime() override;
249 
250 protected:
252  ~vtkGridAxes2DActor() override;
253 
254  bool Update(vtkViewport* viewport);
255  void UpdateTextProperties(vtkViewport* viewport);
256  void UpdateLabelPositions(vtkViewport* viewport);
257  void UpdateTextActors(vtkViewport* viewport);
258  friend class vtkGridAxes3DActor;
259 
260  double GridBounds[6];
261  int Face;
262  unsigned int LabelMask;
263 
267 
270  vtkNew<vtkAxis> AxisHelpers[3];
273 
275 
276 private:
277  vtkGridAxes2DActor(const vtkGridAxes2DActor&) = delete;
278  void operator=(const vtkGridAxes2DActor&) = delete;
279 
280  class vtkLabels;
281  vtkLabels* Labels;
282  friend class vtkLabels;
283 
284  bool DoRender;
285 };
286 
287 #endif
bool GetGenerateTicks()
Turn off to not generate the markers for the tick positions.
vtkTimeStamp UpdateLabelTextPropertiesMTime
bool GetGenerateGrid()
Turn off to not generate polydata for the plane&#39;s grid.
vtkNew< vtkGridAxesHelper > Helper
vtkTuple< vtkSmartPointer< vtkTextProperty >, 3 > TitleTextProperty
#define VTKREMOTINGVIEWS_EXPORT
bool GetGenerateEdges()
Turn off to not generate the polydata for the plane&#39;s edges.
virtual int RenderOpaqueGeometry(vtkViewport *)
vtkTuple< std::string, 3 > Titles
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&#39;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&#39;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 &)
virtual void GetActors(vtkPropCollection *)