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 =========================================================================*/
49 #ifndef vtkCubeAxesActor2D_h
50 #define vtkCubeAxesActor2D_h
51 
52 #include "vtkActor2D.h"
53 #include "vtkRenderingAnnotationModule.h" // For export macro
54 
55 class vtkAlgorithmOutput;
56 class vtkAxisActor2D;
57 class vtkCamera;
58 class vtkCubeAxesActor2DConnection;
59 class vtkDataSet;
60 class vtkTextProperty;
61 
62 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
63 {
64 public:
66  void PrintSelf(ostream& os, vtkIndent indent) override;
67 
73  static vtkCubeAxesActor2D* New();
74 
76 
79  int RenderOverlay(vtkViewport*) override;
80  int RenderOpaqueGeometry(vtkViewport*) override;
81  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
83 
88 
90 
95  virtual void SetInputConnection(vtkAlgorithmOutput*);
96  virtual void SetInputData(vtkDataSet*);
97  virtual vtkDataSet* GetInput();
99 
101 
106  void SetViewProp(vtkProp* prop);
107  vtkGetObjectMacro(ViewProp, vtkProp);
109 
111 
117  vtkSetVector6Macro(Bounds, double);
118  double* GetBounds() VTK_SIZEHINT(6) override;
119  void GetBounds(
120  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
121  void GetBounds(double bounds[6]);
123 
125 
130  vtkSetVector6Macro(Ranges, double);
131  double* GetRanges() VTK_SIZEHINT(6);
132  void GetRanges(
133  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
134  void GetRanges(double ranges[6]);
136 
138 
143  vtkSetMacro(XOrigin, double);
144  vtkSetMacro(YOrigin, double);
145  vtkSetMacro(ZOrigin, double);
147 
149 
154  vtkSetMacro(UseRanges, vtkTypeBool);
155  vtkGetMacro(UseRanges, vtkTypeBool);
156  vtkBooleanMacro(UseRanges, vtkTypeBool);
158 
160 
164  virtual void SetCamera(vtkCamera*);
165  vtkGetObjectMacro(Camera, vtkCamera);
167 
168  enum FlyMode
169  {
170  VTK_FLY_OUTER_EDGES = 0,
171  VTK_FLY_CLOSEST_TRIAD = 1,
172  VTK_FLY_NONE = 2
173  };
174 
176 
181  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
182  vtkGetMacro(FlyMode, int);
183  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
184  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
185  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
187 
189 
195  vtkSetMacro(Scaling, vtkTypeBool);
196  vtkGetMacro(Scaling, vtkTypeBool);
197  vtkBooleanMacro(Scaling, vtkTypeBool);
199 
201 
206  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
207  vtkGetMacro(NumberOfLabels, int);
209 
211 
215  vtkSetStringMacro(XLabel);
216  vtkGetStringMacro(XLabel);
217  vtkSetStringMacro(YLabel);
218  vtkGetStringMacro(YLabel);
219  vtkSetStringMacro(ZLabel);
220  vtkGetStringMacro(ZLabel);
222 
227  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
228  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
229  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
230 
232 
236  virtual void SetAxisTitleTextProperty(vtkTextProperty* p);
237  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
239 
241 
245  virtual void SetAxisLabelTextProperty(vtkTextProperty* p);
246  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
248 
250 
254  vtkSetStringMacro(LabelFormat);
255  vtkGetStringMacro(LabelFormat);
257 
259 
263  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
264  vtkGetMacro(FontFactor, double);
266 
268 
273  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
274  vtkGetMacro(Inertia, int);
276 
278 
286  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
287  vtkGetMacro(ShowActualBounds, int);
289 
291 
296  vtkSetMacro(CornerOffset, double);
297  vtkGetMacro(CornerOffset, double);
299 
305  void ReleaseGraphicsResources(vtkWindow*) override;
306 
308 
311  vtkSetMacro(XAxisVisibility, vtkTypeBool);
312  vtkGetMacro(XAxisVisibility, vtkTypeBool);
313  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
314  vtkSetMacro(YAxisVisibility, vtkTypeBool);
315  vtkGetMacro(YAxisVisibility, vtkTypeBool);
316  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
317  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
318  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
319  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
321 
325  void ShallowCopy(vtkCubeAxesActor2D* actor);
326 
327 protected:
329  ~vtkCubeAxesActor2D() override;
330 
331  vtkCubeAxesActor2DConnection* ConnectionHolder;
332 
333  vtkProp* ViewProp; // Define bounds from actor/assembly, or
334  double Bounds[6]; // Define bounds explicitly
335  double Ranges[6]; // Define ranges explicitly
336  vtkTypeBool UseRanges; // Flag to use ranges or not
337 
339  int FlyMode;
341 
345 
348 
350 
352  char* XLabel;
353  char* YLabel;
354  char* ZLabel;
355  char* Labels[3];
356 
360 
361  char* LabelFormat;
362  double FontFactor;
363  double CornerOffset;
364  int Inertia;
366  int InertiaAxes[8];
367 
369 
370  // Always show the actual bounds of the object
372 
373  double XOrigin;
374  double YOrigin;
375  double ZOrigin;
376 
377  // various helper methods
378  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
379  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
380  double EvaluatePoint(double planes[24], double x[3]);
381  double EvaluateBounds(double planes[24], double bounds[6]);
382  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
383  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
384  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
385 
386 private:
387  // hide the superclass' ShallowCopy() from the user and the compiler.
388  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
389 
390 private:
391  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
392  void operator=(const vtkCubeAxesActor2D&) = delete;
393 };
394 
395 #endif
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:56
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:55
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
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:45
record modification and/or execution time
Definition: vtkTimeStamp.h:35
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:135
window superclass for vtkRenderWindow
Definition: vtkWindow.h:38
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:39
a virtual camera for 3D rendering
Definition: vtkCamera.h:51
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.