]> Creatis software - creaMaracasVisu.git/blobdiff - lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp
*** empty log message ***
[creaMaracasVisu.git] / lib / maracasVisuLib / src / interface / wxWindows / widgets / wxMaracasRenderImageTransformation.cpp
diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderImageTransformation.cpp
new file mode 100644 (file)
index 0000000..21bf444
--- /dev/null
@@ -0,0 +1,113 @@
+
+#include "wxMaracasRenderImageTransformation.h"
+
+/**
+** Class constructor
+**/
+wxMaracasRenderImageTransformation::wxMaracasRenderImageTransformation(wxMaracasMultipleVolumeRendererManager* _vol, wxMaracasSurfaceRenderingManager* _surface1, 
+                                                                                                                                                wxMaracasSurfaceRenderingManager* _surface2, wxMaracasSurfaceRenderingManager* _surface3, int id)
+{
+       vol = _vol;
+       surface1 = _surface1;
+       surface2 = _surface2;
+       surface3 = _surface3;
+
+       propID = id;
+
+       transformV = vtkTransform::New();
+       transformS1 = vtkTransform::New();
+       transformS2 = vtkTransform::New();
+       transformS3 = vtkTransform::New();
+
+}
+
+/**
+** Class destructor
+**/
+wxMaracasRenderImageTransformation::~wxMaracasRenderImageTransformation()
+{      
+}
+
+/**
+** Transforms a volume by the given value for the X axis
+**/
+void wxMaracasRenderImageTransformation::Translate(int x, int y, int z)
+{
+       transformV->Identity();
+       transformS1->Identity();
+       transformS2->Identity();
+       transformS3->Identity();
+
+       transformV->Translate( x, y, z );
+       transformS1->Translate( x, y, z );
+       transformS2->Translate( x, y, z );
+       transformS3->Translate( x, y, z );
+
+       Refresh();
+}
+
+/**
+** Rotates a volume by the given degree for the X axis
+**/
+void wxMaracasRenderImageTransformation::Rotate(int x, int y, int z)
+{
+       transformV->Identity();
+       transformS1->Identity();
+       transformS2->Identity();
+       transformS3->Identity();
+       
+       transformV->RotateX( x );
+       transformS1->RotateX( x );
+       transformS2->RotateX( x );
+       transformS3->RotateX( x );
+
+       transformV->RotateY( y );
+       transformS1->RotateY( y );
+       transformS2->RotateY( y );
+       transformS3->RotateY( y );
+
+       transformV->RotateZ( z );
+       transformS1->RotateZ( z );
+       transformS2->RotateZ( z );
+       transformS3->RotateZ( z );
+
+       Refresh();
+}
+
+/**
+** Scales a volume by the given value for the X axis
+**/
+void wxMaracasRenderImageTransformation::Scale(int x, int y, int z)
+{
+       transformV->Identity();
+       transformS1->Identity();
+       transformS2->Identity();
+       transformS3->Identity();
+
+       transformV->Scale( x, y, z );
+       transformS1->Scale( x, y, z );
+       transformS2->Scale( x, y, z );
+       transformS3->Scale( x, y, z );
+
+       Refresh();
+}
+
+void wxMaracasRenderImageTransformation::Refresh()throw(char*)
+{
+       transformV->Update();
+       transformS1->Update();
+       transformS2->Update();
+       transformS3->Update();
+
+       vol->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+       vol->getRenderer()->Render();
+
+       surface1->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+       surface1->getRenderer()->Render();
+
+       surface2->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+       surface2->getRenderer()->Render();
+
+       surface3->getViewData(propID)->getProp3D()->SetUserMatrix(transformV->GetMatrix());
+       surface3->getRenderer()->Render();
+}
\ No newline at end of file