Salome HOME
Merge with version on tag OCC-V2_1_0d
[modules/geom.git] / src / EntityGUI / EntityGUI.cxx
index 049b4fe00c5bc9305afa60815282996d62bdbe6b..28765de1ffa4c3e9cd66cf1f55edc455f6f97ff4 100644 (file)
 //  File   : EntityGUI.cxx
 //  Author : Damien COQUERET
 //  Module : GEOM
-//  $Header
+//  $Header$
 
 #include "EntityGUI.h"
+#include "GeometryGUI.h"
 
 #include "QAD_RightFrame.h"
+#include "QAD_Desktop.h"
 #include "OCCViewer_Viewer3d.h"
+#include "OCCViewer_ViewFrame.h"
 #include "VTKViewer_ViewFrame.h"
 #include "GEOM_AssemblyBuilder.h"
 #include "SALOMEGUI_ImportOperation.h"
@@ -39,8 +42,6 @@
 #include <BRep_Builder.hxx>
 #include <TopExp_Explorer.hxx>
 
-#include "DisplayGUI.h"
-
 #include "EntityGUI_SketcherDlg.h" // Sketcher
 #include "EntityGUI_SubShapeDlg.h" // Method SUBSHAPE
 
 
 using namespace std;
 
+EntityGUI* EntityGUI::myGUIObject = 0;
+
+//=======================================================================
+// function : GetEntityGUI()
+// purpose  : Get the only EntityGUI object [ static ]
+//=======================================================================
+EntityGUI* EntityGUI::GetEntityGUI()
+{
+  if ( myGUIObject == 0 ) {
+    // init EntityGUI only once
+    myGUIObject = new EntityGUI();
+  }
+  return myGUIObject;
+}
+
 //=======================================================================
 // function : EntityGUI()
 // purpose  : Constructor
 //=======================================================================
-EntityGUI::EntityGUI() :
-  QObject()
+EntityGUI::EntityGUI() :  GEOMGUI()
 {
   myGeomBase = new GEOMBase();
-  myGeomGUI = GEOMContext::GetGeomGUI();
-  myGeom = myGeomGUI->myComponentGeom;
+  myGeom = GEOM::GEOM_Gen::_duplicate( GeometryGUI::GetGeomGUI()->GetGeomGen() );
 
   mySimulationShape1 = new AIS_Shape(TopoDS_Shape());
   mySimulationShape2 = new AIS_Shape(TopoDS_Shape());
@@ -79,34 +93,26 @@ EntityGUI::~EntityGUI()
 //=======================================================================
 bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
 {
-  EntityGUI* myEntityGUI = new EntityGUI();
-  myEntityGUI->myGeomGUI->EmitSignalDeactivateDialog();
+  GeometryGUI::GetGeomGUI()->EmitSignalDeactivateDialog();
   SALOME_Selection* Sel = SALOME_Selection::Selection(QAD_Application::getDesktop()->getActiveStudy()->getSelection());
+  QDialog* aDlg = NULL;
 
   switch (theCommandID)
-    {
+  {
     case 404: // SKETCHER
-      {
-       ((OCCViewer_ViewFrame*)QAD_Application::getDesktop()->getActiveStudy()->getActiveStudyFrame()->getRightFrame()->getViewFrame())->onViewTop(); // DCQ : 28/02/2002
-       EntityGUI_SketcherDlg* aDlg = new EntityGUI_SketcherDlg(parent, "", myEntityGUI, Sel);
-       break;
-      }
+      GeometryGUI::GetGeomGUI()->ActiveWorkingPlane();
+      aDlg = new EntityGUI_SketcherDlg(parent, "", Sel);
+      break;
     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 ;
-      }
+      aDlg = new EntityGUI_SubShapeDlg(parent, "", Sel);
+      break;
     default:
-      {
-       parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
-       break;
-      }
-    }
+      parent->putInfo(tr("GEOM_PRP_COMMAND").arg(theCommandID));
+      break;
+  }
+  if ( aDlg )
+    aDlg->show();
+   
   return true;
 }
 
@@ -117,6 +123,9 @@ bool EntityGUI::OnGUIEvent(int theCommandID, QAD_Desktop* parent)
 //=======================================================================
 void EntityGUI::OnSketchEnd(const char *Cmd)
 {
+  /*  QAD_Application::getDesktop()->putInfo("Create sketch functionality is NOT implemented in new GEOM kernel 
+                                          (no such Corba interface method).  Waiting for SRN to create it...");
+
   try {
     GEOM::GEOM_Shape_var result = myGeom->MakeSketcher(Cmd);
     if(result->_is_nil()) {
@@ -130,6 +139,7 @@ void EntityGUI::OnSketchEnd(const char *Cmd)
   catch(const SALOME::SALOME_Exception& S_ex) {
     QtCatchCorbaException(S_ex);
   }
+  */
   return;
 }
 
