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 
71 
73 
76  int RenderOverlay(vtkViewport*) override;
78  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
80 
85 
87 
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 
234  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
236 
238 
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 
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 
323 
324 protected:
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
a actor that draws 2D data
Definition: vtkActor2D.h:40
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:46
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.
double EvaluatePoint(double planes[24], double x[3])
double EvaluateBounds(double planes[24], double bounds[6])
virtual void SetInputData(vtkDataSet *)
int RenderOpaqueGeometry(vtkViewport *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THESE METHODS OUTSIDE OF THE RENDE...
virtual void SetAxisLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property of all axes.
double * GetBounds() override
Get the bounds for this Prop as (Xmin,Xmax,Ymin,Ymax,Zmin,Zmax).
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
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()
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:57
a simple class to control print indentation
Definition: vtkIndent.h:34
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:48
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
represent text properties.
record modification and/or execution time
Definition: vtkTimeStamp.h:33
abstract specification for Viewports
Definition: vtkViewport.h:45
window superclass for vtkRenderWindow
Definition: vtkWindow.h:35
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_INT_MAX
Definition: vtkType.h:155
#define VTK_SIZEHINT(...)