VTK  9.1.0
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 =========================================================================*/
65 #ifndef vtkCubeAxesActor2D_h
66 #define vtkCubeAxesActor2D_h
67 
68 #include "vtkActor2D.h"
69 #include "vtkRenderingAnnotationModule.h" // For export macro
70 
71 class vtkAlgorithmOutput;
72 class vtkAxisActor2D;
73 class vtkCamera;
74 class vtkCubeAxesActor2DConnection;
75 class vtkDataSet;
76 class vtkTextProperty;
77 
78 class VTKRENDERINGANNOTATION_EXPORT vtkCubeAxesActor2D : public vtkActor2D
79 {
80 public:
82  void PrintSelf(ostream& os, vtkIndent indent) override;
83 
90 
92 
95  int RenderOverlay(vtkViewport*) override;
97  int RenderTranslucentPolygonalGeometry(vtkViewport*) override { return 0; }
99 
104 
106 
112  virtual void SetInputData(vtkDataSet*);
113  virtual vtkDataSet* GetInput();
115 
117 
122  void SetViewProp(vtkProp* prop);
123  vtkGetObjectMacro(ViewProp, vtkProp);
125 
127 
133  vtkSetVector6Macro(Bounds, double);
134  double* GetBounds() VTK_SIZEHINT(6) override;
135  void GetBounds(
136  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
137  void GetBounds(double bounds[6]);
139 
141 
146  vtkSetVector6Macro(Ranges, double);
147  double* GetRanges() VTK_SIZEHINT(6);
148  void GetRanges(
149  double& xmin, double& xmax, double& ymin, double& ymax, double& zmin, double& zmax);
150  void GetRanges(double ranges[6]);
152 
154 
159  vtkSetMacro(XOrigin, double);
160  vtkSetMacro(YOrigin, double);
161  vtkSetMacro(ZOrigin, double);
163 
165 
170  vtkSetMacro(UseRanges, vtkTypeBool);
171  vtkGetMacro(UseRanges, vtkTypeBool);
172  vtkBooleanMacro(UseRanges, vtkTypeBool);
174 
176 
180  virtual void SetCamera(vtkCamera*);
181  vtkGetObjectMacro(Camera, vtkCamera);
183 
184  enum FlyMode
185  {
186  VTK_FLY_OUTER_EDGES = 0,
187  VTK_FLY_CLOSEST_TRIAD = 1,
188  VTK_FLY_NONE = 2
189  };
190 
192 
197  vtkSetClampMacro(FlyMode, int, VTK_FLY_OUTER_EDGES, VTK_FLY_NONE);
198  vtkGetMacro(FlyMode, int);
199  void SetFlyModeToOuterEdges() { this->SetFlyMode(VTK_FLY_OUTER_EDGES); }
200  void SetFlyModeToClosestTriad() { this->SetFlyMode(VTK_FLY_CLOSEST_TRIAD); }
201  void SetFlyModeToNone() { this->SetFlyMode(VTK_FLY_NONE); }
203 
205 
211  vtkSetMacro(Scaling, vtkTypeBool);
212  vtkGetMacro(Scaling, vtkTypeBool);
213  vtkBooleanMacro(Scaling, vtkTypeBool);
215 
217 
222  vtkSetClampMacro(NumberOfLabels, int, 0, 50);
223  vtkGetMacro(NumberOfLabels, int);
225 
227 
231  vtkSetStringMacro(XLabel);
232  vtkGetStringMacro(XLabel);
233  vtkSetStringMacro(YLabel);
234  vtkGetStringMacro(YLabel);
235  vtkSetStringMacro(ZLabel);
236  vtkGetStringMacro(ZLabel);
238 
243  vtkAxisActor2D* GetXAxisActor2D() { return this->XAxis; }
244  vtkAxisActor2D* GetYAxisActor2D() { return this->YAxis; }
245  vtkAxisActor2D* GetZAxisActor2D() { return this->ZAxis; }
246 
248 
253  vtkGetObjectMacro(AxisTitleTextProperty, vtkTextProperty);
255 
257 
262  vtkGetObjectMacro(AxisLabelTextProperty, vtkTextProperty);
264 
266 
270  vtkSetStringMacro(LabelFormat);
271  vtkGetStringMacro(LabelFormat);
273 
275 
279  vtkSetClampMacro(FontFactor, double, 0.1, 2.0);
280  vtkGetMacro(FontFactor, double);
282 
284 
289  vtkSetClampMacro(Inertia, int, 1, VTK_INT_MAX);
290  vtkGetMacro(Inertia, int);
292 
294 
302  vtkSetClampMacro(ShowActualBounds, int, 0, 1);
303  vtkGetMacro(ShowActualBounds, int);
305 
307 
312  vtkSetMacro(CornerOffset, double);
313  vtkGetMacro(CornerOffset, double);
315 
322 
324 
327  vtkSetMacro(XAxisVisibility, vtkTypeBool);
328  vtkGetMacro(XAxisVisibility, vtkTypeBool);
329  vtkBooleanMacro(XAxisVisibility, vtkTypeBool);
330  vtkSetMacro(YAxisVisibility, vtkTypeBool);
331  vtkGetMacro(YAxisVisibility, vtkTypeBool);
332  vtkBooleanMacro(YAxisVisibility, vtkTypeBool);
333  vtkSetMacro(ZAxisVisibility, vtkTypeBool);
334  vtkGetMacro(ZAxisVisibility, vtkTypeBool);
335  vtkBooleanMacro(ZAxisVisibility, vtkTypeBool);
337 
342 
343 protected:
346 
347  vtkCubeAxesActor2DConnection* ConnectionHolder;
348 
349  vtkProp* ViewProp; // Define bounds from actor/assembly, or
350  double Bounds[6]; // Define bounds explicitly
351  double Ranges[6]; // Define ranges explicitly
352  vtkTypeBool UseRanges; // Flag to use ranges or not
353 
355  int FlyMode;
357 
361 
364 
366 
368  char* XLabel;
369  char* YLabel;
370  char* ZLabel;
371  char* Labels[3];
372 
376 
377  char* LabelFormat;
378  double FontFactor;
379  double CornerOffset;
380  int Inertia;
382  int InertiaAxes[8];
383 
385 
386  // Always show the actual bounds of the object
388 
389  double XOrigin;
390  double YOrigin;
391  double ZOrigin;
392 
393  // various helper methods
394  void TransformBounds(vtkViewport* viewport, double bounds[6], double pts[8][3]);
395  int ClipBounds(vtkViewport* viewport, double pts[8][3], double bounds[6]);
396  double EvaluatePoint(double planes[24], double x[3]);
397  double EvaluateBounds(double planes[24], double bounds[6]);
398  void AdjustAxes(double pts[8][3], double bounds[6], int idx, int xIdx, int yIdx, int zIdx,
399  int zIdx2, int xAxes, int yAxes, int zAxes, double xCoords[4], double yCoords[4],
400  double zCoords[4], double xRange[2], double yRange[2], double zRange[2]);
401 
402 private:
403  // hide the superclass' ShallowCopy() from the user and the compiler.
404  void ShallowCopy(vtkProp* prop) override { this->vtkProp::ShallowCopy(prop); }
405 
406 private:
407  vtkCubeAxesActor2D(const vtkCubeAxesActor2D&) = delete;
408  void operator=(const vtkCubeAxesActor2D&) = delete;
409 };
410 
411 #endif
vtkCubeAxesActor2D::Scaling
vtkTypeBool Scaling
Definition: vtkCubeAxesActor2D.h:356
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:155
vtkCubeAxesActor2D::AdjustAxes
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])
vtkCubeAxesActor2D::XAxisVisibility
vtkTypeBool XAxisVisibility
Definition: vtkCubeAxesActor2D.h:373
vtkCubeAxesActor2D::CornerOffset
double CornerOffset
Definition: vtkCubeAxesActor2D.h:379
vtkCubeAxesActor2D::Inertia
int Inertia
Definition: vtkCubeAxesActor2D.h:380
vtkCubeAxesActor2D::HasTranslucentPolygonalGeometry
vtkTypeBool HasTranslucentPolygonalGeometry() override
Does this prop have some translucent polygonal geometry?
vtkCubeAxesActor2D::SetFlyModeToClosestTriad
void SetFlyModeToClosestTriad()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
Definition: vtkCubeAxesActor2D.h:200
vtkCubeAxesActor2D::FlyMode
int FlyMode
Definition: vtkCubeAxesActor2D.h:355
vtkCubeAxesActor2D::RenderOpaqueGeometry
int RenderOpaqueGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkActor2D::ShallowCopy
void ShallowCopy(vtkProp *prop) override
Shallow copy of this vtkActor2D.
vtkCubeAxesActor2D::YLabel
char * YLabel
Definition: vtkCubeAxesActor2D.h:369
vtkCubeAxesActor2D::ReleaseGraphicsResources
void ReleaseGraphicsResources(vtkWindow *) override
Release any graphics resources that are being consumed by this actor.
vtkTimeStamp
record modification and/or execution time
Definition: vtkTimeStamp.h:52
vtkCubeAxesActor2D::XAxis
vtkAxisActor2D * XAxis
Definition: vtkCubeAxesActor2D.h:358
vtkCubeAxesActor2D::RenderCount
int RenderCount
Definition: vtkCubeAxesActor2D.h:381
vtkCubeAxesActor2D::RenderTranslucentPolygonalGeometry
int RenderTranslucentPolygonalGeometry(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
Definition: vtkCubeAxesActor2D.h:97
vtkCubeAxesActor2D::EvaluatePoint
double EvaluatePoint(double planes[24], double x[3])
vtkWindow
window superclass for vtkRenderWindow
Definition: vtkWindow.h:39
vtkCubeAxesActor2D::SetViewProp
void SetViewProp(vtkProp *prop)
Use the bounding box of this prop to draw the cube axes.
vtkCubeAxesActor2D::ShallowCopy
void ShallowCopy(vtkCubeAxesActor2D *actor)
Shallow copy of a CubeAxesActor2D.
vtkCubeAxesActor2D::GetYAxisActor2D
vtkAxisActor2D * GetYAxisActor2D()
Definition: vtkCubeAxesActor2D.h:244
vtkCubeAxesActor2D::YAxisVisibility
vtkTypeBool YAxisVisibility
Definition: vtkCubeAxesActor2D.h:374
vtkCubeAxesActor2D::YAxis
vtkAxisActor2D * YAxis
Definition: vtkCubeAxesActor2D.h:359
VTK_SIZEHINT
#define VTK_SIZEHINT(...)
Definition: vtkWrappingHints.h:48
vtkCubeAxesActor2D::UseRanges
vtkTypeBool UseRanges
Definition: vtkCubeAxesActor2D.h:352
vtkCubeAxesActor2D::SetAxisLabelTextProperty
virtual void SetAxisLabelTextProperty(vtkTextProperty *p)
Set/Get the labels text property of all axes.
vtkBlockSortHelper::GetBounds
void GetBounds(T a, double bds[6])
Definition: vtkBlockSortHelper.h:37
vtkCubeAxesActor2D::FontFactor
double FontFactor
Definition: vtkCubeAxesActor2D.h:378
vtkCubeAxesActor2D::ZAxis
vtkAxisActor2D * ZAxis
Definition: vtkCubeAxesActor2D.h:360
vtkCubeAxesActor2D::XOrigin
double XOrigin
Definition: vtkCubeAxesActor2D.h:389
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:113
vtkCubeAxesActor2D
create a 2D plot of a bounding box edges - used for navigation
Definition: vtkCubeAxesActor2D.h:79
vtkCamera
a virtual camera for 3D rendering
Definition: vtkCamera.h:155
vtkCubeAxesActor2D::SetFlyModeToNone
void SetFlyModeToNone()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
Definition: vtkCubeAxesActor2D.h:201
vtkCubeAxesActor2D::AxisLabelTextProperty
vtkTextProperty * AxisLabelTextProperty
Definition: vtkCubeAxesActor2D.h:363
vtkCubeAxesActor2D::AxisTitleTextProperty
vtkTextProperty * AxisTitleTextProperty
Definition: vtkCubeAxesActor2D.h:362
vtkCubeAxesActor2D::GetInput
virtual vtkDataSet * GetInput()
Use the bounding box of this input dataset to draw the cube axes.
vtkCubeAxesActor2D::TransformBounds
void TransformBounds(vtkViewport *viewport, double bounds[6], double pts[8][3])
vtkCubeAxesActor2D::SetInputData
virtual void SetInputData(vtkDataSet *)
Use the bounding box of this input dataset to draw the cube axes.
vtkProp::ShallowCopy
virtual void ShallowCopy(vtkProp *prop)
Shallow copy of this vtkProp.
vtkViewport
abstract specification for Viewports
Definition: vtkViewport.h:47
vtkCubeAxesActor2D::LabelFormat
char * LabelFormat
Definition: vtkCubeAxesActor2D.h:377
vtkCubeAxesActor2D::YOrigin
double YOrigin
Definition: vtkCubeAxesActor2D.h:390
vtkCubeAxesActor2D::vtkCubeAxesActor2D
vtkCubeAxesActor2D()
vtkCubeAxesActor2D::BuildTime
vtkTimeStamp BuildTime
Definition: vtkCubeAxesActor2D.h:365
vtkDataSet
abstract class to specify dataset behavior
Definition: vtkDataSet.h:166
vtkTextProperty
represent text properties.
Definition: vtkTextProperty.h:143
vtkCubeAxesActor2D::RenderSomething
int RenderSomething
Definition: vtkCubeAxesActor2D.h:384
vtkProp
abstract superclass for all actors, volumes and annotations
Definition: vtkProp.h:76
vtkCubeAxesActor2D::ShowActualBounds
int ShowActualBounds
Definition: vtkCubeAxesActor2D.h:387
vtkCubeAxesActor2D::ViewProp
vtkProp * ViewProp
Definition: vtkCubeAxesActor2D.h:349
vtkCubeAxesActor2D::GetXAxisActor2D
vtkAxisActor2D * GetXAxisActor2D()
Retrieve handles to the X, Y and Z axis (so that you can set their text properties for example)
Definition: vtkCubeAxesActor2D.h:243
vtkActor2D
a actor that draws 2D data
Definition: vtkActor2D.h:149
vtkActor2D.h
vtkCubeAxesActor2D::~vtkCubeAxesActor2D
~vtkCubeAxesActor2D() override
vtkCubeAxesActor2D::RenderOverlay
int RenderOverlay(vtkViewport *) override
Draw the axes as per the vtkProp superclass' API.
vtkAlgorithmOutput
Proxy object to connect input/output ports.
Definition: vtkAlgorithmOutput.h:66
vtkCubeAxesActor2D::SetAxisTitleTextProperty
virtual void SetAxisTitleTextProperty(vtkTextProperty *p)
Set/Get the title text property of all axes.
vtkCubeAxesActor2D::SetInputConnection
virtual void SetInputConnection(vtkAlgorithmOutput *)
Use the bounding box of this input dataset to draw the cube axes.
vtkAxisActor2D
Create an axis with tick marks and labels.
Definition: vtkAxisActor2D.h:70
vtkCubeAxesActor2D::FlyMode
FlyMode
Definition: vtkCubeAxesActor2D.h:185
vtkCubeAxesActor2D::EvaluateBounds
double EvaluateBounds(double planes[24], double bounds[6])
vtkCubeAxesActor2D::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCubeAxesActor2D::GetBounds
double * GetBounds() override
Explicitly specify the region in space around which to draw the bounds.
vtkCubeAxesActor2D::ZAxisVisibility
vtkTypeBool ZAxisVisibility
Definition: vtkCubeAxesActor2D.h:375
vtkCubeAxesActor2D::SetFlyModeToOuterEdges
void SetFlyModeToOuterEdges()
Specify a mode to control how the axes are drawn: either outer edges or closest triad to the camera p...
Definition: vtkCubeAxesActor2D.h:199
vtkCubeAxesActor2D::ConnectionHolder
vtkCubeAxesActor2DConnection * ConnectionHolder
Definition: vtkCubeAxesActor2D.h:347
vtkCubeAxesActor2D::ZLabel
char * ZLabel
Definition: vtkCubeAxesActor2D.h:370
vtkCubeAxesActor2D::New
static vtkCubeAxesActor2D * New()
Instantiate object with bold, italic, and shadow enabled; font family set to Arial; and label format ...
vtkCubeAxesActor2D::ZOrigin
double ZOrigin
Definition: vtkCubeAxesActor2D.h:391
vtkCubeAxesActor2D::ClipBounds
int ClipBounds(vtkViewport *viewport, double pts[8][3], double bounds[6])
vtkCubeAxesActor2D::GetZAxisActor2D
vtkAxisActor2D * GetZAxisActor2D()
Definition: vtkCubeAxesActor2D.h:245
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkCubeAxesActor2D::NumberOfLabels
int NumberOfLabels
Definition: vtkCubeAxesActor2D.h:367
vtkCubeAxesActor2D::XLabel
char * XLabel
Definition: vtkCubeAxesActor2D.h:368
vtkCubeAxesActor2D::Camera
vtkCamera * Camera
Definition: vtkCubeAxesActor2D.h:354