@@ -185,27 +195,22 @@ void EntityGUI::DisplaySimulationShape(const TopoDS_Shape& S1, const TopoDS_Shap
 // 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();
       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, Standard_False);
+      ic->ClearPrs(mySimulationShape1);
+      ic->Erase(mySimulationShape2, Standard_True, Standard_False);
+      ic->ClearPrs(mySimulationShape2);
       ic->UpdateCurrentViewer();
     } 
   }
 }
 
-
 //=====================================================================================
 // function : SObjectExist()
 // purpose  :
@@ -242,6 +247,8 @@ bool EntityGUI::SObjectExist(SALOMEDS::SObject_ptr theFatherObject, const char*
 //=====================================================================================
 bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* ShapeTopoIOR, const int SubShapeType)
 {
+  QAD_Application::getDesktop()->putInfo("OnSubShapeGetAll method from EntityGUI should be reimplemented ...");
+  /*
   SALOMEDS::Study_var aStudy = QAD_Application::getDesktop()->getActiveStudy()->getStudyDocument();
   SALOMEDS::SObject_var theObj = aStudy->FindObjectIOR(ShapeTopoIOR);
   if(theObj->_is_nil()) {
@@ -256,8 +263,8 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap
   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 */
+  // 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;
@@ -273,7 +280,7 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap
     QtCatchCorbaException(S_ex);
   }
   
-  /* open transaction */
+  // open transaction
   QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
   op->start();
   
@@ -289,10 +296,10 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap
       aShape = myGeom->GetIORFromString(aShape->MainName());
   }
   
-  /* Loop on each sub shape created */
-  /* int i = 1 ; /* index for the nameType */  
+  // 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 */
+    // Get each sub shape extracted CORBA and OCC
     aResult = listGeomShapes[j] ;    
     TopoDS_Shape S = myGeomGUI->GetShapeReader().GetShape(myGeom, aResult);
     
@@ -301,7 +308,7 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap
       return false;
     }
     
-    /* Set the nameType of sub shape */
+    // Set the nameType of sub shape
     char* nameG = (char *)malloc(20);
     Standard_CString Type;
     if(myGeomBase->GetShapeTypeString(S, Type)) {
@@ -444,11 +451,12 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap
     }
   }
 
-  /* commit transaction */
+  // commit transaction
   op->finish();
 
   QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
   QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
+  */
   return true;
 }
 
@@ -459,184 +467,185 @@ bool EntityGUI::OnSubShapeGetAll(const TopoDS_Shape& ShapeTopo, const char* Shap
 //=====================================================================================
 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();
+  QAD_Application::getDesktop()->putInfo("OnSubShapeGetSelected method from EntityGUI should be reimplemented ...");
+ //  //* 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);
+//   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();
-  }
+//   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");
-  }
+//   /* 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());
+//   SALOMEDS::SObject_var SO = aStudy->FindObjectIOR(aResult->Name());
   
-  /* open transaction */
-  QAD_Operation* op = new SALOMEGUI_ImportOperation(QAD_Application::getDesktop()->getActiveStudy());
-  op->start();
+//   /* 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;
+//   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());
+//   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);
+//     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(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());
-    }
-  }
+//       IO->setEntry(SO->GetID());
+//       aResult->StudyShapeId(SO->GetID());
+//     }
+//   }
   
-  /* commit transaction */
-  op->finish();
+//   /* commit transaction */
+//   op->finish();
   
-  result->setIO(IO);
-  result->setName(nameG);
+//   result->setIO(IO);
+//   result->setName(nameG);
 
-  if(!allreadyexist)
-    ic->Display(result);
+//   if(!allreadyexist)
+//     ic->Display(result);
 
-  DisplayGUI* myDisplayGUI = new DisplayGUI();
-  myDisplayGUI->OnDisplayAll(true);
+//   DisplayGUI* myDisplayGUI = new DisplayGUI();
+//   myDisplayGUI->OnDisplayAll(true);
 
-  QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
-  QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
+//   QAD_Application::getDesktop()->getActiveStudy()->updateObjBrowser();
+//   QAD_Application::getDesktop()->putInfo (tr("GEOM_PRP_READY"));
   return true;
 }
 
@@ -646,6 +655,8 @@ bool EntityGUI::OnSubShapeGetSelected(const TopoDS_Shape& ShapeTopo, const char*
 //=====================================================================================
 extern "C"
 {
-  bool OnGUIEvent(int theCommandID, QAD_Desktop* parent)
-  {return EntityGUI::OnGUIEvent(theCommandID, parent);}
+  GEOMGUI* GetLibGUI()
+  {
+    return EntityGUI::GetEntityGUI();
+  }
 }