VTK  9.7.1
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
37 #ifndef vtkCubeAxesActor2D_h
38 #define vtkCubeAxesActor2D_h
39 
40 #include "vtkActor2D.h"
41 #include "vtkRenderingAnnotationModule.h" // For export macro
42 #include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
43 
44 VTK_ABI_NAMESPACE_BEGIN
45 class vtkAlgorithmOutput;
46 class vtkAxisActor2D;
47 class vtkCamera;
48 class vtkCubeAxesActor2DConnection;
49 class vtkDataSet;
50 class vtkTextProperty;
51 
52 class VTKRENDERINGANNOTATION_EXPORT VTK_MARSHALAUTO vtkCubeAxesActor2D : public vtkActor2D
53 {
54 public:
56  void PrintSelf(ostream& os, vtkIndent indent) override;
57 
63  static vtkCubeAxesActor2D* New();
64 
66 
69  int RenderOverlay(vtkViewport*) override;
70  int RenderOpaqueGeometry(vtkViewport*) override;
71  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
73 
78 
80 
85  virtual void SetInputConnection(vtkAlgorithmOutput*);
86  virtual void SetInputData(vtkDataSet*);
87  virtual vtkDataSet* GetInput();
89 
91 
96  void SetViewProp(vtkProp* prop);
97  vtkGetObjectMacro(ViewProp, vtkProp);
99 
101 
107  vtkSetVector6Macro(Bounds, double);
108  double* GetBounds() VTK_SIZEHINT(6) override;
109  void GetBounds(
110  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
111  void GetBounds(double bounds[6]);
113 
115 
120  vtkSetVector6Macro(Ranges, double);
121  double* GetRanges() VTK_SIZEHINT(6);
122  void GetRanges(
123  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
124  void GetRanges(double ranges[6]);
126 
128 
133  vtkSetMacro(XOrigin, double);
134  vtkSetMacro(YOrigin, double);
135  vtkSetMacro(ZOrigin, double);
137 
139 
144  vtkSetMacro(UseRanges, vtkTypeBool);
145  vtkGetMacro(UseRanges, vtkTypeBool);
146  vtkBooleanMacro(UseRanges, vtkTypeBool);
148 
150 
154  virtual void SetCamera(vtkCamera*);
155  vtkGetObjectMacro(Camera, vtkCamera);
157 
158  enum FlyMode
159  {
160  VTK_FLY_OUTER_EDGES = 0,
161  VTK_FLY_CLOSEST_TRIAD = 1,
162  VTK_FLY_NONE = 2
163  };
164 
166 
171  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
172  vtkGetMacro(FlyMode, int);
173  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
174  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
175  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
177 
179 
185  vtkSetMacro(Scaling, vtkTypeBool);
186  vtkGetMacro(Scaling, vtkTypeBool);
187  vtkBooleanMacro(Scaling, vtkTypeBool);
189 
191 
196  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
197  vtkGetMacro(NumberOfLabels, int);
199 
201 
205  vtkSetStringMacro(XLabel);
206  vtkGetStringMacro(XLabel);
207  vtkSetStringMacro(YLabel);
208  vtkGetStringMacro(YLabel);
209  vtkSetStringMacro(ZLabel);
210  vtkGetStringMacro(ZLabel);
212 
217  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
218  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
219  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
220 
222 
226  virtual void SetAxisTitleTextProperty(vtkTextProperty* p);
227  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
229 
231 
235  virtual void SetAxisLabelTextProperty(vtkTextProperty* p);
236  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
238 
240 
244  void SetLabelFormat(const char* format);
245  vtkGetStringMacro(LabelFormat);
247 
249 
253  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
254  vtkGetMacro(FontFactor, double);
256 
258 
263  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
264  vtkGetMacro(Inertia, int);
266 
268 
276  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
277  vtkGetMacro(ShowActualBounds, int);
279 
281 
286  vtkSetMacro(CornerOffset, double);
287  vtkGetMacro(CornerOffset, double);
289 
295  void ReleaseGraphicsResources(vtkWindow*) override;
296 
298 
301  vtkSetMacro(XAxisVisibility, vtkTypeBool);
302  vtkGetMacro(XAxisVisibility, vtkTypeBool);
303  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
304  vtkSetMacro(YAxisVisibility, vtkTypeBool);
305  vtkGetMacro(YAxisVisibility, vtkTypeBool);
306  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
307  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
308  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
309  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
311 
315  void ShallowCopy(vtkCubeAxesActor2D* actor);
316 
317 protected:
319  ~vtkCubeAxesActor2D() override;
320 
321  vtkCubeAxesActor2DConnection* ConnectionHolder;
322 
323  vtkProp* ViewProp; // Define bounds from actor/assembly, or
324  double Bounds[6]; // Define bounds explicitly
325  double Ranges[6]; // Define ranges explicitly
326  vtkTypeBool UseRanges; // Flag to use ranges or not
327 
329  int FlyMode;
331 
335 
338 
340 
342  char* XLabel;
343  char* YLabel;
344  char* ZLabel;
345  char* Labels[3];
346 
350 
351  char* LabelFormat;
352  double FontFactor;
353  double CornerOffset;
354  int Inertia;
356  int InertiaAxes[8];
357 
359 
360  // Always show the actual bounds of the object
362 
363  double XOrigin;
364  double YOrigin;
365  double ZOrigin;
366 
367  // various helper methods
368  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
369  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
370  double EvaluatePoint(double planes[24], double x[3]);
371  double EvaluateBounds(double planes[24], double bounds[6]);
372  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
373  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
374  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
375 
376 private:
377  // hide the superclass' ShallowCopy() from the user and the compiler.
378  // NOLINTNEXTLINE(bugprone-parent-virtual-call)
379  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
380 
381  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
382  void operator=(const vtkCubeAxesActor2D&) = delete;
383 };
384 
385 VTK_ABI_NAMESPACE_END
386 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:49
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
vtkAxisActor2D * ZAxis
void GetBounds(T a, double bds[6])
int RenderOverlay(vtkViewport *viewport) override
Support the standard render methods.
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
abstract specification for Viewports
Definition: vtkViewport.h:46
abstract class to specify dataset behavior
Definition: vtkDataSet.h:56
vtkAxisActor2D * GetXAxisActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example) ...
#define VTK_INT_MAX
Definition: vtkType.h:192
a actor that draws 2D data
Definition: vtkActor2D.h:35
record modification and/or execution time
Definition: vtkTimeStamp.h:24
Create an axis with tick marks and labels.
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
Proxy object to connect input/output ports.
int vtkTypeBool
Definition: vtkABI.h:64
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:128
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
a simple class to control print indentation
Definition: vtkIndent.h:28
a virtual camera for 3D rendering
Definition: vtkCamera.h:41
static vtkActor2D * New()
Creates an actor2D with the following defaults: position (0,0) (coordinate system is viewport); at la...
void SetFlyModeToClosestTriad()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
#define VTK_SIZEHINT(...)
represent text properties.
create a 2D plot of a bounding box edges - used for navigation
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkAxisActor2D * GetZAxisActor2D()
vtkCubeAxesActor2DConnection * ConnectionHolder
vtkTextProperty * AxisLabelTextProperty
vtkTextProperty * AxisTitleTextProperty
vtkAxisActor2D * XAxis
void SetFlyModeToNone()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
int RenderOpaqueGeometry(vtkViewport *viewport) override
Support the standard render methods.
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkAxisActor2D * GetYAxisActor2D()
#define VTK_MARSHALAUTO
vtkAxisActor2D * YAxis
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.