Salome HOME
Updated copyright comment
[modules/geom.git] / src / BasicGUI / BasicGUI.cxx
index 54e4116cb4a366d3de49bfd374d5aea0450870b4..52fff9c6dc1e1a1f60287c0688a17e234a1adc9b 100644 (file)
@@ -1,66 +1,69 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+// Copyright (C) 2007-2024  CEA, EDF, OPEN CASCADE
 //
-//  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
-// 
-//  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. 
-// 
-//  This library is distributed in the hope that it will be useful, 
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of 
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
-//  Lesser General Public License for more details. 
-// 
-//  You should have received a copy of the GNU Lesser General Public 
-//  License along with this library; if not, write to the Free Software 
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
-// 
-//  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
+// 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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
-//  File   : BasicGUI.cxx
-//  Author : Damien COQUERET
-//  Module : GEOM
-//  $Header: 
 
-using namespace std;
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : BasicGUI.cxx
+// Author : Damien COQUERET, Open CASCADE S.A.S.
+//
 #include "BasicGUI.h"
 
-#include "QAD_RightFrame.h"
-#include "OCCViewer_Viewer3d.h"
-#include "OCCViewer_ViewPort3d.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-
-#include <Precision.hxx>
-#include <BRep_Tool.hxx>
-#include <ProjLib.hxx>
-#include <ElSLib.hxx>
-
 #include "BasicGUI_PointDlg.h"        // Method POINT
 #include "BasicGUI_LineDlg.h"         // Method LINE
 #include "BasicGUI_CircleDlg.h"       // Method CIRCLE
 #include "BasicGUI_EllipseDlg.h"      // Method ELLIPSE
 #include "BasicGUI_ArcDlg.h"          // Method ARC
+#include "BasicGUI_CurveDlg.h"        // Method CURVE
 #include "BasicGUI_VectorDlg.h"       // Method VECTOR
 #include "BasicGUI_PlaneDlg.h"        // Method PLANE
-#include "BasicGUI_WorkingPlaneDlg.h" // Method WORKING PLANE
+#include "BasicGUI_MarkerDlg.h"       // Method LOCAL COORDINATE SYSTEM
+
+#include "GeometryGUI.h"
+#include "GeometryGUI_Operations.h"
+#include "GEOMUtils.hxx"
+
+#include <SUIT_Session.h>
+#include <SUIT_Desktop.h>
+#include <SUIT_ViewWindow.h>
+#include <OCCViewer_ViewWindow.h>
+#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewPort3d.h>
+
+#include <BRep_Tool.hxx>
+#include <ProjLib.hxx>
+#include <ElSLib.hxx>
+#include <TopoDS.hxx>
+
+#include <QMouseEvent>
 
 //=======================================================================
 // function : BasicGUI()
 // purpose  : Constructor
 //=======================================================================
-BasicGUI::BasicGUI() :
-  QObject()
+BasicGUI::BasicGUI( GeometryGUI* parent )
+  : GEOMGUI( parent )
 {
-  myGeomBase = new GEOMBase();
-  myGeomGUI = GEOMContext::GetGeomGUI();
-  myGeom = myGeomGUI->myComponentGeom;
 }
 
-
 //=======================================================================
 // function : ~BasicGUI()
 // purpose  : Destructor
@@ -74,65 +77,47 @@ BasicGUI::~BasicGUI()
 // function : OnGUIEvent()
 // purpose  : 
 //=======================================================================
-bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+bool BasicGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
 {
-  BasicGUI* myBasicGUI = new BasicGUI();
-  myBasicGUI->myGeomGUI->EmitSignalDeactivateDialog();
-  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-
-  switch (theCommandID)
-    {
-    case 4011: // POINT
-      {
-       Handle(AIS_InteractiveContext) ic;
-       if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-         OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-         ic = v3d->getAISContext();
-       }
-       BasicGUI_PointDlg *aDlg = new BasicGUI_PointDlg(parent, "", myBasicGUI, Sel, ic); 
-       break;
-      }
-    case 4012:  // LINE
-      {
-       BasicGUI_LineDlg *aDlg = new BasicGUI_LineDlg(parent, "", myBasicGUI, Sel);
-       break;
-      }
-    case 4013:  // CIRCLE
-      {
-       BasicGUI_CircleDlg *aDlg = new BasicGUI_CircleDlg(parent, "", myBasicGUI, Sel);
-       break;
-      }
-    case 4014:  // ELLIPSE
-      {
-       BasicGUI_EllipseDlg *aDlg = new BasicGUI_EllipseDlg(parent, "", myBasicGUI, Sel);
-       break;
-      }
-    case 4015:  // ARC
-      {
-       BasicGUI_ArcDlg *aDlg = new BasicGUI_ArcDlg(parent, "", myBasicGUI, Sel);
-       break ;
-      }
-    case 4016: // VECTOR
-      {        
-       BasicGUI_VectorDlg *aDlg = new BasicGUI_VectorDlg(parent, "", myBasicGUI, Sel);
-       break;
-      }
-    case 4017: // PLANE
-      {        
-       BasicGUI_PlaneDlg *aDlg = new BasicGUI_PlaneDlg(parent, "", myBasicGUI, Sel);
-       break;
-      }
-    case 4018: // WORKING PLANE
-      {        
-       BasicGUI_WorkingPlaneDlg *aDlg = new BasicGUI_WorkingPlaneDlg(parent, "", myBasicGUI, Sel);
-       break;
-      }
-    default:
-      {
-       parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
-       break;
-      }
-    }
+  getGeometryGUI()->EmitSignalDeactivateDialog();
+  QDialog* aDlg = NULL;
+
+  switch ( theCommandID ) {
+  case GEOMOp::OpPoint:    // POINT
+    aDlg = new BasicGUI_PointDlg( getGeometryGUI(), parent ); 
+    break;
+  case GEOMOp::OpLine:     // LINE
+    aDlg = new BasicGUI_LineDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpCircle:   // CIRCLE
+    aDlg = new BasicGUI_CircleDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpEllipse:  // ELLIPSE
+    aDlg = new BasicGUI_EllipseDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpArc:      // ARC
+    aDlg = new BasicGUI_ArcDlg( getGeometryGUI(), parent );
+    break ;
+  case GEOMOp::OpVector:   // VECTOR
+    aDlg = new BasicGUI_VectorDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpPlane:    // PLANE
+    aDlg = new BasicGUI_PlaneDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpCurve:    // CURVE
+    aDlg = new BasicGUI_CurveDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpLCS:      // LOCAL COORDINATE SYSTEM
+    aDlg = new BasicGUI_MarkerDlg( getGeometryGUI(), parent );
+    break;      
+  default:
+    SUIT_Session::session()->activeApplication()->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
+    break;
+  }
+  
+  if ( aDlg != NULL )
+    aDlg->show();
+  
   return true;
 }
 
@@ -141,294 +126,43 @@ bool BasicGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
 // function : 0nMousePress()
 // purpose  : [static] manage mouse events
 //=================================================================================
