Salome HOME
Updated copyright comment
[modules/geom.git] / src / BasicGUI / BasicGUI.cxx
index 10ae19e27860fe25a0e8d32650a919d2194e7dc8..52fff9c6dc1e1a1f60287c0688a17e234a1adc9b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -6,7 +6,7 @@
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -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>
@@ -125,7 +126,7 @@ bool BasicGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
 // function : 0nMousePress()
 // purpose  : [static] manage mouse events
 //=================================================================================
-bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWindow* theViewWindow )
+bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* theViewWindow )
 {
   QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
 
@@ -143,9 +144,9 @@ bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* parent, SUIT_ViewWin
 
       ic->InitSelected();
       if ( pe->modifiers() == Qt::ShiftModifier )
-        ic->ShiftSelect();  // Append selection
+        ic->ShiftSelect( Standard_True );  // Append selection
       else
-        ic->Select();       // New selection
+        ic->Select( Standard_True );       // New selection
 
       ic->InitSelected();
       if ( ic->MoreSelected() ) {
@@ -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
 //=====================================================================================