VTK  9.0.1
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 =========================================================================*/
46 #ifndef vtkCubeAxesActor2D_h
47 #define vtkCubeAxesActor2D_h
48 
49 #include "vtkActor2D.h"
50 #include "vtkRenderingAnnotationModule.h" // For export macro
51 
52 class vtkAlgorithmOutput;
53 class vtkAxisActor2D;
54 class vtkCamera;
55 class vtkCubeAxesActor2DConnection;
56 class vtkDataSet;
57 class vtkTextProperty;
58 
59 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
60 {
61 public:
63  void PrintSelf(ostream& os, vtkIndent indent) override;
64 
70  static vtkCubeAxesActor2D* New();
71 
73 
76  int RenderOverlay(vtkViewport*) override;
77  int RenderOpaqueGeometry(vtkViewport*) override;
78  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
80 
85 
87 
92  virtual void SetInputConnection(vtkAlgorithmOutput*);
93  virtual void SetInputData(vtkDataSet*);
94  virtual vtkDataSet* GetInput();
96 
98 
103  void SetViewProp(vtkProp* prop);
104  vtkGetObjectMacro(ViewProp, vtkProp);
106 
108 
114  vtkSetVector6Macro(Bounds, double);
115  double* GetBounds() VTK_SIZEHINT(6) override;
116  void GetBounds(
117  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
118  void GetBounds(double bounds[6]);
120 
122 
127  vtkSetVector6Macro(Ranges, double);
128  double* GetRanges() VTK_SIZEHINT(6);
129  void GetRanges(
130  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
131  void GetRanges(double ranges[6]);
133 
135 
140  vtkSetMacro(XOrigin, double);
141  vtkSetMacro(YOrigin, double);
142  vtkSetMacro(ZOrigin, double);
144 
146 
151  vtkSetMacro(UseRanges, vtkTypeBool);
152  vtkGetMacro(UseRanges, vtkTypeBool);
153  vtkBooleanMacro(UseRanges, vtkTypeBool);
155 
157 
161  virtual void SetCamera(vtkCamera*);
162  vtkGetObjectMacro(Camera, vtkCamera);
164 
165  enum FlyMode
166  {
167  VTK_FLY_OUTER_EDGES = 0,
168  VTK_FLY_CLOSEST_TRIAD = 1,
169  VTK_FLY_NONE = 2
170  };
171 
173 
178  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
179  vtkGetMacro(FlyMode, int);
180  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
181  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
182  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
184 
186 
192  vtkSetMacro(Scaling, vtkTypeBool);
193  vtkGetMacro(Scaling, vtkTypeBool);
194  vtkBooleanMacro(Scaling, vtkTypeBool);
196 
198 
203  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
204  vtkGetMacro(NumberOfLabels, int);
206 
208 
212  vtkSetStringMacro(XLabel);
213  vtkGetStringMacro(XLabel);
214  vtkSetStringMacro(YLabel);
215  vtkGetStringMacro(YLabel);
216  vtkSetStringMacro(ZLabel);
217  vtkGetStringMacro(ZLabel);
219 
224  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
225  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
226  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
227 
229 
233  virtual void SetAxisTitleTextProperty(vtkTextProperty* p);
234  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
236 
238 
242  virtual void SetAxisLabelTextProperty(vtkTextProperty* p);
243  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
245 
247 
251  vtkSetStringMacro(LabelFormat);
252  vtkGetStringMacro(LabelFormat);
254 
256 
260  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
261  vtkGetMacro(FontFactor, double);
263 
265 
270  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
271  vtkGetMacro(Inertia, int);
273 
275 
283  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
284  vtkGetMacro(ShowActualBounds, int);
286 
288 
293  vtkSetMacro(CornerOffset, double);
294  vtkGetMacro(CornerOffset, double);
296 
302  void ReleaseGraphicsResources(vtkWindow*) override;
303 
305 
308  vtkSetMacro(XAxisVisibility, vtkTypeBool);
309  vtkGetMacro(XAxisVisibility, vtkTypeBool);
310  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
311  vtkSetMacro(YAxisVisibility, vtkTypeBool);
312  vtkGetMacro(YAxisVisibility, vtkTypeBool);
313  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
314  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
315  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
316  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
318 
322  void ShallowCopy(vtkCubeAxesActor2D* actor);
323 
324 protected:
326  ~vtkCubeAxesActor2D() override;
327 
328  vtkCubeAxesActor2DConnection* ConnectionHolder;
329 
330  vtkProp* ViewProp; // Define bounds from actor/assembly, or
331  double Bounds[6]; // Define bounds explicitly
332  double Ranges[6]; // Define ranges explicitly
333  vtkTypeBool UseRanges; // Flag to use ranges or not
334 
336  int FlyMode;
338 
342 
345 
347 
349  char* XLabel;
350  char* YLabel;
351  char* ZLabel;
352  char* Labels[3];
353 
357 
358  char* LabelFormat;
359  double FontFactor;
360  double CornerOffset;
361  int Inertia;
363  int InertiaAxes[8];
364 
366 
367  // Always show the actual bounds of the object
369 
370  double XOrigin;
371  double YOrigin;
372  double ZOrigin;
373 
374  // various helper methods
375  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
376  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
377  double EvaluatePoint(double planes[24], double x[3]);
378  double EvaluateBounds(double planes[24], double bounds[6]);
379  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
380  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
381  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
382 
383 private:
384  // hide the superclass' ShallowCopy() from the user and the compiler.
385  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
386 
387 private:
388  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
389  void operator=(const vtkCubeAxesActor2D&) = delete;
390 };
391 
392 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:53
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
vtkAxisActor2D * ZAxis
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: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:155
a actor that draws 2D data
Definition: vtkActor2D.h:39
record modification and/or execution time
Definition: vtkTimeStamp.h:32
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:69
virtual double * GetBounds()
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
Definition: vtkProp.h:132
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
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:33
a virtual camera for 3D rendering
Definition: vtkCamera.h:45
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.