vtkGridAxesPlane2DActor.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
3 // SPDX-License-Identifier: BSD-3-Clause
13 #ifndef vtkGridAxesPlane2DActor_h
14 #define vtkGridAxesPlane2DActor_h
15 
16 #include "vtkProp3D.h"
17 #include "vtkRemotingViewsModule.h" //needed for exports
18 
19 #include "vtkGridAxesHelper.h" // For face enumeration
20 #include "vtkNew.h" // For member variables
21 #include "vtkSmartPointer.h" // For member variables
22 #include <deque> // For keeping track of tick marks
23 
24 class vtkActor;
25 class vtkCellArray;
26 class vtkDoubleArray;
27 class vtkPoints;
28 class vtkPolyData;
29 class vtkPolyDataMapper;
30 class vtkProperty;
31 
33 {
34 public:
35  static vtkGridAxesPlane2DActor* New();
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
40 
48  vtkSetVector6Macro(GridBounds, double);
49  vtkGetVector6Macro(GridBounds, double);
51 
52  // These are in the same order as the faces of a vtkVoxel.
53  enum Faces
54  {
61  };
62 
64 
70  vtkSetClampMacro(Face, int, MIN_YZ, MAX_XY);
71  vtkGetMacro(Face, int);
73 
82  void GetActors(vtkPropCollection*) override;
83 
88  void UpdateGeometry(vtkViewport* vp);
89 
91 
94  vtkSetMacro(GenerateGrid, bool);
95  vtkGetMacro(GenerateGrid, bool);
96  vtkBooleanMacro(GenerateGrid, bool);
98 
100 
104  vtkSetMacro(GenerateEdges, bool);
105  vtkGetMacro(GenerateEdges, bool);
106  vtkBooleanMacro(GenerateEdges, bool);
108 
110 
114  vtkSetMacro(GenerateTicks, bool);
115  vtkGetMacro(GenerateTicks, bool);
116  vtkBooleanMacro(GenerateTicks, bool);
118 
119  enum
120  {
121  TICK_DIRECTION_INWARDS = 0x1,
122  TICK_DIRECTION_OUTWARDS = 0x2,
123  TICK_DIRECTION_BOTH = TICK_DIRECTION_INWARDS | TICK_DIRECTION_OUTWARDS,
124  };
125 
127 
130  vtkSetClampMacro(TickDirection, unsigned int, static_cast<unsigned int>(TICK_DIRECTION_INWARDS),
131  static_cast<unsigned int>(TICK_DIRECTION_BOTH));
132  vtkGetMacro(TickDirection, unsigned int);
134 
143  void SetTickPositions(int axis, vtkDoubleArray* data);
144  const std::deque<double>& GetTickPositions(int axis)
145  {
146  return (axis >= 0 && axis < 3) ? this->TickPositions[axis] : this->EmptyVector;
147  }
148 
150 
153  void SetProperty(vtkProperty*);
154  vtkProperty* GetProperty();
156 
157  //--------------------------------------------------------------------------
158  // Methods for vtkProp3D API.
159  //--------------------------------------------------------------------------
160 
162 
165  double* GetBounds() override
166  {
167  this->GetGridBounds(this->Bounds);
168  return this->Bounds;
169  }
171 
172  int RenderOpaqueGeometry(vtkViewport*) override;
173  int RenderTranslucentPolygonalGeometry(vtkViewport* viewport) override;
174  int RenderOverlay(vtkViewport* viewport) override;
175  int HasTranslucentPolygonalGeometry() override;
176  void ReleaseGraphicsResources(vtkWindow*) override;
177 
178 protected:
179  vtkGridAxesPlane2DActor(vtkGridAxesHelper* helper = nullptr);
180  ~vtkGridAxesPlane2DActor() override;
181 
183 
190  friend class vtkGridAxes2DActor;
192 
194 
197  void Update(vtkViewport* viewport);
198  bool UpdateEdges(vtkViewport* viewport);
199  bool UpdateGrid(vtkViewport* viewport);
200  bool UpdateTicks(vtkViewport* viewport);
202 
203  double GridBounds[6];
204  int Face;
205 
209  unsigned int TickDirection;
210  std::deque<double> TickPositions[3];
211 
217 
220 
221 private:
223  void operator=(const vtkGridAxesPlane2DActor&) = delete;
224  std::deque<double> EmptyVector;
225 
226  typedef std::pair<vtkVector3d, vtkVector3d> LineSegmentType;
227  std::deque<LineSegmentType> LineSegments;
228 };
229 
230 #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)