Salome HOME
Merge from BR_hydro 30/10/2013
[modules/geom.git] / src / BasicGUI / BasicGUI.cxx
index e40b013bfea4085c84181a48d9309b36b8f6b91c..a3ee3bf089030d9b5051f0c83beca56850f5fcbe 100644 (file)
@@ -36,8 +36,9 @@
 #include "BasicGUI_PlaneDlg.h"        // Method PLANE
 #include "BasicGUI_MarkerDlg.h"       // Method LOCAL COORDINATE SYSTEM
 
-#include <GeometryGUI.h>
+#include "GeometryGUI.h"
 #include "GeometryGUI_Operations.h"
+#include "GEOMUtils.hxx"
 
 #include <SUIT_Session.h>
 #include <SUIT_Desktop.h>
@@ -155,7 +156,7 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin
       }
       else {
         OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
-        aPnt = ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
+        aPnt = GEOMUtils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
       }
 
       aPntDlg->OnPointSelected( aPnt );  // "feed" the point to point construction dialog
@@ -165,32 +166,6 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin
 }
 
 
-//=======================================================================
-// function : ConvertClickToPoint()
-// purpose  : Returns the point clicked in 3D view
-//=======================================================================
-gp_Pnt BasicGUI::ConvertClickToPoint( int x, int y, Handle(V3d_View) aView )
-{
-  V3d_Coordinate XEye, YEye, ZEye, XAt, YAt, ZAt;
-  aView->Eye( XEye, YEye, ZEye );
-
-  aView->At( XAt, YAt, ZAt );
-  gp_Pnt EyePoint( XEye, YEye, ZEye );
-  gp_Pnt AtPoint( XAt, YAt, ZAt );
-
-  gp_Vec EyeVector( EyePoint, AtPoint );
-  gp_Dir EyeDir( EyeVector );
-
-  gp_Pln PlaneOfTheView = gp_Pln( AtPoint, EyeDir );
-  Standard_Real X, Y, Z;
-  aView->Convert( x, y, X, Y, Z );
-  gp_Pnt ConvertedPoint( X, Y, Z );
-
-  gp_Pnt2d ConvertedPointOnPlane = ProjLib::Project( PlaneOfTheView, ConvertedPoint );
-  gp_Pnt ResultPoint = ElSLib::Value( ConvertedPointOnPlane.X(), ConvertedPointOnPlane.Y(), PlaneOfTheView );
-  return ResultPoint;
-}
-
 //=====================================================================================
 // EXPORTED METHODS
 //=====================================================================================