VTK  9.2.5
vtkCubeAxesActor2D.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkCubeAxesActor2D.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
68 #ifndef vtkCubeAxesActor2D_h
69 #define vtkCubeAxesActor2D_h
70 
71 #include "vtkActor2D.h"
72 #include "vtkRenderingAnnotationModule.h" // For export macro
73 
74 class vtkAlgorithmOutput;
75 class vtkAxisActor2D;
76 class vtkCamera;
77 class vtkCubeAxesActor2DConnection;
78 class vtkDataSet;
79 class vtkTextProperty;
80 
81 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
82 {
83 public:
85  void PrintSelf(ostream& os, vtkIndent indent) override;
86 
93 
95 
98  int RenderOverlay(vtkViewport*) override;
100  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
102 
107 
109 
115  virtual void SetInputData(vtkDataSet*);
116  virtual vtkDataSet* GetInput();
118 
120 
125  void SetViewProp(vtkProp* prop);
126  vtkGetObjectMacro(ViewProp, vtkProp);
128 
130 
136  vtkSetVector6Macro(Bounds, double);
137  double* GetBounds() VTK_SIZEHINT(6) override;
138  void GetBounds(
139  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
140  void GetBounds(double bounds[6]);
142 
144 
149  vtkSetVector6Macro(Ranges, double);
150  double* GetRanges() VTK_SIZEHINT(6);
151  void GetRanges(
152  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
153  void GetRanges(double ranges[6]);
155 
157 
162  vtkSetMacro(XOrigin, double);
163  vtkSetMacro(YOrigin, double);
164  vtkSetMacro(ZOrigin, double);
166 
168 
173  vtkSetMacro(UseRanges, vtkTypeBool);
174  vtkGetMacro(UseRanges, vtkTypeBool);
175  vtkBooleanMacro(UseRanges, vtkTypeBool);
177 
179 
183  virtual void SetCamera(vtkCamera*);
184  vtkGetObjectMacro(Camera, vtkCamera);
186 
187  enum FlyMode
188  {
189  VTK_FLY_OUTER_EDGES = 0,
190  VTK_FLY_CLOSEST_TRIAD = 1,
191  VTK_FLY_NONE = 2
192  };
193 
195 
200  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
201  vtkGetMacro(FlyMode, int);
202  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
203  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
204  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
206 
208 
214  vtkSetMacro(Scaling, vtkTypeBool);
215  vtkGetMacro(Scaling, vtkTypeBool);
216  vtkBooleanMacro(Scaling, vtkTypeBool);
218 
220 
225  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
226  vtkGetMacro(NumberOfLabels, int);
228 
230 
234  vtkSetStringMacro(XLabel);
235  vtkGetStringMacro(XLabel);
236  vtkSetStringMacro(YLabel);
237  vtkGetStringMacro(YLabel);
238  vtkSetStringMacro(ZLabel);
239  vtkGetStringMacro(ZLabel);
241 
246  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
247  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
248  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
249 
251 
256  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
258 
260 
265  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
267 
269 
273  vtkSetStringMacro(LabelFormat);
274  vtkGetStringMacro(LabelFormat);
276 
278 
282  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
283  vtkGetMacro(FontFactor, double);
285 
287 
292  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
293  vtkGetMacro(Inertia, int);
295 
297 
305  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
306  vtkGetMacro(ShowActualBounds, int);
308 
310 
315  vtkSetMacro(CornerOffset, double);
316  vtkGetMacro(CornerOffset, double);
318 
325 
327 
330  vtkSetMacro(XAxisVisibility, vtkTypeBool);
331  vtkGetMacro(XAxisVisibility, vtkTypeBool);
332  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
333  vtkSetMacro(YAxisVisibility, vtkTypeBool);
334  vtkGetMacro(YAxisVisibility, vtkTypeBool);
335  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
336  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
337  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
338  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
340 
345 
346 protected:
349 
350  vtkCubeAxesActor2DConnection* ConnectionHolder;
351 
352  vtkProp* ViewProp; // Define bounds from actor/assembly, or
353  double Bounds[6]; // Define bounds explicitly
354  double Ranges[6]; // Define ranges explicitly
355  vtkTypeBool UseRanges; // Flag to use ranges or not
356 
358  int FlyMode;
360 
364 
367 
369 
371  char* XLabel;
372  char* YLabel;
373  char* ZLabel;
374  char* Labels[3];
375 
379 
380  char* LabelFormat;
381  double FontFactor;
382  double CornerOffset;
383  int Inertia;
385  int InertiaAxes[8];
386 
388 
389  // Always show the actual bounds of the object
391 
392  double XOrigin;
393  double YOrigin;
394  double ZOrigin;
395 
396  // various helper methods
397  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
398  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
399  double EvaluatePoint(double planes[24], double x[3]);
400  double EvaluateBounds(double planes[24], double bounds[6]);
401  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
402  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
403  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
404 
405 private:
406  // hide the superclass' ShallowCopy() from the user and the compiler.
407  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
408 
409 private:
410  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
411  void operator=(const vtkCubeAxesActor2D&) = delete;
412 };
413 
414 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:155
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:161
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 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...
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...
double * GetBounds() override
Explicitly specify the region in space around which to draw the bounds.
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...
static vtkCubeAxesActor2D * New()
Instantiate object with bold, italic, and shadow enabled; font family set to Arial; and label format ...
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkAxisActor2D * GetZAxisActor2D()
int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6])
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 * GetXAxisActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example)
vtkAxisActor2D * XAxis
virtual vtkDataSet * GetInput()
Use the bounding box of this input dataset to draw the cube axes.
virtual void SetInputConnection(vtkAlgorithmOutput *)
Use the bounding box of this input dataset to draw the cube axes.
vtkAxisActor2D * GetYAxisActor2D()
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:172
a simple class to control print indentation
Definition: vtkIndent.h:119
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:55
abstract specification for Viewports
Definition: vtkViewport.h:56
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
void GetBounds(T a, double bds[6])
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_SIZEHINT(...)