Salome HOME
[bos #32517][EDF] Dynamic log messages switched on and off by SALOME_VERBOSE environm...
[modules/geom.git] / src / EntityGUI / EntityGUI.cxx
index 049b4fe00c5bc9305afa60815282996d62bdbe6b..b47285b72a5f96d04fdc9ec6322fed5ae79cbe88 100644 (file)
@@ -1,69 +1,81 @@
-//  GEOM GEOMGUI : GUI for Geometry component
+// Copyright (C) 2007-2022  CEA/DEN, EDF R&D, 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   : EntityGUI.cxx
-//  Author : Damien COQUERET
-//  Module : GEOM
-//  $Header: 
 
+// GEOM GEOMGUI : GUI for Geometry component
+// File   : EntityGUI.cxx
+// Author : Damien COQUERET, Open CASCADE S.A.S.
+//
 #include "EntityGUI.h"
 
-#include "QAD_RightFrame.h"
-#include "OCCViewer_Viewer3d.h"
-#include "VTKViewer_ViewFrame.h"
-#include "GEOM_AssemblyBuilder.h"
-#include "SALOMEGUI_ImportOperation.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
+#include "GeometryGUI.h"
+#include "GeometryGUI_Operations.h"
+#include "GEOMUtils.hxx"
+
+#include <LightApp_SelectionMgr.h>
+#include <OCCViewer_ViewManager.h>
+#include <OCCViewer_ViewModel.h>
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_ViewWindow.h>
+#include <SALOME_ListIO.hxx>
+#include <SUIT_Desktop.h>
+#include <SUIT_MessageBox.h>
+#include <SUIT_Session.h>
+#include <SUIT_ViewWindow.h>
+#include <SalomeApp_Application.h>
+#include <SalomeApp_Study.h>
+#include "utilities.h"
 
-#include <TopoDS_Compound.hxx>
-#include <BRep_Builder.hxx>
-#include <TopExp_Explorer.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <BRep_Tool.hxx>
+#include <ProjLib.hxx>
+#include <ElSLib.hxx>
 
-#include "DisplayGUI.h"
+#include <QMouseEvent>
+#include <QApplication>
 
-#include "EntityGUI_SketcherDlg.h" // Sketcher
-#include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
+#include "EntityGUI_SketcherDlg.h"        // Sketcher
+#include "EntityGUI_3DSketcherDlg.h"      // Sketcher
+#include "EntityGUI_IsolineDlg.h"         // Isoline
+#include "EntityGUI_SurfFromFaceDlg.h"    // Surface From Face
+#include "EntityGUI_SubShapeDlg.h"        // Method SUBSHAPE
+#include "EntityGUI_FeatureDetectorDlg.h" // Feature Detection
+#include "EntityGUI_PictureImportDlg.h"   // Import Picture in viewer
+#include "EntityGUI_FieldDlg.h"           // Create/Edit Field
+#include "EntityGUI_PolylineDlg.h"        // Create/Edit 2d polyline
 
-#include "utilities.h"
+#include "GEOMImpl_Types.hxx"
 
-using namespace std;
 
 //=======================================================================
 // function : EntityGUI()
 // purpose  : Constructor
 //=======================================================================
-EntityGUI::EntityGUI() :
-  QObject()
+EntityGUI::EntityGUI( GeometryGUI* parent ) :  GEOMGUI( parent )
 {
-  myGeomBase = new GEOMBase();
-  myGeomGUI = GEOMContext::GetGeomGUI();
-  myGeom = myGeomGUI->myComponentGeom;
-
-  mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
-  mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
+  mySimulationShape1 = new AIS_Shape( TopoDS_Shape() );
+  mySimulationShape2 = new AIS_Shape( TopoDS_Shape() );
 }
 
-
 //=======================================================================
 // function : ~EntityGUI()
 // purpose  : Destructor
@@ -77,158 +89,374 @@ EntityGUI::~EntityGUI()
 // function : OnGUIEvent()
 // purpose  : 
 //=======================================================================
-bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
+bool EntityGUI::OnGUIEvent( int theCommandID, SUIT_Desktop* parent )
 {
-  EntityGUI* myEntityGUI = new EntityGUI();
-  myEntityGUI->myGeomGUI->EmitSignalDeactivateDialog();
-  SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
-
-  switch (theCommandID)
-    {
-    case 404: // SKETCHER
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return false;
+
+  getGeometryGUI()->EmitSignalDeactivateDialog();
+  QDialog* aDlg = NULL;
+
+  switch ( theCommandID ) {
+  case GEOMOp::Op2dSketcher: // 2D SKETCHER
+    getGeometryGUI()->ActiveWorkingPlane();
+    aDlg = new EntityGUI_SketcherDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::Op3dSketcher: // 3D SKETCHER
+    aDlg = new EntityGUI_3DSketcherDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpIsoline:    // ISOLINE
+    aDlg = new EntityGUI_IsolineDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpSurfaceFromFace:    // SURFACE FROM FACE
+    aDlg = new EntityGUI_SurfFromFaceDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpExplode:    // EXPLODE
+    aDlg = new EntityGUI_SubShapeDlg( getGeometryGUI(), parent );
+    break;
+#ifdef WITH_OPENCV
+  case GEOMOp::OpFeatureDetect:    // FEATURE DETECTION
+    aDlg = new EntityGUI_FeatureDetectorDlg( getGeometryGUI(), parent );
+    break;
+#endif
+  case GEOMOp::OpPictureImport:    // IMPORT PICTURE IN VIEWER
+    aDlg = new EntityGUI_PictureImportDlg( getGeometryGUI(), parent );
+    break;
+  case GEOMOp::OpCreateField: // CREATE FIELD
+    aDlg = new EntityGUI_FieldDlg (getGeometryGUI(), GEOM::GEOM_Field::_nil(), 0,
+                                   parent);
+    break;
+  case GEOMOp::OpEditField: // EDIT FIELD
+  case GEOMOp::OpEditFieldPopup:
+  {
+    SALOME_ListIO aList;
+    aList.Clear();
+
+    LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+    if (aSelMgr)
+      aSelMgr->selectedObjects(aList);
+    SALOME_ListIteratorOfListIO anIter (aList);
+
+    GEOM::GEOM_Field_var     field;
+    GEOM::GEOM_FieldStep_var step;
+
+    SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+    if ( study )
+      for ( ; anIter.More(); anIter.Next() )
       {
-       ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002
-       EntityGUI_SketcherDlg* aDlg = new EntityGUI_SketcherDlg(parent, "", myEntityGUI, Sel);
-       break;
+        Handle(SALOME_InteractiveObject) anIObj = anIter.Value();
+        if ( !anIObj.IsNull() && anIObj->hasEntry() )
+        {
+          _PTR(SObject) obj = study->studyDS()->FindObjectID( anIObj->getEntry() );
+          if ( GeometryGUI::IsInGeomComponent( obj ))
+          {
+            CORBA::Object_var   corbaObj = GeometryGUI::ClientSObjectToObject( obj );
+            GEOM::GEOM_BaseObject_var bo = GEOM::GEOM_BaseObject::_narrow( corbaObj );
+            GEOM::GEOM_Field_var     f;
+            GEOM::GEOM_FieldStep_var s;
+            switch ( bo->GetType() ) {
+            case GEOM_FIELD:
+              f = GEOM::GEOM_Field::_narrow( corbaObj ); break;
+            case GEOM_FIELD_STEP:
+              step = GEOM::GEOM_FieldStep::_narrow( corbaObj );
+              if ( !step->_is_nil() )
+                f = step->GetField();
+              break;
+            default:
+              continue;
+            }
+            if ( !f->_is_nil() )
+            {
+              if ( !field->_is_nil() && !f->_is_equivalent( field ))
+              {
+                field = GEOM::GEOM_Field::_nil(); // several field selected
+                break;
+              }
+              field = f;
+            }
+          }
+        }
       }
-    case 407: // EXPLODE : use ic
-      {
-       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();
-       }
-       EntityGUI_SubShapeDlg *aDlg = new EntityGUI_SubShapeDlg(parent, "", myEntityGUI, Sel, ic);
-       break ;
+    if ( !field->_is_nil()) {
+      int stepID;
+      if ( !step->_is_nil() ) {
+        stepID = step->GetID();
       }
-    default:
-      {
-       parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
-       break;
+      else {
+        GEOM::ListOfLong_var stepIDs = field->GetSteps();
+        if ( stepIDs->length() > 0 )
+          stepID = stepIDs[0];
+        else
+          stepID = 0;
       }
+      aDlg = new EntityGUI_FieldDlg (getGeometryGUI(), field, stepID, parent); 
+      break;
     }
+    SUIT_MessageBox::warning(parent, tr("WRN_WARNING"), tr("NO_FIELD"));
+    break;
+  }
+  case GEOMOp::Op2dPolylineEditor: // POLYLINE EDITOR
+    getGeometryGUI()->ActiveWorkingPlane();
+    aDlg = new EntityGUI_PolylineDlg( getGeometryGUI(), parent );
+    break;
+  default:
+    app->putInfo( tr( "GEOM_PRP_COMMAND" ).arg( theCommandID ) );
+    break;
+  }
+  if ( aDlg )
+    aDlg->show();
+
   return true;
 }
 
-
-//=======================================================================
-// function : OnSketchEnd()
-// purpose  : 
-//=======================================================================
-void EntityGUI::OnSketchEnd(const char *Cmd)
+//=================================================================================
+// function : 0nMousePress()
+// purpose  : [static] manage mouse events
+//=================================================================================
+bool EntityGUI::OnMousePress( QMouseEvent* pe, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* theViewWindow )
 {
-  try {
-    GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd);
-    if(result->_is_nil()) {
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_NULLSHAPE"));
-      return;
+  QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
+
+  // Create Point dialog, OCC viewer 
+  if ( aDlg && 
+       theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&
+       pe->modifiers() != Qt::ControlModifier ) {
+    
+    gp_Pnt aPnt;
+  
+    if ( QString( aDlg->metaObject()->className() ).compare( "EntityGUI_SketcherDlg" ) == 0 ) 
+    { 
+      EntityGUI_SketcherDlg* aSketcherDlg = (EntityGUI_SketcherDlg*) aDlg;
+      ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(true);
+      if ( aSketcherDlg->acceptMouseEvent() ) {
+        OCCViewer_Viewer* anOCCViewer =
+          ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer();
+        Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();
+    
+        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() );
+        }
+        
+        Qt::KeyboardModifiers modifiers = pe->modifiers();
+        aSketcherDlg->OnPointSelected( modifiers, aPnt );  // "feed" the point to point construction dialog
+      } // acceptMouseEvent()
     }
-    result->NameType(tr("GEOM_WIRE"));
-    if(myGeomBase->Display(result))
-      QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_DONE"));
+#ifdef WITH_OPENCV
+    if (  QString( aDlg->metaObject()->className() ).compare( "EntityGUI_FeatureDetectorDlg" ) == 0 ) 
+    {
+      EntityGUI_FeatureDetectorDlg* aCornerDlg = (EntityGUI_FeatureDetectorDlg*) aDlg;
+      if ( aCornerDlg->acceptMouseEvent() ) {
+        OCCViewer_Viewer* anOCCViewer =
+          ( (OCCViewer_ViewManager*)( theViewWindow->getViewManager() ) )->getOCCViewer();
+        Handle(AIS_InteractiveContext) ic = anOCCViewer->getAISContext();   
+
+        ic->InitSelected();
+        ic->Select( Standard_True );       // New selection
+
+        ic->InitSelected();
+        TopoDS_Shape aShape;
+        if ( ic->MoreSelected() ) 
+          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() );
+        }
+        
+//         aCornerDlg->OnPointSelected( aPnt );  // "feed" the point to corner detection dialog
+        
+//         QPoint start = QPoint(pe->x(),pe->y());
+        aCornerDlg->setStartPnt( aPnt );
+      } // acceptMouseEvent()
+      
+    }
+#endif
   }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
+
+  return false;
+}
+
+//=================================================================================
+// function : 0nMouseRelease()
+// purpose  : [static] manage mouse events
+//=================================================================================
+bool EntityGUI::OnMouseRelease( QMouseEvent* pe, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* theViewWindow )
+{
+  ((OCCViewer_ViewWindow*)theViewWindow)->setSketcherStyle(false);
+#ifdef WITH_OPENCV
+  QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
+  if ( aDlg && ( QString( aDlg->metaObject()->className() ).compare( "EntityGUI_FeatureDetectorDlg" ) == 0 ) &&
+       theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() &&
+       pe->modifiers() != Qt::ControlModifier ) 
+  {   
+    EntityGUI_FeatureDetectorDlg* aCornerDlg = (EntityGUI_FeatureDetectorDlg*) aDlg;
+   
+    gp_Pnt aPnt; 
+      
+    if ( aCornerDlg->acceptMouseEvent() )
+    {
+//       QPoint end = QPoint(pe->x(),pe->y());
+      OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
+      aPnt = GEOMUtils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
+      aCornerDlg->setEndPnt( aPnt );
+    }    
   }
-  return;
+#endif
+  return false;
 }
 
