]> Creatis software - creaMaracasVisu.git/commitdiff
Changing method to transform coordinates
authorRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Fri, 26 Mar 2010 15:45:00 +0000 (15:45 +0000)
committerRicardo Corredor <Ricardo.Corredor@creatis.insa-lyon.fr>
Fri, 26 Mar 2010 15:45:00 +0000 (15:45 +0000)
lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx
lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h

index 0639b0c611e012aecb665b68f660aeae0fcafe3a..d5925e7b2359f85c17ed17b93425f73987d0d8fd 100644 (file)
@@ -456,6 +456,8 @@ void manualContourBaseControler::AddPoint(int x, int y, int z) // virtual
                double  xx      = x;
                double  yy      = y;
                double  zz      = z;
+               
+
                GetManualViewBaseContour()->TransfromCoordViewWorld(xx,yy,zz);
                /*int   id              =*/  GetManualContourModel()->AddPoint(xx,yy,zz);  // JPRx
                GetManualViewBaseContour()->AddPoint();
@@ -491,6 +493,7 @@ void manualContourBaseControler::SetPoint( int id ,int x , int y , int z){ // vi
                double xx = x;
                double yy = y;
                double zz = z;
+
                GetManualViewBaseContour()->TransfromCoordViewWorld(xx,yy,zz);
                manualPoint             *mp             = _manContModel->GetManualPoint(id);
                mp->SetPoint(xx,yy,zz);
index 128a8446e16a65f50e84c0647f0e54233ba1ff8a..c2be59111ba4abc2bda1004f1806f2f3f53aae4f 100644 (file)
@@ -90,9 +90,9 @@ vtkRenderWindow* wxVtkBaseView::GetRenWin()           // virtual
 }
 
 //----------------------------------------------------------------------------
-                                       
-void wxVtkBaseView::TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection, int type) //virtual //keepNormalDirection=false, type=2
-{  
+
+void wxVtkBaseView::TransCoordScreenToWorld(double &X, double &Y, double &Z)
+{
        GetRenderer()->SetDisplayPoint((int)X, (int)Y, (int)Z);
        GetRenderer()->DisplayToWorld();
        double fP[4];
@@ -103,10 +103,28 @@ void wxVtkBaseView::TransFromCoordScreenToWorld(double &X, double &Y, double &Z,
                fP[2] /= fP[3];
        }
 
+       X = fP[0];
+       Y = fP[1];
+       Z = fP[2];
+}
+//----------------------------------------------------------------------------
+                                       
+void wxVtkBaseView::TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection, int type) //virtual //keepNormalDirection=false, type=2
+{  
+
+       //RaC 03-2010
+       TransCoordScreenToWorld(X,Y,Z);
+
 // EEDx5
        //JCP 13/05/2009
        vtkInteractorStyleBaseView* interactorstyle = (vtkInteractorStyleBaseView*)this->GetInteractorStyleBaseView();
        wxVtk2DBaseView* baseview = (wxVtk2DBaseView*)interactorstyle->GetWxVtk2DBaseView();
+
+       double fP[3];
+       fP[0] = X;
+       fP[1] = Y;
+       fP[2] = Z;
+
        baseview->TransformCoordinate_spacing_ViewToModel( fP[0] , fP[1] , fP[2] );
        //JCP 13/05/2009
 
index eb5dd6609e67dfd32d9a768fb7fc0d236d765324..50d62acf84e3fec103627202606c7d7b6998d587 100644 (file)
@@ -53,6 +53,10 @@ public:
        virtual vtkRenderer*                    GetRenderer();
        virtual vtkRenderWindow*                GetRenWin();
        virtual void                                    TransFromCoordScreenToWorld(double &X, double &Y, double &Z, bool keepNormalDirection=false,int type=2);
+
+       //RaC 03-2010 Method used by TransFromCoordScreenToWorld
+       void                                                    TransCoordScreenToWorld(double &X, double &Y, double &Z);
+
        /* JCP 04/05/09
        void                                                    SetInteractorStyleBaseView( vtkInteractorStyleBaseView* interactorStyle);
        */