VTK  9.5.20250806
vtkGridAxesPlaneActor2D.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 vtkGridAxesPlaneActor2D_h
14#define vtkGridAxesPlaneActor2D_h
15
16#include "vtkProp3D.h"
17#include "vtkRenderingGridAxesModule.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
24VTK_ABI_NAMESPACE_BEGIN
25class vtkActor;
26class vtkCellArray;
27class vtkDoubleArray;
28class vtkPoints;
29class vtkPolyData;
31class vtkProperty;
32
33class VTKRENDERINGGRIDAXES_EXPORT vtkGridAxesPlaneActor2D : public vtkProp3D
34{
35public:
38 void PrintSelf(ostream& os, vtkIndent indent) override;
39
41
49 vtkSetVector6Macro(GridBounds, double);
50 vtkGetVector6Macro(GridBounds, double);
52
54
63 vtkGetMacro(Face, int);
65
75
81
83
86 vtkSetMacro(GenerateGrid, bool);
87 vtkGetMacro(GenerateGrid, bool);
88 vtkBooleanMacro(GenerateGrid, bool);
90
92
96 vtkSetMacro(GenerateEdges, bool);
97 vtkGetMacro(GenerateEdges, bool);
98 vtkBooleanMacro(GenerateEdges, bool);
100
102
106 vtkSetMacro(GenerateTicks, bool);
107 vtkGetMacro(GenerateTicks, bool);
108 vtkBooleanMacro(GenerateTicks, bool);
110
111 enum : unsigned char
112 {
113 TICK_DIRECTION_INWARDS = 0x1,
114 TICK_DIRECTION_OUTWARDS = 0x2,
115 TICK_DIRECTION_BOTH = TICK_DIRECTION_INWARDS | TICK_DIRECTION_OUTWARDS,
116 };
117
119
124 vtkSetClampMacro(TickDirection, unsigned int, static_cast<unsigned int>(TICK_DIRECTION_INWARDS),
125 static_cast<unsigned int>(TICK_DIRECTION_BOTH));
126 vtkGetMacro(TickDirection, unsigned int);
128
130
140 void SetTickPositions(int axis, vtkDoubleArray* data);
141 const std::deque<double>& GetTickPositions(int axis)
142 {
143 return (axis >= 0 && axis < 3) ? this->TickPositions[axis] : this->EmptyVector;
144 }
146
148
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
173
178 int RenderOverlay(vtkViewport* viewport) override;
181
188
189protected:
192
194
201 friend class vtkGridAxesActor2D;
203
205
208 void Update(vtkViewport* viewport);
209 bool UpdateEdges(vtkViewport* viewport);
210 bool UpdateGrid(vtkViewport* viewport);
211 bool UpdateTicks(vtkViewport* viewport);
213
214private:
216 void operator=(const vtkGridAxesPlaneActor2D&) = delete;
217 std::deque<double> EmptyVector;
218
219 typedef std::pair<vtkVector3d, vtkVector3d> LineSegmentType;
220 std::deque<LineSegmentType> LineSegments;
221
222 double GridBounds[6];
223 int Face = vtkGridAxesHelper::MIN_YZ;
224
225 bool GenerateGrid = true;
226 bool GenerateEdges = true;
227 bool GenerateTicks = true;
228 unsigned int TickDirection = TICK_DIRECTION_BOTH;
229 std::deque<double> TickPositions[3];
230
231 vtkNew<vtkPolyData> PolyData;
232 vtkNew<vtkPoints> PolyDataPoints;
233 vtkNew<vtkCellArray> PolyDataLines;
235 vtkNew<vtkActor> Actor;
236
238 bool HelperManagedExternally;
239};
240
241VTK_ABI_NAMESPACE_END
242#endif
represents an object (geometry & properties) in a rendered scene
Definition vtkActor.h:151
object to represent cell connectivity
dynamic, self-adjusting array of double
actor for an axes plane in a 3D view.
is a helper object used by vtkGridAxesActor2D, vtkGridAxesActor3D, and vtkGridAxesPlane2DActor.
renders a 2D grid for vtkGridAxesActor2D.
int RenderOverlay(vtkViewport *viewport) override
Standard render methods for different types of geometry.
static vtkGridAxesPlaneActor2D * New(vtkGridAxesHelper *helper)
vtkGridAxesActor2D uses this method to create vtkGridAxesPlaneActor2D instance.
const std::deque< double > & GetTickPositions(int axis)
Set the tick positions for each of the coordinate axis.
bool UpdateGrid(vtkViewport *viewport)
Update's the polydata.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this prop.
static vtkGridAxesPlaneActor2D * New()
vtkGridAxesPlaneActor2D(vtkGridAxesHelper *helper=nullptr)
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void GetActors(vtkPropCollection *) override
For some exporters and other other operations we must be able to collect all the actors or volumes.
int RenderOpaqueGeometry(vtkViewport *) override
Standard render methods for different types of geometry.
bool UpdateEdges(vtkViewport *viewport)
Update's the polydata.
bool UpdateTicks(vtkViewport *viewport)
Update's the polydata.
double * GetBounds() override
Returns the prop bounds.
void SetProperty(vtkProperty *)
Get/Set the property used to control the appearance of the rendered grid.
void UpdateGeometry(vtkViewport *vp)
Updates the billboard geometry without performing any rendering, to assist GetActors().
void SetTickPositions(int axis, vtkDoubleArray *data)
Set the tick positions for each of the coordinate axis.
void Update(vtkViewport *viewport)
Update's the polydata.
~vtkGridAxesPlaneActor2D() override
vtkProperty * GetProperty()
Get/Set the property used to control the appearance of the rendered grid.
vtkTypeBool HasTranslucentPolygonalGeometry() override
Standard render methods for different types of geometry.
int RenderTranslucentPolygonalGeometry(vtkViewport *viewport) override
Standard render methods for different types of geometry.
a simple class to control print indentation
Definition vtkIndent.h:108
Allocate and hold a VTK object.
Definition vtkNew.h:167
represent and manipulate 3D points
Definition vtkPoints.h:139
map vtkPolyData to graphics primitives
concrete dataset represents vertices, lines, polygons, and triangle strips
represents an 3D object for placement in a rendered scene
Definition vtkProp3D.h:89
double Bounds[6]
Definition vtkProp3D.h:449
an ordered list of Props
represent surface properties of a geometric object
Hold a reference to a vtkObjectBase instance.
abstract specification for Viewports
Definition vtkViewport.h:66
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64