vtkGridAxesPlane2DActor.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkGridAxesPlane2DActor.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 =========================================================================*/
24 #ifndef vtkGridAxesPlane2DActor_h
25 #define vtkGridAxesPlane2DActor_h
26 
27 #include "vtkProp3D.h"
28 #include "vtkRemotingViewsModule.h" //needed for exports
29 
30 #include "vtkGridAxesHelper.h" // For face enumeration
31 #include "vtkNew.h" // For member variables
32 #include "vtkSmartPointer.h" // For member variables
33 #include <deque> // For keeping track of tick marks
34 
35 class vtkActor;
36 class vtkCellArray;
37 class vtkDoubleArray;
38 class vtkPoints;
39 class vtkPolyData;
40 class vtkPolyDataMapper;
41 class vtkProperty;
42 
43 class VTKREMOTINGVIEWS_EXPORT vtkGridAxesPlane2DActor : public vtkProp3D
44 {
45 public:
46  static vtkGridAxesPlane2DActor* New();
48  void PrintSelf(ostream& os, vtkIndent indent) override;
49 
51 
59  vtkSetVector6Macro(GridBounds, double);
60  vtkGetVector6Macro(GridBounds, double);
62 
63  // These are in the same order as the faces of a vtkVoxel.
64  enum Faces
65  {
72  };
73 
75 
81  vtkSetClampMacro(Face, int, MIN_YZ, MAX_XY);
82  vtkGetMacro(Face, int);
84 
86 
89  vtkSetMacro(GenerateGrid, bool);
90  vtkGetMacro(GenerateGrid, bool);
91  vtkBooleanMacro(GenerateGrid, bool);
93 
95 
99  vtkSetMacro(GenerateEdges, bool);
100  vtkGetMacro(GenerateEdges, bool);
101  vtkBooleanMacro(GenerateEdges, bool);
103 
105 
109  vtkSetMacro(GenerateTicks, bool);
110  vtkGetMacro(GenerateTicks, bool);
111  vtkBooleanMacro(GenerateTicks, bool);
113 
114  enum
115  {
116  TICK_DIRECTION_INWARDS = 0x1,
117  TICK_DIRECTION_OUTWARDS = 0x2,
118  TICK_DIRECTION_BOTH = TICK_DIRECTION_INWARDS | TICK_DIRECTION_OUTWARDS,
119  };
120 
122 
125  vtkSetClampMacro(TickDirection, unsigned int, static_cast<unsigned int>(TICK_DIRECTION_INWARDS),
126  static_cast<unsigned int>(TICK_DIRECTION_BOTH));
127  vtkGetMacro(TickDirection, unsigned int);
129 
138  void SetTickPositions(int axis, vtkDoubleArray* data);
139  const std::deque<double>& GetTickPositions(int axis)
140  {
141  return (axis >= 0 && axis < 3) ? this->TickPositions[axis] : this->EmptyVector;
142  }
143 
145 
148  void SetProperty(vtkProperty*);
149  vtkProperty* GetProperty();
151 
152  //--------------------------------------------------------------------------
153  // Methods for vtkProp3D API.
154  //--------------------------------------------------------------------------
155 
157 
160  double* GetBounds() override
161  {
162  this->GetGridBounds(this->Bounds);
163  return this->Bounds;
164  }
166 
167  int RenderOpaqueGeometry(vtkViewport*) override;
168  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
169  int RenderOverlay(vtkViewport* viewport) override;
170  int HasTranslucentPolygonalGeometry() override;
171  void ReleaseGraphicsResources(vtkWindow*) override;
172 
173 protected:
175  ~vtkGridAxesPlane2DActor() override;
176 
178 
185  friend class vtkGridAxes2DActor;
187 
189 
192  void Update(vtkViewport* viewport);
193  bool UpdateEdges(vtkViewport* viewport);
194  bool UpdateGrid(vtkViewport* viewport);
195  bool UpdateTicks(vtkViewport* viewport);
197 
198  double GridBounds[6];
199  int Face;
200 
204  unsigned int TickDirection;
205  std::deque<double> TickPositions[3];
206 
212 
215 
216 private:
218  void operator=(const vtkGridAxesPlane2DActor&) = delete;
219  std::deque<double> EmptyVector;
220 
221  typedef std::pair<vtkVector3d, vtkVector3d> LineSegmentType;
222  std::deque<LineSegmentType> LineSegments;
223 };
224 
225 #endif
virtual int RenderOpaqueGeometry(vtkViewport *)
virtual int HasTranslucentPolygonalGeometry()
virtual int RenderOverlay(vtkViewport *)
double * GetBounds() override
Returns the prop bounds.
virtual void ReleaseGraphicsResources(vtkWindow *)
vtkNew< vtkPoints > PolyDataPoints
void PrintSelf(ostream &os, vtkIndent indent)
double Bounds[6]
vtkSmartPointer< vtkGridAxesHelper > Helper
renders a 2D grid for vtkGridAxes2DActor.
bool Update(vtkViewport *viewport)
vtkNew< vtkPolyDataMapper > Mapper
virtual int RenderTranslucentPolygonalGeometry(vtkViewport *)
actor for an axes plane in a 3D view.
vtkNew< vtkPolyData > PolyData
is a helper object used by vtkGridAxes2DActor, vtkGridAxes3DActor, and vtkGridAxesPlane2DActor.
vtkNew< vtkCellArray > PolyDataLines
static vtkObject * New()
void operator=(const vtkObjectBase &)
const std::deque< double > & GetTickPositions(int axis)