+//=================================================================================
+// function : 0nMouseMove()
+// purpose  : [static] manage mouse events
+//=================================================================================
+bool EntityGUI::OnMouseMove( QMouseEvent* pe, SUIT_Desktop* /*parent*/, SUIT_ViewWindow* theViewWindow )
+{
+  QDialog* aDlg = getGeometryGUI()->GetActiveDialogBox();
+  
+  if ( aDlg && QString( aDlg->metaObject()->className() ).compare( "EntityGUI_SketcherDlg" ) == 0 &&
+       theViewWindow->getViewManager()->getType() == OCCViewer_Viewer::Type() ) 
+  { 
+    EntityGUI_SketcherDlg* aSketcherDlg = (EntityGUI_SketcherDlg*) aDlg;
+    if ( aSketcherDlg->acceptMouseEvent() ) 
+    {    
+      OCCViewer_ViewPort3d* vp =  ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
+      gp_Pnt aPnt = GEOMUtils::ConvertClickToPoint( pe->x(), pe->y(), vp->getView() );
+  
+      Qt::KeyboardModifiers modifiers = pe->modifiers();
+      if (QApplication::mouseButtons() == Qt::LeftButton )
+        aSketcherDlg->OnPointSelected( modifiers, aPnt, false );  // "feed" the point to point construction dialog
+    }
+  }
+    
+  return false;
+}
 
 //=====================================================================================
 // function : DisplaySimulationShape() 
 // purpose  : Displays 'this->mySimulationShape' a pure graphical shape from a TopoDS_Shape
 //=====================================================================================
