VTK  9.3.0
vtkCubeAxesActor2D.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
46#ifndef vtkCubeAxesActor2D_h
47#define vtkCubeAxesActor2D_h
48
49#include "vtkActor2D.h"
50#include "vtkRenderingAnnotationModule.h" // For export macro
51
52VTK_ABI_NAMESPACE_BEGIN
54class vtkAxisActor2D;
55class vtkCamera;
56class vtkCubeAxesActor2DConnection;
57class vtkDataSet;
58class vtkTextProperty;
59
60class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
61{
62public:
64 void PrintSelf(ostream& os, vtkIndent indent) override;
65
72
74
77 int RenderOverlay(vtkViewport*) override;
81
86
88
94 virtual void SetInputData(vtkDataSet*);
95 virtual vtkDataSet* GetInput();
97
99
104 void SetViewProp(vtkProp* prop);
105 vtkGetObjectMacro(ViewProp, vtkProp);
107
109
115 vtkSetVector6Macro(Bounds, double);
116 double* GetBounds() VTK_SIZEHINT(6) override;
117 void GetBounds(
118 double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
119 void GetBounds(double bounds[6]);
121
123
128 vtkSetVector6Macro(Ranges, double);
129 double* GetRanges() VTK_SIZEHINT(6);
130 void GetRanges(
131 double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
132 void GetRanges(double ranges[6]);
134
136
141 vtkSetMacro(XOrigin, double);
142 vtkSetMacro(YOrigin, double);
143 vtkSetMacro(ZOrigin, double);
145
147
152 vtkSetMacro(UseRanges, vtkTypeBool);
153 vtkGetMacro(UseRanges, vtkTypeBool);
154 vtkBooleanMacro(UseRanges, vtkTypeBool);
156
158
162 virtual void SetCamera(vtkCamera*);
163 vtkGetObjectMacro(Camera, vtkCamera);
165
167 {
168 VTK_FLY_OUTER_EDGES = 0,
169 VTK_FLY_CLOSEST_TRIAD = 1,
170 VTK_FLY_NONE = 2
171 };
172
174
179 vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
180 vtkGetMacro(FlyMode, int);
181 void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
182 void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
183 void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
185
187
193 vtkSetMacro(Scaling, vtkTypeBool);
194 vtkGetMacro(Scaling, vtkTypeBool);
195 vtkBooleanMacro(Scaling, vtkTypeBool);
197
199
204 vtkSetClampMacro(NumberOfLabels, int, 0, 50);
205 vtkGetMacro(NumberOfLabels, int);
207
209
213 vtkSetStringMacro(XLabel);
214 vtkGetStringMacro(XLabel);
215 vtkSetStringMacro(YLabel);
216 vtkGetStringMacro(YLabel);
217 vtkSetStringMacro(ZLabel);
218 vtkGetStringMacro(ZLabel);
220
225 vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
226 vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
227 vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
228
230
235 vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
237
239
244 vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
246
248
252 vtkSetStringMacro(LabelFormat);
253 vtkGetStringMacro(LabelFormat);
255
257
261 vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
262 vtkGetMacro(FontFactor, double);
264
266
271 vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
272 vtkGetMacro(Inertia, int);
274
276
284 vtkSetClampMacro(ShowActualBounds, int, 0, 1);
285 vtkGetMacro(ShowActualBounds, int);
287
289
294 vtkSetMacro(CornerOffset, double);
295 vtkGetMacro(CornerOffset, double);
297
304
306
309 vtkSetMacro(XAxisVisibility, vtkTypeBool);
310 vtkGetMacro(XAxisVisibility, vtkTypeBool);
311 vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
312 vtkSetMacro(YAxisVisibility, vtkTypeBool);
313 vtkGetMacro(YAxisVisibility, vtkTypeBool);
314 vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
315 vtkSetMacro(ZAxisVisibility, vtkTypeBool);
316 vtkGetMacro(ZAxisVisibility, vtkTypeBool);
317 vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
319
324
325protected:
328
329 vtkCubeAxesActor2DConnection* ConnectionHolder;
330
331 vtkProp* ViewProp; // Define bounds from actor/assembly, or
332 double Bounds[6]; // Define bounds explicitly
333 double Ranges[6]; // Define ranges explicitly
334 vtkTypeBool UseRanges; // Flag to use ranges or not
335
339
343
346
348
350 char* XLabel;
351 char* YLabel;
352 char* ZLabel;
353 char* Labels[3];
354
358
364 int InertiaAxes[8];
365
367
368 // Always show the actual bounds of the object
370
371 double XOrigin;
372 double YOrigin;
373 double ZOrigin;
374
375 // various helper methods
376 void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
377 int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
378 double EvaluatePoint(double planes[24], double x[3]);
379 double EvaluateBounds(double planes[24], double bounds[6]);
380 void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
381 int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
382 double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
383
384private:
385 // hide the superclass' ShallowCopy() from the user and the compiler.
386 // NOLINTNEXTLINE(bugprone-parent-virtual-call)
387 void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
388
389 vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
390 void operator=(const vtkCubeAxesActor2D&) = delete;
391};
392
393VTK_ABI_NAMESPACE_END
394#endif
a actor that draws 2D data
Definition vtkActor2D.h:44
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
Proxy object to connect input/output ports.
Create an axis with tick marks and labels.
a virtual camera for 3D rendering
Definition vtkCamera.h:50
create a 2D plot of a bounding box edges - used for navigation
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int RenderOverlay(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
void SetViewProp(vtkProp *prop)
Use the bounding box of this prop to draw the cube axes.
vtkAxisActor2D * YAxis
virtual vtkDataSet * GetInput()
Use the bounding box of this input dataset to draw the cube axes.
static vtkCubeAxesActor2D * New()
Instantiate object with bold, italic, and shadow enabled; font family set to Arial; and label format ...
virtual void SetAxisTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property of all axes.
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
vtkAxisActor2D * GetZAxisActor2D()
double EvaluatePoint(double planes[24], double x[3])
double EvaluateBounds(double planes[24], double bounds[6])
virtual void SetInputData(vtkDataSet *)
Use the bounding box of this input dataset to draw the cube axes.
int RenderOpaqueGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
virtual void SetAxisLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property of all axes.
void SetFlyModeToClosestTriad()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
void SetFlyModeToNone()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6])
vtkAxisActor2D * GetYAxisActor2D()
vtkAxisActor2D * GetXAxisActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example)
vtkAxisActor2D * ZAxis
vtkTextProperty * AxisLabelTextProperty
void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx, int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4], double zCoords[4], double xRange[2], double yRange[2], double zRange[2])
vtkAxisActor2D * XAxis
double * GetBounds() override
Explicitly specify the region in space around which to draw the bounds.
virtual void SetInputConnection(vtkAlgorithmOutput *)
Use the bounding box of this input dataset to draw the cube axes.
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkCubeAxesActor2DConnection * ConnectionHolder
~vtkCubeAxesActor2D() override
vtkTextProperty * AxisTitleTextProperty
void TransformBounds(vtkViewport *viewport, double bounds[6], double pts[8][3])
void ShallowCopy(vtkCubeAxesActor2D *actor)
Shallow copy of a CubeAxesActor2D.
abstract class to specify dataset behavior
Definition vtkDataSet.h:62
a simple class to control print indentation
Definition vtkIndent.h:38
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:52
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
represent text properties.
record modification and/or execution time
abstract specification for Viewports
Definition vtkViewport.h:54
window superclass for vtkRenderWindow
Definition vtkWindow.h:34
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_SIZEHINT(...)