]> Creatis software - creaMaracasVisu.git/blob - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp
\ No newline at end of file
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasRenderImageTransformation.cpp
1
2 #include "wxMaracasRenderImageTransformation.h"
3
4 /**
5 ** Class constructor
6 **/
7 wxMaracasRenderImageTransformation::wxMaracasRenderImageTransformation(wxMaracasMultipleVolumeRendererManager* _vol, wxMaracasSurfaceRenderingManager* _surface1, 
8                                                                                                                                                  wxMaracasSurfaceRenderingManager* _surface2, wxMaracasSurfaceRenderingManager* _surface3, int id)
9 {
10         vol = _vol;
11         surface1 = _surface1;
12         surface2 = _surface2;
13         surface3 = _surface3;
14
15         propID = id;
16
17         transformV = vtkTransform::New();
18         transformS1 = vtkTransform::New();
19         transformS2 = vtkTransform::New();
20         transformS3 = vtkTransform::New();
21
22 }
23
24 /**
25 ** Class destructor
26 **/
27 wxMaracasRenderImageTransformation::~wxMaracasRenderImageTransformation()
28 {       
29 }
30
31 /**
32 ** Transforms a volume by the given value for the X axis
33 **/
34 void wxMaracasRenderImageTransformation::Translate(int x, int y, int z)
35 {
36         transformV->Identity();
37         transformS1->Identity();
38         transformS2->Identity();
39         transformS3->Identity();
40
41         transformV->Translate( x, y, z );
42         transformS1->Translate( x, y, z );
43         transformS2->Translate( x, y, z );
44         transformS3->Translate( x, y, z );
45
46         Refresh();
47 }
48
49 /**
50 ** Rotates a volume by the given degree for the X axis
51 **/
52 void wxMaracasRenderImageTransformation::Rotate(int x, int y, int z)
53 {
54         transformV->Identity();
55         transformS1->Identity();
56         transformS2->Identity();
57         transformS3->Identity();
58         
59         transformV->RotateX( x );
60         transformS1->RotateX( x );
61         transformS2->RotateX( x );
62         transformS3->RotateX( x );
63
64         transformV->RotateY( y );
65         transformS1->RotateY( y );
66         transformS2->RotateY( y );
67         transformS3->RotateY( y );
68
69         transformV->RotateZ( z );
70         transformS1->RotateZ( z );
71         transformS2->RotateZ( z );
72         transformS3->RotateZ( z );
73
74         Refresh();
75 }
76
77 /**
78 ** Scales a volume by the given value for the X axis
79 **/
80 void wxMaracasRenderImageTransformation::Scale(int x, int y, int z)
81 {
82         transformV->Identity();
83         transformS1->Identity();
84         transformS2->Identity();
85         transformS3->Identity();
86
87         transformV->Scale( x, y, z );
88         transformS1->Scale( x, y, z );
89         transformS2->Scale( x, y, z );
90         transformS3->Scale( x, y, z );
91
92         Refresh();
93 }
94
95 void wxMaracasRenderImageTransformation::Refresh()throw(char*)
96 {
97         transformV->Update();
98         transformS1->Update();
99         transformS2->Update();
100         transformS3->Update();
101
102         vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
103         vol->getRenderer()->Render();
104
105         surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
106         surface1->getRenderer()->Render();
107
108         surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
109         surface2->getRenderer()->Render();
110
111         surface3->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
112         surface3->getRenderer()->Render();
113 }
114