-void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shape& S2
+void EntityGUI::DisplaySimulationShape( const TopoDS_Shape& S1, const TopoDS_Shape& S2 
 {
-  //NRI DEBUG : 14/02/2002
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
+  MESSAGE("EntityGUI::DisplaySimulationShape");
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  SUIT_ViewManager* aVM = app->desktop()->activeWindow()->getViewManager();
+  if ( aVM->getType() != OCCViewer_Viewer::Type() )
     return;
-       
-  OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
+
+  OCCViewer_Viewer* v3d = ( (OCCViewer_ViewManager*)aVM )->getOCCViewer();
   Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
   try {
-    if(!S1.IsNull()) {
+    if ( !S1.IsNull() ) {
       /* erase any previous */
-      ic->Erase(mySimulationShape1, Standard_True, Standard_False);
-      ic->ClearPrs(mySimulationShape1);
-      
-      mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
-      mySimulationShape1->Set(S1);
-      mySimulationShape1->SetColor(Quantity_NOC_RED);
-    
-      ic->Deactivate(mySimulationShape1);
-      ic->Display(mySimulationShape1, Standard_False);
+      ic->Erase( mySimulationShape1, Standard_True );
+      ic->ClearPrs( mySimulationShape1, 0, Standard_True );
+
+      mySimulationShape1 = new AIS_Shape( TopoDS_Shape() );
+      mySimulationShape1->Set( S1 );
+      mySimulationShape1->SetColor( Quantity_NOC_RED );
+
+      ic->Deactivate( mySimulationShape1 );
+      ic->Display( mySimulationShape1, Standard_False );
       mySimulationShape1->UnsetColor();
     }
-    if(!S2.IsNull()) {
-      ic->Erase(mySimulationShape2, Standard_True, Standard_False);
-      ic->ClearPrs(mySimulationShape2);
+    if ( !S2.IsNull() ) {
+      ic->Erase( mySimulationShape2, Standard_True );
+      ic->ClearPrs( mySimulationShape2, 0, Standard_True );
 
-      mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
-      mySimulationShape2->Set(S2);
-      mySimulationShape2->SetColor(Quantity_NOC_VIOLET);
+      mySimulationShape2 = new AIS_Shape( TopoDS_Shape() );
+      mySimulationShape2->Set( S2 );
+      mySimulationShape2->SetColor( Quantity_NOC_VIOLET );
 
-      ic->Deactivate(mySimulationShape2);
-      ic->Display(mySimulationShape2, Standard_False);
+      ic->Deactivate( mySimulationShape2 );
+      ic->Display( mySimulationShape2, Standard_False );
       mySimulationShape2->UnsetColor();
     }
     ic->UpdateCurrentViewer();
   }
-  catch(Standard_Failure) {
-    MESSAGE("Exception catched in EntityGUI::DisplaySimulationShape ");
+  catch( Standard_Failure& ) {
+    MESSAGE( "Exception caught in EntityGUI::DisplaySimulationShape" );
   } 
-  return;
 }
 
-
 //==================================================================================
 // function : EraseSimulationShape()
 // purpose  : Clears the display of 'mySimulationShape' a pure graphical shape
 //==================================================================================
-void EntityGUI::EraseSimulationShape(int Sh)
+void EntityGUI::EraseSimulationShape()
 {
-  int count = QAD_Application::getDesktop()->getActiveStudy()->getStudyFramesCount();
-  for(int i = 0; i < count; i++) {
-    if(QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getTypeView() == VIEW_OCC) {
-      OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getStudyFrame(i)->getRightFrame()->getViewFrame())->getViewer();
+  MESSAGE("EntityGUI::EraseSimulationShape");
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return;
+
+  // get all view windows at the desktop
+  QList<SUIT_ViewWindow*> aWndLst = app->desktop()->windows();
+  //get all view windows, which belong to the active study
+  QList<SUIT_ViewWindow*> aWndLstAS;
+  SUIT_ViewWindow* vw;
+
+  QListIterator<SUIT_ViewWindow*> itWL( aWndLst );
+  while ( itWL.hasNext() && ( vw = itWL.next() ) )
+    if ( vw->getViewManager()->study() == app->activeStudy() )
+      aWndLstAS.append( vw );
+
+  QListIterator<SUIT_ViewWindow*> itWLAS( aWndLstAS );
+  while ( itWLAS.hasNext() && ( vw = itWLAS.next() ) ) {
+    if ( vw->getViewManager()->getType() == OCCViewer_Viewer::Type() ) {
+      OCCViewer_Viewer* v3d = ( (OCCViewer_ViewManager*)( vw->getViewManager() ) )->getOCCViewer();
       Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-      if(Sh < 1) {
-       ic->Erase(mySimulationShape1, Standard_True, Standard_False);
-       ic->ClearPrs(mySimulationShape1);
-      }
-      if(Sh <= 1) {
-       ic->Erase(mySimulationShape2, Standard_True, Standard_False);
-       ic->ClearPrs(mySimulationShape2);
-      }
+      ic->Erase( mySimulationShape1, Standard_True );
+      ic->Erase( mySimulationShape2, Standard_True );
+      ic->ClearPrs( mySimulationShape1, 0, Standard_True );
+      ic->ClearPrs( mySimulationShape2, 0, Standard_True );
       ic->UpdateCurrentViewer();
     } 
   }
 }
 
-
 //=====================================================================================
 // function : SObjectExist()
 // purpose  :
 //=====================================================================================
-bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char* IOR)
+bool EntityGUI::SObjectExist( const _PTR(SObject)& theFatherObject, const char* IOR )
 {
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  SALOMEDS::ChildIterator_var it = aStudy->NewChildIterator(theFatherObject);
-  SALOMEDS::SObject_var RefSO;
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributeIOR_var anIOR;
-  for(; it->More();it->Next()) {
-    SALOMEDS::SObject_var SO= it->Value();
-    if(SO->FindAttribute(anAttr, "AttributeIOR")) {
-      anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-      if(strcmp( anIOR->Value(), IOR ) == 0)
-       return true;
+  SalomeApp_Application* app = getGeometryGUI()->getApp();
+  if ( !app ) return false;
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  if ( !appStudy ) return false;
+
+  _PTR(Study) aStudy = appStudy->studyDS();
+  _PTR(ChildIterator) it ( aStudy->NewChildIterator( theFatherObject ) );
+  _PTR(SObject) RefSO;
+  _PTR(GenericAttribute) anAttr;
+  for ( ; it->More();it->Next() ) {
+    _PTR(SObject) SO ( it->Value() );
+    if ( SO->FindAttribute( anAttr, "AttributeIOR" ) ) {
+      _PTR(AttributeIOR) anIOR ( anAttr  );
+      if ( strcmp( anIOR->Value().c_str(), IOR ) == 0 )
+        return true;
     }
-    if(SO->ReferencedObject(RefSO)) {
-      if(RefSO->FindAttribute(anAttr, "AttributeIOR")) {
-        anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-       if(strcmp(anIOR->Value(), IOR) == 0)
-         return true;
+    if ( SO->ReferencedObject( RefSO ) ) {
+      if ( RefSO->FindAttribute( anAttr, "AttributeIOR" ) ) {
+        _PTR(AttributeIOR) anIOR ( anAttr );
+        if ( strcmp( anIOR->Value().c_str(), IOR ) == 0 )
+          return true;
       }
     }
   }
@@ -236,416 +464,16 @@ bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char*
 }
 
 
-//=====================================================================================
-// function : OnSubShapeGetAll()
-// purpose  : Explode a shape in all sub shapes with a SubShapeType
-//=====================================================================================
-bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType)
-{
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
-  if(theObj->_is_nil()) {
-    QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
-    return false;
-  }
-
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributeName_var aName;
-  SALOMEDS::AttributeIOR_var anIOR;
-  SALOMEDS::AttributePixMap_var aPixmap;
-
-  /* We create a sub object for each sub shape as attribute of the main object  */
-  /* Each sub object contains list (length=1) containing its index in the main shape */
-  GEOM::GEOM_Shape_var aShape = myGeom->GetIORFromString(ShapeTopoIOR);
-  GEOM::GEOM_Gen::ListOfGeomShapes_var listGeomShapes = new GEOM::GEOM_Gen::ListOfGeomShapes;
-  GEOM::GEOM_Shape_var aResult;
-  
-  try {
-    listGeomShapes = myGeom->SubShapeAll(aShape, SubShapeType);
-    if(listGeomShapes->length() < 1) {
-      QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT"));
-      return false;
-    }
-  }
-  catch(const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-  
-  /* open transaction */
-  QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
-  op->start();
-  
-  TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-  TopoDS_Shape mainShape;
-  bool main = false;
-  while(!main) {
-    if(aShape->IsMainShape()) {
-      mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-      main = true;
-    } 
-    else
-      aShape = myGeom->GetIORFromString(aShape->MainName());
-  }
-  
-  /* Loop on each sub shape created */
-  /* int i = 1 ; /* index for the nameType */  
-  for(int j=0; j<listGeomShapes->length(); j++) {
-    /* Get each sub shape extracted CORBA and OCC */
-    aResult = listGeomShapes[j] ;    
-    TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
-    
-    if (S.IsNull()) {
-      QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_ABORT"));
-      return false;
-    }
-    
-    /* Set the nameType of sub shape */
-    char* nameG = (char *)malloc(20);
-    Standard_CString Type;
-    if(myGeomBase->GetShapeTypeString(S, Type)) {
-      aResult->NameType(Type);
-      sprintf(nameG, "%s_%d", Type, myGeomBase->GetIndex(S, mainShape, SubShapeType));
-    } 
-    else {
-      aResult->NameType(tr("GEOM_SHAPE"));
-      sprintf(nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
-    }
-    SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
-
-    bool allreadyexist = false;
-          
-    if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_OCC) {
-      OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-      Handle (AIS_InteractiveContext) ic = v3d->getAISContext();
-      
-      Handle(GEOM_AISShape) result = new GEOM_AISShape(S, nameG);      
-      Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
-      
-      MESSAGE ("SO->_is_nil() " << SO->_is_nil())
-
-      if(SO->_is_nil()) {
-       SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
-        anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
-        aName = SALOMEDS::AttributeName::_narrow(anAttr);
-        aName->SetValue(nameG);
-        anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
-        anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-        anIOR->SetValue(aResult->Name());
-
-       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
-       aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
-       MESSAGE(" Type " << S.ShapeType())
-       if (S.ShapeType() == TopAbs_COMPOUND)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
-       else if(S.ShapeType() == TopAbs_COMPSOLID)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
-       else if(S.ShapeType() == TopAbs_SOLID)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
-       else if(S.ShapeType() == TopAbs_SHELL)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
-       else if(S.ShapeType() == TopAbs_FACE)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
-       else if(S.ShapeType() == TopAbs_WIRE)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
-       else if(S.ShapeType() == TopAbs_EDGE)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
-       else if(S.ShapeType() == TopAbs_VERTEX)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
-
-       MESSAGE(" aPixmap->GetPixMap " << aPixmap->GetPixMap())
-
-       SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-       aStudyBuilder->Addreference(newObj1, newObj);
-       IO->setEntry(newObj->GetID());
-
-       aResult->StudyShapeId(newObj->GetID());
-      }
-      else {
-       allreadyexist = true;
-       if(!this->SObjectExist(theObj, aResult->Name())) {
-         SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
-         aStudyBuilder->Addreference(newObj1, SO);
-         IO->setEntry(SO->GetID());
-         aResult->StudyShapeId(SO->GetID());
-       }
-      }
-      
-      result->setIO(IO);
-      result->setName(nameG);
-      if(!allreadyexist)
-       ic->Display(result);
-      
-    }
-    else if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() == VIEW_VTK) {
-      VTKViewer_RenderWindowInteractor* myRenderInter= ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRWInteractor();
-      
-      int themode = myRenderInter->GetDisplayMode();
-      vtkRenderer *theRenderer = ((VTKViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getRenderer();
-      vtkRenderWindow *renWin = theRenderer->GetRenderWindow();
-      
-      Handle(GEOM_InteractiveObject) IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
-      
-      if(SO->_is_nil()) {
-       SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
-        anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
-        anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-        anIOR->SetValue(aResult->Name());
-        anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
-        aName = SALOMEDS::AttributeName::_narrow(anAttr);
-        aName->SetValue(nameG);
-       
-       anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
-       aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
-       if(S.ShapeType() == TopAbs_COMPOUND)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
-       else if(S.ShapeType() == TopAbs_COMPSOLID)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
-       else if(S.ShapeType() == TopAbs_SOLID)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
-       else if(S.ShapeType() == TopAbs_SHELL)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
-       else if(S.ShapeType() == TopAbs_FACE)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
-       else if(S.ShapeType() == TopAbs_WIRE)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
-       else if(S.ShapeType() == TopAbs_EDGE)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
-       else if(S.ShapeType() == TopAbs_VERTEX)
-         aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
-
-       SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-       aStudyBuilder->Addreference(newObj1, newObj);
-       IO->setEntry(newObj->GetID());
-      }
-      else {
-       allreadyexist = true;
-       if(!this->SObjectExist(theObj, aResult->Name())) {
-         SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
-         aStudyBuilder->Addreference(newObj1, SO);
-         IO->setEntry(SO->GetID());
-       }
-      }
-      
-      if(!allreadyexist) {
-       vtkActorCollection* theActors = GEOM_AssemblyBuilder::BuildActors(S,0,themode,Standard_True);
-       theActors->InitTraversal();
-       vtkActor* anActor = (vtkActor*)theActors->GetNextActor();
-       while(!(anActor==NULL)) {
-         GEOM_Actor* GActor = GEOM_Actor::SafeDownCast(anActor);
-         GActor->setIO(IO);
-         GActor->setName(nameG);
-         theRenderer->AddActor(GActor);
-         renWin->Render();
-         anActor = (vtkActor*)theActors->GetNextActor();
-       }
-      }
-    }
-  }
-
-  /* commit transaction */
-  op->finish();
-
-  QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
-  QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
-  return true;
-}
-
-
-//=====================================================================================
-// function : OnSubShapeGetSelected()
-// purpose  :
-//=====================================================================================
-bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType, Standard_Integer& aLocalContextId, bool& myUseLocalContext)
-{
-  //* Test the type of viewer */
-  if(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getTypeView() > VIEW_OCC)
-    return false;
-
-  SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
-  SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
-  if(theObj->_is_nil()) {
-    QAD_Application::getDesktop()->putInfo(tr("GEOM_PRP_SHAPE_IN_STUDY"));
-    return false;
-  }
-
-  OCCViewer_Viewer3d* v3d = ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->getViewer();
-  Handle(AIS_InteractiveContext) ic = v3d->getAISContext();
-  
-  if( myUseLocalContext == false ) {
-    /* local context is from DialogBox */
-    MESSAGE("Error : No local context opened for sub shapes method" << endl ) ;
-    return false ;
-  }
-
-  GEOM::GEOM_Shape_var aShape  = myGeom->GetIORFromString( ShapeTopoIOR );
-  TopoDS_Shape mainTopo = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-
-  TopoDS_Shape mainShape;
-  bool main = false;
-  while(!main) {
-    if(aShape->IsMainShape()) {
-      mainShape = myGeomGUI->GetShapeReader().GetShape(myGeom, aShape);
-      main = true;
-    }
-    else
-      aShape = myGeom->GetIORFromString(aShape->MainName());
-  }
-
-  GEOM::GEOM_Shape::ListOfSubShapeID_var ListOfID = new GEOM::GEOM_Shape::ListOfSubShapeID;
-  ic->InitSelected();
-  int nbSelected = ic->NbSelected();
-  ListOfID->length(nbSelected);
-  
-  TopoDS_Compound compound;
-  ic->InitSelected(); /* to init again */ 
-  BRep_Builder B;
-  B.MakeCompound(compound);
-
-  int i = 0;
-  /* We create a unique compound containing all the sub shapes selected by user as attribute of the main shape */
-  /* the compound is homogenous by selection */
-  while(ic->MoreSelected()) {
-    int index = myGeomBase->GetIndex(ic->SelectedShape(), mainShape, SubShapeType);
-    ListOfID[i] = index;
-    B.Add(compound, ic->SelectedShape());
-    i++;
-    ic->NextSelected();
-  }
-  /* Test if user has selected sub shapes */
-  if(ListOfID->length() < 1)
-    return false;
-
-  GEOM::GEOM_Shape_var aResult;
-  try {
-    aResult = myGeom->SubShape(aShape, SubShapeType, ListOfID);
-  }
-  catch (const SALOME::SALOME_Exception& S_ex) {
-    QtCatchCorbaException(S_ex);
-  }
-
-  /* local context from DialogBox */
-  ic->CloseLocalContext(aLocalContextId);
-  myUseLocalContext = false ;
-
-  char* nameG = (char *)malloc(20);
-  Standard_CString Type;
-
-  Handle(GEOM_AISShape) result; 
-  Handle(GEOM_InteractiveObject) IO;
-
-  if(nbSelected == 1) {
-    TopExp_Explorer Exp (compound, TopAbs_ShapeEnum(SubShapeType));
-    if(Exp.More()) {
-      if(myGeomBase->GetShapeTypeString(Exp.Current(),Type)) {
-       aResult->NameType(Type);
-       sprintf (nameG, "%s_%d", Type, myGeomBase->GetIndex( Exp.Current(), mainTopo, SubShapeType));
-      } 
-      else {
-       aResult->NameType(tr("GEOM_SHAPE"));
-       sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
-      }
-      result = new GEOM_AISShape(Exp.Current(), nameG);
-      IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
-    }
-  }
-  else {
-    if ( myGeomBase->GetShapeTypeString(compound,Type)) {
-      aResult->NameType(Type);
-      sprintf (nameG, "%s_%d", Type, myGeomGUI->myNbGeom++);
-    } else {
-      aResult->NameType(tr("GEOM_SHAPE"));
-      sprintf (nameG, "%s_%d", tr("GEOM_SHAPE").latin1(), myGeomGUI->myNbGeom++);
-    }
-    result = new GEOM_AISShape(compound, nameG);
-    IO = new GEOM_InteractiveObject(aResult->Name(), myGeomGUI->GetFatherior(), "GEOM");
-  }
-  
-  SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
-  
-  /* open transaction */
-  QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
-  op->start();
-  
-  SALOMEDS::StudyBuilder_var aStudyBuilder = aStudy->NewBuilder();
-  SALOMEDS::SObject_var fatherSF = aStudy->FindObjectID(QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->entry());
-  SALOMEDS::GenericAttribute_var anAttr;
-  SALOMEDS::AttributeName_var aName;
-  SALOMEDS::AttributeIOR_var anIOR;
-  SALOMEDS::AttributePixMap_var aPixmap;
-  bool allreadyexist = false;
-
-  if(SO->_is_nil()) {
-    SALOMEDS::SObject_var newObj = aStudyBuilder->NewObject(theObj);
-    anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeIOR");
-    anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
-    anIOR->SetValue(aResult->Name());
-    anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributeName");
-    aName = SALOMEDS::AttributeName::_narrow(anAttr);
-    aName->SetValue(result->getName());
-    
-    anAttr = aStudyBuilder->FindOrCreateAttribute(newObj, "AttributePixMap");
-    aPixmap = SALOMEDS::AttributePixMap::_narrow(anAttr);
-    if(result->Shape().ShapeType() == TopAbs_COMPOUND)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_COMPOUND");
-    else if(result->Shape().ShapeType() == TopAbs_COMPSOLID)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_COMPSOLID");
-    else if(result->Shape().ShapeType() == TopAbs_SOLID)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_SOLID");
-    else if(result->Shape().ShapeType() == TopAbs_SHELL)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_SHELL");
-    else if(result->Shape().ShapeType() == TopAbs_FACE)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_FACE");
-    else if(result->Shape().ShapeType() == TopAbs_WIRE)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_WIRE");
-    else if(result->Shape().ShapeType() == TopAbs_EDGE)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_EDGE");
-    else if(result->Shape().ShapeType() == TopAbs_VERTEX)
-      aPixmap->SetPixMap("ICON_OBJBROWSER_VERTEX");
-
-    SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(fatherSF);
-    aStudyBuilder->Addreference(newObj1, newObj);
-    
-    IO->setEntry(newObj->GetID());
-    aResult->StudyShapeId(newObj->GetID());
-  } 
-  else {
-    allreadyexist = true;
-    if(!this->SObjectExist(theObj, aResult->Name())) {
-      SALOMEDS::SObject_var newObj1 = aStudyBuilder->NewObject(theObj);
-      aStudyBuilder->Addreference(newObj1, SO);
-    
-      IO->setEntry(SO->GetID());
-      aResult->StudyShapeId(SO->GetID());
-    }
-  }
-  
-  /* commit transaction */
-  op->finish();
-  
-  result->setIO(IO);
-  result->setName(nameG);
-
-  if(!allreadyexist)
-    ic->Display(result);
-
-  DisplayGUI* myDisplayGUI = new DisplayGUI();
-  myDisplayGUI->OnDisplayAll(true);
-
-  QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
-  QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
-  return true;
-}
-
-
 //=====================================================================================
 // EXPORTED METHODS
 //=====================================================================================
 extern "C"
 {
-  bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-  {return EntityGUI::OnGUIEvent(theCommandID, parent);}
+#ifdef WIN32
+  __declspec( dllexport )
+#endif
+  GEOMGUI* GetLibGUI( GeometryGUI* parent )
+  {
+    return new EntityGUI( parent );
+  }
 }