]> Creatis software - creaMaracasVisu.git/commitdiff
2022 Feature Cleanning Viewer type camera in viewer 3D
authorEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 5 Jun 2013 14:45:12 +0000 (16:45 +0200)
committerEduardo DAVILA <eduardo.davila@creatis.insa-lyon.fr>
Wed, 5 Jun 2013 14:45:12 +0000 (16:45 +0200)
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxMaracasRenderTabbedPanel.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtk3DBaseView.h
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkClipping3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkMPR3DView.h

index b26adf9b6e07335fb27949e626a42a545add2297..69538a803325c1ed55e479c7fcbc3ad52d1bedb6 100644 (file)
@@ -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);
        }
index 699750d2b6fcf01a33da8f9fa6c73e45662b0e14..9d92c225526295afd8d36d392e09c339d3e1f7df 100644 (file)
@@ -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);
+
+
        }
 }
 //-------------------------------------------------------------------
index 7406907d1d8340e3b519628ee3cb123a1de13cc7..8a32d1f8ade5bc72e05de795cb82d3996ad920f7 100644 (file)
@@ -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;
index 91cfbc2f4a597d2223b430923fceced09fe6b766..a53f035ec2421be2185950c90eba8b1759fb709a 100644 (file)
@@ -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
index f97208ad6349cf9f34c76ce52d8602453ed6e516..6bdef1c10575013b16d158e0aee15f168e9ccc89 100644 (file)
@@ -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).
index 0449b26887457d31d24082cdd1cd006106acae21..44cced6445214d0c5494c361569fee4a33fde1c0 100644 (file)
@@ -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);