From 31f62e211fad94014168485d32c5e3ca936da953 Mon Sep 17 00:00:00 2001 From: Ricardo Corredor Date: Fri, 26 Mar 2010 15:45:00 +0000 Subject: [PATCH] Changing method to transform coordinates --- .../manualContourBaseControler.cpp | 3 +++ .../wxWindows/widgets/wxVtkBaseView.cxx | 24 ++++++++++++++++--- .../wxWindows/widgets/wxVtkBaseView.h | 4 ++++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp index 0639b0c..d5925e7 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/manualContour/manualContourBaseControler.cpp @@ -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); diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx index 128a844..c2be591 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.cxx @@ -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 diff --git a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h index eb5dd66..50d62ac 100644 --- a/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h +++ b/lib/maracasVisuLib/src/interface/wxWindows/widgets/wxVtkBaseView.h @@ -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); */ -- 2.45.2