VTK  9.3.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 
43 VTK_ABI_NAMESPACE_BEGIN
44 class vtkAlgorithmOutput;
45 class vtkAxisActor2D;
46 class vtkCamera;
47 class vtkCubeAxesActor2DConnection;
48 class vtkDataSet;
49 class vtkTextProperty;
50 
51 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
52 {
53 public:
55  void PrintSelf(ostream& os, vtkIndent indent) override;
56 
62  static vtkCubeAxesActor2D* New();
63 
65 
68  int RenderOverlay(vtkViewport*) override;
69  int RenderOpaqueGeometry(vtkViewport*) override;
70  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
72 
77 
79 
84  virtual void SetInputConnection(vtkAlgorithmOutput*);
85  virtual void SetInputData(vtkDataSet*);
86  virtual vtkDataSet* GetInput();
88 
90 
95  void SetViewProp(vtkProp* prop);
96  vtkGetObjectMacro(ViewProp, vtkProp);
98 
100 
106  vtkSetVector6Macro(Bounds, double);
107  double* GetBounds() VTK_SIZEHINT(6) override;
108  void GetBounds(
109  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
110  void GetBounds(double bounds[6]);
112 
114 
119  vtkSetVector6Macro(Ranges, double);
120  double* GetRanges() VTK_SIZEHINT(6);
121  void GetRanges(
122  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
123  void GetRanges(double ranges[6]);
125 
127 
132  vtkSetMacro(XOrigin, double);
133  vtkSetMacro(YOrigin, double);
134  vtkSetMacro(ZOrigin, double);
136 
138 
143  vtkSetMacro(UseRanges, vtkTypeBool);
144  vtkGetMacro(UseRanges, vtkTypeBool);
145  vtkBooleanMacro(UseRanges, vtkTypeBool);
147 
149 
153  virtual void SetCamera(vtkCamera*);
154  vtkGetObjectMacro(Camera, vtkCamera);
156 
157  enum FlyMode
158  {
159  VTK_FLY_OUTER_EDGES = 0,
160  VTK_FLY_CLOSEST_TRIAD = 1,
161  VTK_FLY_NONE = 2
162  };
163 
165 
170  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
171  vtkGetMacro(FlyMode, int);
172  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
173  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
174  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
176 
178 
184  vtkSetMacro(Scaling, vtkTypeBool);
185  vtkGetMacro(Scaling, vtkTypeBool);
186  vtkBooleanMacro(Scaling, vtkTypeBool);
188 
190 
195  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
196  vtkGetMacro(NumberOfLabels, int);
198 
200 
204  vtkSetStringMacro(XLabel);
205  vtkGetStringMacro(XLabel);
206  vtkSetStringMacro(YLabel);
207  vtkGetStringMacro(YLabel);
208  vtkSetStringMacro(ZLabel);
209  vtkGetStringMacro(ZLabel);
211 
216  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
217  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
218  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
219 
221 
225  virtual void SetAxisTitleTextProperty(vtkTextProperty* p);
226  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
228 
230 
234  virtual void SetAxisLabelTextProperty(vtkTextProperty* p);
235  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
237 
239 
243  vtkSetStringMacro(LabelFormat);
244  vtkGetStringMacro(LabelFormat);
246 
248 
252  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
253  vtkGetMacro(FontFactor, double);
255 
257 
262  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
263  vtkGetMacro(Inertia, int);
265 
267 
275  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
276  vtkGetMacro(ShowActualBounds, int);
278 
280 
285  vtkSetMacro(CornerOffset, double);
286  vtkGetMacro(CornerOffset, double);
288 
294  void ReleaseGraphicsResources(vtkWindow*) override;
295 
297 
300  vtkSetMacro(XAxisVisibility, vtkTypeBool);
301  vtkGetMacro(XAxisVisibility, vtkTypeBool);
302  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
303  vtkSetMacro(YAxisVisibility, vtkTypeBool);
304  vtkGetMacro(YAxisVisibility, vtkTypeBool);
305  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
306  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
307  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
308  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
310 
314  void ShallowCopy(vtkCubeAxesActor2D* actor);
315 
316 protected:
318  ~vtkCubeAxesActor2D() override;
319 
320  vtkCubeAxesActor2DConnection* ConnectionHolder;
321 
322  vtkProp* ViewProp; // Define bounds from actor/assembly, or
323  double Bounds[6]; // Define bounds explicitly
324  double Ranges[6]; // Define ranges explicitly
325  vtkTypeBool UseRanges; // Flag to use ranges or not
326 
328  int FlyMode;
330 
334 
337 
339 
341  char* XLabel;
342  char* YLabel;
343  char* ZLabel;
344  char* Labels[3];
345 
349 
350  char* LabelFormat;
351  double FontFactor;
352  double CornerOffset;
353  int Inertia;
355  int InertiaAxes[8];
356 
358 
359  // Always show the actual bounds of the object
361 
362  double XOrigin;
363  double YOrigin;
364  double ZOrigin;
365 
366  // various helper methods
367  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
368  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
369  double EvaluatePoint(double planes[24], double x[3]);
370  double EvaluateBounds(double planes[24], double bounds[6]);
371  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
372  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
373  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
374 
375 private:
376  // hide the superclass' ShallowCopy() from the user and the compiler.
377  // NOLINTNEXTLINE(bugprone-parent-virtual-call)
378  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
379 
380  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
381  void operator=(const vtkCubeAxesActor2D&) = delete;
382 };
383 
384 VTK_ABI_NAMESPACE_END
385 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:45
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:44
abstract class to specify dataset behavior
Definition: vtkDataSet.h:52
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:144
a actor that draws 2D data
Definition: vtkActor2D.h:34
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:124
window superclass for vtkRenderWindow
Definition: vtkWindow.h:27
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:40
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()
vtkAxisActor2D * YAxis
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.