-bool BasicGUI::OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-{
-  BasicGUI* myBasicGUI = new BasicGUI();
-
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
-    return false;
-
-  OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-  Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-  OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)studyFrame->getRightFrame()->getViewFrame())->getViewPort();
-  
-  /* Get the clicked or selected point */
-  gp_Pnt thePoint;
-
-  myBasicGUI->myGeomBase->EraseSimulationShape();
-  BasicGUI_PointDlg *DialogPt = (BasicGUI_PointDlg*)(myBasicGUI->myGeomGUI->GetActiveDialogBox());
-
-  if(DialogPt->UseLocalContext()) {
-    ic->InitSelected();
-    if(pe->state() == Qt::ShiftButton)
-      v3d->getAISSelector()->shiftSelect();  /* Append selection */
-    else
-      v3d->getAISSelector()->select();       /* New selection    */
-      
-    ic->InitSelected();
-    if(ic->MoreSelected())
-      thePoint = BRep_Tool::Pnt(TopoDS::Vertex(ic->SelectedShape()));
-    else
-      thePoint = myBasicGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
-  } 
-  else
-    thePoint = myBasicGUI->ConvertClickToPoint(pe->x(), pe->y(), ((OCCViewer_ViewPort3d*)vp)->getView());
-
-  if(DialogPt != 0)
-    DialogPt->PointIntoCoordinates(thePoint, true);  /* display point */
-  else
-    QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
-
-  return false;
-}
-
-
-//=======================================================================
-// function : ConvertClickToPoint()
-// purpose  : Returns the point clicked in 3D view
-//=======================================================================
-gp_Pnt BasicGUI::ConvertClickToPoint(Standard_Real x, Standard_Real 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;
-}
-
-
-//=======================================================================
-// function : MakePointAndDisplay
-// purpose  : 
-//=======================================================================
-void BasicGUI::MakePointAndDisplay(const double x, const double y, const double z) 
-{
-  try {
-    GEOM::GEOM_Shape_var P = myGeom->MakeVertex(x, y, z);
-    P->NameType(tr("GEOM_VERTEX"));
-    if (myGeomBase->Display(P))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  return;
-}
-
-
-//=====================================================================================
-// function : MakeLineAndDisplay()
-// purpose  : Create an infinite oriented line (linear edge in fact) 
-//=====================================================================================
-void BasicGUI::MakeLineAndDisplay(const gp_Pnt InitPoint, const gp_Pnt LastPoint)
-{
-  gp_Pnt P1, P2;  
-  double dx, dy, dz;
-  myGeomBase->GetBipointDxDyDz(InitPoint, LastPoint, dx, dy, dz);
-  Standard_Real length = InitPoint.Distance(LastPoint);
-  if(length <= Precision::Confusion()) {
-    QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
-    return;
-  }
-  
-  Standard_Real coeff = 1E6 / length;
-  
-  /* To create a line with length = 1E6            */
-  /* Precision::Infinite() is 1E100 in OCC  */
-  P1.SetX(InitPoint.X() - (coeff * dx));
-  P1.SetY(InitPoint.Y() - (coeff * dy));
-  P1.SetZ(InitPoint.Z() - (coeff * dz));
-  
-  P2.SetX(LastPoint.X() + (coeff * dx));
-  P2.SetY(LastPoint.Y() + (coeff * dy));
-  P2.SetZ(LastPoint.Z() + (coeff * dz));
-  
-  try {
-    GEOM::PointStruct pstruct = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z());
-    GEOM::PointStruct d = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z());
-    GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
-    
-    GEOM::GEOM_Shape_ptr result = myGeom->MakeLine(pstruct, dstruct);
-    if(result->_is_nil()) {
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
-      return;
-    }
-    result->NameType(tr("GEOM_LINE"));
-    
-    if(myGeomBase->Display(result))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_READY"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  return;
-}
-
-
-//=====================================================================================
-// function : MakeCircleAndDisplay()
-// purpose  :
-//=====================================================================================
-void BasicGUI::MakeCircleAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir, const Standard_Real Radius)
-{
-  try {
-    GEOM::PointStruct pstruct = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z());
-    GEOM::PointStruct d = myGeom->MakePointStruct(dir.X(), dir.Y(), dir.Z());
-    GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
-    
-    GEOM::GEOM_Shape_var result = myGeom->MakeCircle(pstruct, dstruct, Radius);
-    if(result->_is_nil()) {
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
-      return;
-    }
-    result->NameType(tr("GEOM_CIRCLE"));
-    if(myGeomBase->Display(result))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  return;
-}
-
-
-//=====================================================================================
-// function : MakeEllipseAndDisplay()
-// purpose  :
-//=====================================================================================
-void BasicGUI::MakeEllipseAndDisplay(const gp_Pnt CenterPoint, const gp_Dir dir,
-                                    const Standard_Real Major_Radius, const Standard_Real Minor_Radius)
-{
-  try {
-    GEOM::PointStruct pstruct = myGeom->MakePointStruct(CenterPoint.X(), CenterPoint.Y(), CenterPoint.Z());
-    GEOM::PointStruct d = myGeom->MakePointStruct(dir.X(), dir.Y(), dir.Z());
-    GEOM::DirStruct dstruct = myGeom->MakeDirection(d) ;
-
-    GEOM::GEOM_Shape_var result = myGeom->MakeEllipse(pstruct, dstruct, Major_Radius, Minor_Radius);
-    if(result->_is_nil()) {
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
-      return;
-    }
-    result->NameType(tr("GEOM_ELLIPSE"));
-    if(myGeomBase->Display(result))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  return;
-}
-
-
-//=======================================================================================
-// function : MakeArcAndDisplay()
-// purpose  : Make an arc of circle from InitPoint to CirclePoint and passing on EndPoint
-//=======================================================================================
-void BasicGUI::MakeArcAndDisplay(gp_Pnt InitPoint, gp_Pnt CirclePoint, gp_Pnt EndPoint)
+bool BasicGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* theViewWindow )
 {
-  gp_Vec v1(CirclePoint, InitPoint);
-  gp_Vec v2(CirclePoint, EndPoint);
-  if(v1.IsParallel(v2, Precision::Angular()))
-    return;
-
-  try { 
-    GEOM::PointStruct pI = myGeom->MakePointStruct(InitPoint.X(), InitPoint.Y(), InitPoint.Z());
-    GEOM::PointStruct pC = myGeom->MakePointStruct(CirclePoint.X(), CirclePoint.Y(), CirclePoint.Z());
-    GEOM::PointStruct pE = myGeom->MakePointStruct(EndPoint.X(), EndPoint.Y(), EndPoint.Z());
-    GEOM::GEOM_Shape_var result = myGeom->MakeArc(pI, pC, pE);
-    if(result->_is_nil()) {
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_ABORT"));
-      return;
-    }
-    result->NameType(tr("GEOM_ARC"));
-    if (myGeomBase->Display(result))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }    
-  return;
-}
-
-
-//=======================================================================
-// function : MakeVectorAndDisplay()
-// purpose  : 
-//=======================================================================
-void BasicGUI::MakeVectorAndDisplay(const gp_Pnt P1, const gp_Pnt P2)
-{
-  try {
-    GEOM::PointStruct pstruct1 = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z());
-    GEOM::PointStruct pstruct2 = myGeom->MakePointStruct(P2.X(), P2.Y(), P2.Z());
-    GEOM::GEOM_Shape_var Vector = myGeom->MakeVector(pstruct1, pstruct2);
-    Vector->NameType(tr("GEOM_VECTOR"));
-    if(myGeomBase->Display(Vector))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  return;
-}
-
-
-//=======================================================================
-// function : MakePlaneAndDisplay()
-// purpose  : Plane point is P1 and dx, dy, dz define a normal vector
-//=======================================================================
-void BasicGUI::MakePlaneAndDisplay(const gp_Pnt P1, const Standard_Real dx, const Standard_Real dy,
-                                  const Standard_Real dz, const Standard_Real TrimSize)
-{
-  try {
-    gp_Dir aDirection;
-    aDirection.SetCoord(dx, dy, dz);
-    gp_Ax2 Axis(P1, aDirection);
-    
-    GEOM::PointStruct pstruct = myGeom->MakePointStruct(P1.X(), P1.Y(), P1.Z());
-    GEOM::PointStruct d = myGeom->MakePointStruct(aDirection.X(), aDirection.Y(), aDirection.Z());
-    GEOM::DirStruct dstruct = myGeom->MakeDirection(d);
-    GEOM::GEOM_Shape_ptr plane = myGeom->MakePlane(pstruct, dstruct, TrimSize);
-    plane->NameType(tr("GEOM_PLANE"));
-    if(myGeomBase->Display(plane))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  return;
-}
-
+  QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
+
+  // Create Point dialog, OCC viewer 
+  if ( aDlg && ( QString( aDlg->metaObject()->className() ).compare( "BasicGUI_PointDlg" ) == 0 ) &&
+       theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&
+       pe->modifiers() != Qt::ControlModifier ) {
+    BasicGUI_PointDlg* aPntDlg = (BasicGUI_PointDlg*) aDlg;
+    if ( aPntDlg->acceptMouseEvent() ) {
+      OCCViewer_Viewer* anOCCViewer =
+        ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer();
+      Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();
+
+      gp_Pnt aPnt;    
+
+      ic->InitSelected();
+      if ( pe->modifiers() == Qt::ShiftModifier )
+        ic->ShiftSelect( Standard_True );  // Append selection
+      else
+        ic->Select( Standard_True );       // New selection
+
+      ic->InitSelected();
+      if ( ic->MoreSelected() ) {
+        TopoDS_Shape aShape = ic->SelectedShape();
+        if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX )
+          aPnt = BRep_Tool::Pnt( TopoDS::Vertex( ic->SelectedShape() ) );
+      }
+      else {
+        OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
+        aPnt = GEOMUtils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
+      }
 
-//=======================================================================
-// function : MakeWorkingPlane()
-// purpose  : Change the point of view3d
-//=======================================================================
-void BasicGUI::MakeWorkingPlane(const gp_Pnt P, const gp_Dir D)
-{
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() != VIEW_OCC) {
-    QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NOT_FOR_VTK_VIEWER"));
-    return;
+      aPntDlg->OnPointSelected( aPnt );  // "feed" the point to point construction dialog
+    } // acceptMouseEvent()
   }
-
-  OCCViewer_ViewPort* vp = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewPort();
-  Handle(V3d_View) view3d = ((OCCViewer_ViewPort3d*)vp)->getView();
-  view3d->SetAt(P.X(), P.Y(), P.Z());
-  view3d->SetProj(D.X(), D.Y(), D.Z());
-  QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
-  return;
+  return false;
 }
 
 
@@ -437,9 +171,11 @@ void BasicGUI::MakeWorkingPlane(const gp_Pnt P, const gp_Dir D)
 //=====================================================================================
 extern "C"
 {
-  bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-  {return BasicGUI::OnGUIEvent(theCommandID, parent);}
-
-  bool OnMousePress(QMouseEvent* pe, QAD_Desktop* parent, QAD_StudyFrame* studyFrame)
-  {return BasicGUI::OnMousePress(pe, parent, studyFrame);}
+#ifdef WIN32
+  __declspec( dllexport )
+#endif
+  GEOMGUI* GetLibGUI( GeometryGUI* parent )
+  {
+    return new BasicGUI( parent );
+  }
 }