VTK  9.2.6
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 =========================================================================*/
58 #ifndef vtkCubeAxesActor2D_h
59 #define vtkCubeAxesActor2D_h
60 
61 #include "vtkActor2D.h"
62 #include "vtkRenderingAnnotationModule.h" // For export macro
63 
64 class vtkAlgorithmOutput;
65 class vtkAxisActor2D;
66 class vtkCamera;
67 class vtkCubeAxesActor2DConnection;
68 class vtkDataSet;
69 class vtkTextProperty;
70 
71 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
72 {
73 public:
75  void PrintSelf(ostream& os, vtkIndent indent) override;
76 
83 
85 
88  int RenderOverlay(vtkViewport*) override;
90  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
92 
97 
99 
105  virtual void SetInputData(vtkDataSet*);
106  virtual vtkDataSet* GetInput();
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 
177  enum FlyMode
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 
336 protected:
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 
348  int FlyMode;
350 
354 
357 
359 
361  char* XLabel;
362  char* YLabel;
363  char* ZLabel;
364  char* Labels[3];
365 
369 
370  char* LabelFormat;
371  double FontFactor;
372  double CornerOffset;
373  int Inertia;
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 
395 private:
396  // hide the superclass' ShallowCopy() from the user and the compiler.
397  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
398 
399 private:
400  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
401  void operator=(const vtkCubeAxesActor2D&) = delete;
402 };
403 
404 #endif
a actor that draws 2D data
Definition: vtkActor2D.h:55
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:61
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:72
a simple class to control print indentation
Definition: vtkIndent.h:49
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
Definition: vtkTimeStamp.h:45
abstract specification for Viewports
Definition: vtkViewport.h:65
window superclass for vtkRenderWindow
Definition: vtkWindow.h:48
void GetBounds(T a, double bds[6])
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_SIZEHINT(...)