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 
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 
93  void GetActors(vtkPropCollection*) override;
94 
99  void UpdateGeometry(vtkViewport* vp);
100 
102 
105  vtkSetMacro(GenerateGrid, bool);
106  vtkGetMacro(GenerateGrid, bool);
107  vtkBooleanMacro(GenerateGrid, bool);
109 
111 
115  vtkSetMacro(GenerateEdges, bool);
116  vtkGetMacro(GenerateEdges, bool);
117  vtkBooleanMacro(GenerateEdges, bool);
119 
121 
125  vtkSetMacro(GenerateTicks, bool);
126  vtkGetMacro(GenerateTicks, bool);
127  vtkBooleanMacro(GenerateTicks, bool);
129 
130  enum
131  {
132  TICK_DIRECTION_INWARDS = 0x1,
133  TICK_DIRECTION_OUTWARDS = 0x2,
134  TICK_DIRECTION_BOTH = TICK_DIRECTION_INWARDS | TICK_DIRECTION_OUTWARDS,
135  };
136 
138 
141  vtkSetClampMacro(TickDirection, unsigned int, static_cast<unsigned int>(TICK_DIRECTION_INWARDS),
142  static_cast<unsigned int>(TICK_DIRECTION_BOTH));
143  vtkGetMacro(TickDirection, unsigned int);
145 
154  void SetTickPositions(int axis, vtkDoubleArray* data);
155  const std::deque<double>& GetTickPositions(int axis)
156  {
157  return (axis >= 0 && axis < 3) ? this->TickPositions[axis] : this->EmptyVector;
158  }
159 
161 
164  void SetProperty(vtkProperty*);
165  vtkProperty* GetProperty();
167 
168  //--------------------------------------------------------------------------
169  // Methods for vtkProp3D API.
170  //--------------------------------------------------------------------------
171 
173 
176  double* GetBounds() override
177  {
178  this->GetGridBounds(this->Bounds);
179  return this->Bounds;
180  }
182 
183  int RenderOpaqueGeometry(vtkViewport*) override;
184  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
185  int RenderOverlay(vtkViewport* viewport) override;
186  int HasTranslucentPolygonalGeometry() override;
187  void ReleaseGraphicsResources(vtkWindow*) override;
188 
189 protected:
191  ~vtkGridAxesPlane2DActor() override;
192 
194 
201  friend class vtkGridAxes2DActor;
203 
205 
208  void Update(vtkViewport* viewport);
209  bool UpdateEdges(vtkViewport* viewport);
210  bool UpdateGrid(vtkViewport* viewport);
211  bool UpdateTicks(vtkViewport* viewport);
213 
214  double GridBounds[6];
215  int Face;
216 
220  unsigned int TickDirection;
221  std::deque<double> TickPositions[3];
222 
228 
231 
232 private:
234  void operator=(const vtkGridAxesPlane2DActor&) = delete;
235  std::deque<double> EmptyVector;
236 
237  typedef std::pair<vtkVector3d, vtkVector3d> LineSegmentType;
238  std::deque<LineSegmentType> LineSegments;
239 };
240 
241 #endif
#define VTKREMOTINGVIEWS_EXPORT
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 &)
virtual void GetActors(vtkPropCollection *)
const std::deque< double > & GetTickPositions(int axis)