fw4spl
fwVtkAxesActor.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef ANDROID
8 
9 #include "fwRenderVTK/vtk/fwVtkAxesActor.hpp"
10 
11 #include <vtkObjectFactory.h>
12 #include <vtkActor.h>
13 #include <vtkPolyData.h>
14 #include <vtkPolyDataMapper.h>
15 
16 
17 vtkStandardNewMacro(fwVtkAxesActor);
18 
19 //------------------------------------------------------------------------------
20 
21 fwVtkAxesActor::fwVtkAxesActor() : vtkAxesActor()
22 {
23 
24 }
25 
26 //------------------------------------------------------------------------------
27 
28 fwVtkAxesActor::~fwVtkAxesActor()
29 {
30 
31 }
32 
33 //------------------------------------------------------------------------------
34 
36 {
37  double bounds[6];
38  int i;
39 
40  this->XAxisShaft->GetBounds(this->Bounds);
41 
42  this->YAxisShaft->GetBounds(bounds);
43 
44  for ( i = 0; i < 3; ++i )
45  {
46  this->Bounds[2*i] =
47  (bounds[2*i] < this->Bounds[2*i]) ? (bounds[2*i]) : (this->Bounds[2*i]);
48 
49  this->Bounds[2*i+1] =
50  (bounds[2*i+1] > this->Bounds[2*i+1]) ? (bounds[2*i+1]) : (this->Bounds[2*i+1]);
51  }
52 
53  this->ZAxisShaft->GetBounds(bounds);
54  for ( i = 0; i < 3; ++i )
55  {
56  this->Bounds[2*i] =
57  (bounds[2*i] < this->Bounds[2*i]) ? (bounds[2*i]) : (this->Bounds[2*i]);
58 
59  this->Bounds[2*i+1] =
60  (bounds[2*i+1] > this->Bounds[2*i+1]) ? (bounds[2*i+1]) : (this->Bounds[2*i+1]);
61  }
62 
63  this->XAxisTip->GetBounds(bounds);
64  for ( i = 0; i < 3; ++i )
65  {
66  this->Bounds[2*i] =
67  (bounds[2*i] < this->Bounds[2*i]) ? (bounds[2*i]) : (this->Bounds[2*i]);
68 
69  this->Bounds[2*i+1] =
70  (bounds[2*i+1]>this->Bounds[2*i+1]) ? (bounds[2*i+1]) : (this->Bounds[2*i+1]);
71  }
72 
73  this->YAxisTip->GetBounds(bounds);
74  for ( i = 0; i < 3; ++i )
75  {
76  this->Bounds[2*i] =
77  (bounds[2*i] < this->Bounds[2*i]) ? (bounds[2*i]) : (this->Bounds[2*i]);
78 
79  this->Bounds[2*i+1] =
80  (bounds[2*i+1]>this->Bounds[2*i+1]) ? (bounds[2*i+1]) : (this->Bounds[2*i+1]);
81  }
82 
83  this->ZAxisTip->GetBounds(bounds);
84  for ( i = 0; i < 3; ++i )
85  {
86  this->Bounds[2*i] =
87  (bounds[2*i] < this->Bounds[2*i]) ? (bounds[2*i]) : (this->Bounds[2*i]);
88 
89  this->Bounds[2*i+1] =
90  (bounds[2*i+1]>this->Bounds[2*i+1]) ? (bounds[2*i+1]) : (this->Bounds[2*i+1]);
91  }
92 
93  double dbounds[6];
94  (vtkPolyDataMapper::SafeDownCast(this->YAxisShaft->GetMapper()))->
95  GetInput()->GetBounds( dbounds );
96 
97  for ( i = 0; i < 3; ++i )
98  {
99  this->Bounds[2*i] =
100  (dbounds[2*i] < this->Bounds[2*i]) ? (dbounds[2*i]) : (this->Bounds[2*i]);
101 
102  this->Bounds[2*i+1] =
103  (dbounds[2*i+1]>this->Bounds[2*i+1]) ? (dbounds[2*i+1]) : (this->Bounds[2*i+1]);
104  }
105 
106 
107  return this->Bounds;
108 }
109 
110 //------------------------------------------------------------------------------
111 
112 void fwVtkAxesActor::PrintSelf(std::ostream &os, vtkIndent indent)
113 {
114  os << indent << "fwVtkPicker: \n";
115  this->Superclass::PrintSelf(os,indent);
116 }
117 
118 //------------------------------------------------------------------------------
119 
120 #endif //ANDROID
The fwVtkAxesActor class is a specific and movable vtkAxesActor.
FWRENDERVTK_API double * GetBounds() override
Overload of GetBounds method : In vtkAxesActor Bounds are computed as &#39;Max&#39; of each actors...