VTK  9.3.20240423
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
56#ifndef vtkCubeAxesActor2D_h
57#define vtkCubeAxesActor2D_h
58
59#include "vtkActor2D.h"
60#include "vtkRenderingAnnotationModule.h" // For export macro
61#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
62
63VTK_ABI_NAMESPACE_BEGIN
65class vtkAxisActor2D;
66class vtkCamera;
67class vtkCubeAxesActor2DConnection;
68class vtkDataSet;
69class vtkTextProperty;
70
71class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkCubeAxesActor2D : public vtkActor2D
72{
73public:
75 void PrintSelf(ostream& os, vtkIndent indent) override;
76
83
85
88 int RenderOverlay(vtkViewport*) override;
92
97
99
105 virtual void SetInputData(vtkDataSet*);
108
110
115 void SetViewProp(vtkProp* prop);
116 vtkGetObjectMacro(ViewProp, vtkProp);
118
120
126 vtkSetVector6Macro(Bounds, double);
127 double* GetBounds() VTK_SIZEHINT(6) override;
128 void GetBounds(
129 double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
130 void GetBounds(double bounds[6]);
132
134
139 vtkSetVector6Macro(Ranges, double);
140 double* GetRanges() VTK_SIZEHINT(6);
141 void GetRanges(
142 double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
143 void GetRanges(double ranges[6]);
145
147
152 vtkSetMacro(XOrigin, double);
153 vtkSetMacro(YOrigin, double);
154 vtkSetMacro(ZOrigin, double);
156
158
163 vtkSetMacro(UseRanges, vtkTypeBool);
164 vtkGetMacro(UseRanges, vtkTypeBool);
165 vtkBooleanMacro(UseRanges, vtkTypeBool);
167
169
173 virtual void SetCamera(vtkCamera*);
174 vtkGetObjectMacro(Camera, vtkCamera);
176
178 {
179 VTK_FLY_OUTER_EDGES = 0,
180 VTK_FLY_CLOSEST_TRIAD = 1,
181 VTK_FLY_NONE = 2
182 };
183
185
190 vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
191 vtkGetMacro(FlyMode, int);
192 void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
193 void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
194 void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
196
198
204 vtkSetMacro(Scaling, vtkTypeBool);
205 vtkGetMacro(Scaling, vtkTypeBool);
206 vtkBooleanMacro(Scaling, vtkTypeBool);
208
210
215 vtkSetClampMacro(NumberOfLabels, int, 0, 50);
216 vtkGetMacro(NumberOfLabels, int);
218
220
224 vtkSetStringMacro(XLabel);
225 vtkGetStringMacro(XLabel);
226 vtkSetStringMacro(YLabel);
227 vtkGetStringMacro(YLabel);
228 vtkSetStringMacro(ZLabel);
229 vtkGetStringMacro(ZLabel);
231
236 vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
237 vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
238 vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
239
241
246 vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
248
250
255 vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
257
259
263 vtkSetStringMacro(LabelFormat);
264 vtkGetStringMacro(LabelFormat);
266
268
272 vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
273 vtkGetMacro(FontFactor, double);
275
277
282 vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
283 vtkGetMacro(Inertia, int);
285
287
295 vtkSetClampMacro(ShowActualBounds, int, 0, 1);
296 vtkGetMacro(ShowActualBounds, int);
298
300
305 vtkSetMacro(CornerOffset, double);
306 vtkGetMacro(CornerOffset, double);
308
315
317
320 vtkSetMacro(XAxisVisibility, vtkTypeBool);
321 vtkGetMacro(XAxisVisibility, vtkTypeBool);
322 vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
323 vtkSetMacro(YAxisVisibility, vtkTypeBool);
324 vtkGetMacro(YAxisVisibility, vtkTypeBool);
325 vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
326 vtkSetMacro(ZAxisVisibility, vtkTypeBool);
327 vtkGetMacro(ZAxisVisibility, vtkTypeBool);
328 vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
330
335
336protected:
339
340 vtkCubeAxesActor2DConnection* ConnectionHolder;
341
342 vtkProp* ViewProp; // Define bounds from actor/assembly, or
343 double Bounds[6]; // Define bounds explicitly
344 double Ranges[6]; // Define ranges explicitly
345 vtkTypeBool UseRanges; // Flag to use ranges or not
346
350
354
357
359
361 char* XLabel;
362 char* YLabel;
363 char* ZLabel;
364 char* Labels[3];
365
369
375 int InertiaAxes[8];
376
378
379 // Always show the actual bounds of the object
381
382 double XOrigin;
383 double YOrigin;
384 double ZOrigin;
385
386 // various helper methods
387 void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
388 int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
389 double EvaluatePoint(double planes[24], double x[3]);
390 double EvaluateBounds(double planes[24], double bounds[6]);
391 void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
392 int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
393 double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
394
395private:
396 // hide the superclass' ShallowCopy() from the user and the compiler.
397 // NOLINTNEXTLINE(bugprone-parent-virtual-call)
398 void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
399
400 vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
401 void operator=(const vtkCubeAxesActor2D&) = delete;
402};
403
404VTK_ABI_NAMESPACE_END
405#endif
a actor that draws 2D data
Definition vtkActor2D.h:145
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:151
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:166
a simple class to control print indentation
Definition vtkIndent.h:108
abstract superclass for all actors, volumes and annotations
Definition vtkProp.h:66
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:65
window superclass for vtkRenderWindow
Definition vtkWindow.h:48
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_INT_MAX
Definition vtkType.h:144
#define VTK_SIZEHINT(...)
#define VTK_MARSHALAUTO