From: Eduardo DAVILA Date: Wed, 5 Jun 2013 14:45:12 +0000 (+0200) Subject: 2022 Feature Cleanning Viewer type camera in viewer 3D X-Git-Url: https://git.creatis.insa-lyon.fr/pubgit/?a=commitdiff_plain;h=d341ae08f29d0b48044dcee9b4d7399c4b895e52;p=creaMaracasVisu.git 2022 Feature Cleanning Viewer type camera in viewer 3D --- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderTabbedPanel.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderTabbedPanel.cpp index b26adf9..69538a8 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderTabbedPanel.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderTabbedPanel.cpp @@ -372,7 +372,8 @@ void wxMaracasRenderTabbedPanel::addMPROptions() { mwxvtkmpr3Dview ->SetVtkMPR3DDataViewer(vtkmpr3Ddataviewer); mwxvtkmpr3Dview ->Configure(); - mwxvtkmpr3Dview ->ResetCamera(ext,org,spc); +//EED 27/05/2013 + mwxvtkmpr3Dview ->GetWxvtk3Dbaseview()->ResetCamera(ext ,spc); vtkInteractorStyleBaseView* vtkInteractorBV = (vtkInteractorStyleBaseView*)mwxvtkmpr3Dview->GetWxvtk3Dbaseview()->GetInteractorStyleBaseView(); vtkInteractorBV->AddParentToReport(this); } diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx index 699750d..9d92c22 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx @@ -73,6 +73,42 @@ void wxVtk3DBaseView::Refresh() vri->vtkRenderWindowInteractor::Render(); } +//------------------------------------------------------------------- +// EED 27/05/2013 +void wxVtk3DBaseView::ResetCamera(int* ext, double* spc) +{ + + GetRenderer()->ResetCameraClippingRange(); + + if(ext == NULL) + { + + GetRenderer()->ResetCamera (); + GetCamera()->Dolly(1.2); + }else{ + + /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0)); + double y = (spc[1])*(origin[1]+(double)ext[3]); + double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/ + /*double x0=(spc[0])*((double)ext[0]+origin[0]); + double x1=(spc[0])*((double)ext[1]+origin[0]); + double y0=(spc[1])*((double)ext[2]+origin[1]); + double y1=(spc[1])*((double)ext[3]+origin[1]); + double z0=(spc[2])*((double)ext[4]+origin[2]); + double z1=(spc[2])*((double)ext[5]+origin[2]);*/ + + double x0=(spc[0])*((double)ext[0]); + double x1=(spc[0])*((double)ext[1]); + double y0=(spc[1])*((double)ext[2]); + double y1=(spc[1])*((double)ext[3]); + double z0=(spc[2])*((double)ext[4]); + double z1=(spc[2])*((double)ext[5]); + + GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1); + //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z); + GetCamera()->Dolly(1.5); + } +} //------------------------------------------------------------------- void wxVtk3DBaseView::SetStereo(int type) @@ -148,6 +184,16 @@ void wxVtk3DBaseView::Configure() _aCamera->SetFocalPoint (0, 0, 0); _aCamera->ComputeViewPlaneNormal(); +//EED 27/05/2013 + GetRenderer()->SetActiveCamera(GetCamera()); + +//EED 21 mars 2012 FLIP probleme ..PLOP.. +//EED 13 may 2013 FLIP probleme ..PLOP.. + GetCamera()->Roll(180); + GetCamera()->Yaw(180+30); + GetCamera()->Pitch(-22); + + } } //------------------------------------------------------------------- diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.h index 7406907..8a32d1f 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.h @@ -37,7 +37,8 @@ //------------------------------------------------------------------ //------------------------------------------------------------------ -class creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView{ +class creaMaracasVisu_EXPORT wxVtk3DBaseView: public wxVtkBaseView +{ public: wxVtk3DBaseView( wxWindow *parent ); virtual ~wxVtk3DBaseView(); @@ -46,8 +47,10 @@ public: virtual vtkRenderWindow* GetRenWin(); void Refresh(); void Configure(); - virtual void GetSpacing(double spc[3]); + virtual void GetSpacing(double spc[3]); void SetStereo(int type); + void ResetCamera(int *ext=NULL,double* spc=NULL); + private: bool _configure; diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx index 91cfbc2..a53f035 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx @@ -156,7 +156,6 @@ wxVtk3DBaseView* wxVtkClipping3DView::GetWxvtk3Dbaseview()throw(char*) //------------------------------------------------------------------- void wxVtkClipping3DView::Configure() { - _wxvtk3Dbaseview->Configure(); // Actors are added to the renderer. @@ -227,11 +226,13 @@ void wxVtkClipping3DView::Configure() // _boxWidgetVolume->GetPlanes( vtkplanes ); +//EED 27/05/2013 +// _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); +// _wxvtk3Dbaseview->GetCamera()->Dolly(1.2); + // An initial camera view is created. The Dolly() method moves // the camera towards the FocalPoint, thereby enlarging the image. - _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera()); - _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); - _wxvtk3Dbaseview->GetCamera()->Dolly(2); + _wxvtk3Dbaseview->ResetCamera(); // Set a background color for the renderer and set the size of the diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx index f97208a..6bdef1c 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx @@ -180,45 +180,7 @@ void wxVtkMPR3DView::RemoveActor(vtkActor* actor) _wxvtk3Dbaseview->GetRenderer()->RemoveActor(actor); } -//------------------------------------------------------------------- -void wxVtkMPR3DView::ResetCamera(int* ext, double* origin,double* spc) -{ - if(ext == NULL) - { - -//EED 21 mars 2012 FLIP probleme ..PLOP.. -//EED 13 may 2013 FLIP probleme ..PLOP.. - _wxvtk3Dbaseview->GetCamera()->Roll(180); - _wxvtk3Dbaseview->GetCamera()->Yaw(180+30); - _wxvtk3Dbaseview->GetCamera()->Pitch(-22); - - _wxvtk3Dbaseview->GetRenderer()->ResetCamera (); - _wxvtk3Dbaseview->GetCamera()->Dolly(2.0); - - }else{ - - /*double x = (spc[0])*(origin[0]+(((double)ext[1]-(double)ext[0])/2.0)); - double y = (spc[1])*(origin[1]+(double)ext[3]); - double z = (spc[2])*(origin[2]+(((double)ext[5]-(double)ext[4])/2.0));*/ - /*double x0=(spc[0])*((double)ext[0]+origin[0]); - double x1=(spc[0])*((double)ext[1]+origin[0]); - double y0=(spc[1])*((double)ext[2]+origin[1]); - double y1=(spc[1])*((double)ext[3]+origin[1]); - double z0=(spc[2])*((double)ext[4]+origin[2]); - double z1=(spc[2])*((double)ext[5]+origin[2]);*/ - - double x0=(spc[0])*((double)ext[0]); - double x1=(spc[0])*((double)ext[1]); - double y0=(spc[1])*((double)ext[2]); - double y1=(spc[1])*((double)ext[3]); - double z0=(spc[2])*((double)ext[4]); - double z1=(spc[2])*((double)ext[5]); - - _wxvtk3Dbaseview->GetRenderer()->ResetCamera(x0,x1,y0,y1,z0,z1); - //_wxvtk3Dbaseview->GetCamera()->SetPosition(x,y,z); - _wxvtk3Dbaseview->GetCamera()->Dolly(1.5); - } -} + //------------------------------------------------------------------- void wxVtkMPR3DView::Configure() @@ -323,7 +285,7 @@ void wxVtkMPR3DView::Configure() // An initial camera view is created. The Dolly() method moves // the camera towards the FocalPoint, thereby enlarging the image. - _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera()); +// _wxvtk3Dbaseview->GetRenderer()->SetActiveCamera(_wxvtk3Dbaseview->GetCamera()); // Note that when camera movement occurs (as it does in the Dolly() // method), the clipping planes often need adjusting. Clipping planes @@ -331,10 +293,13 @@ void wxVtkMPR3DView::Configure() // near plane clips out objects in front of the plane; the far plane // clips out objects behind the plane. This way only what is drawn // between the planes is actually rendered. - _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); - this->ResetCamera(); +//EED 27/05/2013 +// _wxvtk3Dbaseview->GetRenderer()->ResetCameraClippingRange(); +//EED 27/05/2013 +// this->ResetCamera(); + _wxvtk3Dbaseview->ResetCamera(); // Set a background color for the renderer and set the size of the // render window (expressed in pixels). diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h index 0449b26..44cced6 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h @@ -67,7 +67,9 @@ public: void TestLoic2(); void RemoveActor(vtkActor* actor); - void ResetCamera(int *ext=NULL, double* origin=NULL,double* spc=NULL); + +//EED 27/05/2013 +// void ResetCamera(int *ext=NULL,double* spc=NULL); void setColorTransferFunction(vtkColorTransferFunction* colortable);