]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Eliminate useless GetSubShape() lines in the python dump
authorvsr <vsr@opencascade.com>
Mon, 10 Jan 2011 10:50:44 +0000 (10:50 +0000)
committervsr <vsr@opencascade.com>
Mon, 10 Jan 2011 10:50:44 +0000 (10:50 +0000)
65 files changed:
src/BasicGUI/BasicGUI_ArcDlg.cxx
src/BasicGUI/BasicGUI_ArcDlg.h
src/BasicGUI/BasicGUI_CircleDlg.cxx
src/BasicGUI/BasicGUI_CircleDlg.h
src/BasicGUI/BasicGUI_CurveDlg.cxx
src/BasicGUI/BasicGUI_CurveDlg.h
src/BasicGUI/BasicGUI_EllipseDlg.cxx
src/BasicGUI/BasicGUI_EllipseDlg.h
src/BasicGUI/BasicGUI_LineDlg.cxx
src/BasicGUI/BasicGUI_LineDlg.h
src/BasicGUI/BasicGUI_MarkerDlg.cxx
src/BasicGUI/BasicGUI_MarkerDlg.h
src/BasicGUI/BasicGUI_PlaneDlg.cxx
src/BasicGUI/BasicGUI_PlaneDlg.h
src/BasicGUI/BasicGUI_PointDlg.cxx
src/BasicGUI/BasicGUI_PointDlg.h
src/BasicGUI/BasicGUI_VectorDlg.cxx
src/BasicGUI/BasicGUI_VectorDlg.h
src/BlocksGUI/BlocksGUI_BlockDlg.cxx
src/BlocksGUI/BlocksGUI_BlockDlg.h
src/BlocksGUI/BlocksGUI_QuadFaceDlg.cxx
src/BlocksGUI/BlocksGUI_QuadFaceDlg.h
src/BooleanGUI/BooleanGUI_Dialog.cxx
src/BooleanGUI/BooleanGUI_Dialog.h
src/BuildGUI/BuildGUI_CompoundDlg.cxx
src/BuildGUI/BuildGUI_CompoundDlg.h
src/BuildGUI/BuildGUI_EdgeDlg.cxx
src/BuildGUI/BuildGUI_EdgeDlg.h
src/BuildGUI/BuildGUI_FaceDlg.cxx
src/BuildGUI/BuildGUI_FaceDlg.h
src/BuildGUI/BuildGUI_ShellDlg.cxx
src/BuildGUI/BuildGUI_ShellDlg.h
src/BuildGUI/BuildGUI_SolidDlg.cxx
src/BuildGUI/BuildGUI_SolidDlg.h
src/BuildGUI/BuildGUI_WireDlg.cxx
src/BuildGUI/BuildGUI_WireDlg.h
src/GEOMBase/GEOMBase.cxx
src/GEOMBase/GEOMBase.h
src/GEOMBase/GEOMBase_Helper.cxx
src/GEOMBase/GEOMBase_Helper.h
src/GEOMBase/GEOM_GenericObjPtr.cxx [new file with mode: 0644]
src/GEOMBase/GEOM_GenericObjPtr.h [new file with mode: 0644]
src/GEOMBase/Makefile.am
src/GenerationGUI/GenerationGUI_FillingDlg.cxx
src/GenerationGUI/GenerationGUI_FillingDlg.h
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.h
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.h
src/GenerationGUI/GenerationGUI_RevolDlg.cxx
src/GenerationGUI/GenerationGUI_RevolDlg.h
src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_BoxDlg.h
src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_ConeDlg.h
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.h
src/PrimitiveGUI/PrimitiveGUI_DiskDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_DiskDlg.h
src/PrimitiveGUI/PrimitiveGUI_FaceDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_FaceDlg.h
src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h

index 1fb73235bc99af83c78816cc95ae4ff6689088c9..bf23ab463440b3996ca540a1c4aeb8227cf6532d 100644 (file)
@@ -159,7 +159,9 @@ void BasicGUI_ArcDlg::Init()
   /* init variables */
   myEditCurrentArgument = Group3Pnts->LineEdit1;
 
-  myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
   Group3Pnts2->CheckButton1->setChecked( false );
   Group3Pnts->PushButton1->setDown(true);
 
@@ -176,28 +178,16 @@ void BasicGUI_ArcDlg::Init()
   connect( Group3Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( Group3Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( Group3Pnts->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  
   connect( Group3Pnts2->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( Group3Pnts2->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( Group3Pnts2->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( Group3Pnts2->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts2->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts2->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( Group3Pnts2->CheckButton1, SIGNAL( toggled( bool ) ), this, SLOT( ReverseSense() ) );
 
   connect( Group3Pnts3->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( Group3Pnts3->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( Group3Pnts3->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( Group3Pnts3->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts3->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts3->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
            this, SLOT( SelectionIntoArgument() ) );
 
@@ -249,116 +239,80 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
   if (aSelList.Extent() != 1) {
     switch (getConstructorId()) {
     case 0:
-      if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1 = GEOM::GEOM_Object::_nil();
-      else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2 = GEOM::GEOM_Object::_nil();
-      else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3 = GEOM::GEOM_Object::_nil();
-      return;
+      if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1.nullify();
+      else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2.nullify();
+      else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3.nullify();
       break;
     case 1:
-      if      ( myEditCurrentArgument == Group3Pnts2->LineEdit1 )   myPoint1 = GEOM::GEOM_Object::_nil();
-      else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 )   myPoint2 = GEOM::GEOM_Object::_nil();
-      else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 )   myPoint3 = GEOM::GEOM_Object::_nil();
-      return;
+      if      ( myEditCurrentArgument == Group3Pnts2->LineEdit1 )   myPoint1.nullify();
+      else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 )   myPoint2.nullify();
+      else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 )   myPoint3.nullify();
       break;
     case 2:
-      if      ( myEditCurrentArgument == Group3Pnts3->LineEdit1 )   myPoint1 = GEOM::GEOM_Object::_nil();
-      else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 )   myPoint2 = GEOM::GEOM_Object::_nil();
-      else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 )   myPoint3 = GEOM::GEOM_Object::_nil();
-      return;
+      if      ( myEditCurrentArgument == Group3Pnts3->LineEdit1 )   myPoint1.nullify();
+      else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 )   myPoint2.nullify();
+      else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 )   myPoint3.nullify();
+      break;
+    default:
       break;
     }
+    return;
   }   
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if ( !CORBA::is_nil( aSelectedObject ) ) {
-    QString aName = GEOMBase::GetName(aSelectedObject);
-
-    // Get Selected object if selected subshape
-    TopoDS_Shape aShape;
-    if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-    {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if (aMap.Extent() == 1) // Local Selection
-      {
-        int anIndex = aMap(1);
-        aName += QString(":vertex_%1").arg(anIndex);
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-               if ( aFindedObject->_is_nil() ) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        }
-        else
-          aSelectedObject = aFindedObject; // get Object from study
-      }
-      else // Global Selection
-      {
-        if (aShape.ShapeType() != TopAbs_VERTEX) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
 
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     myEditCurrentArgument->setText(aName);
-
-    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );      
-    }
-
     switch ( getConstructorId() ) {
     case 0:
-      if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
+      if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
         myPoint1 = aSelectedObject;
-        if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+        if ( myPoint1 && !myPoint2 )
           Group3Pnts->PushButton2->click();
       }
       else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
         myPoint2 = aSelectedObject;
-        if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
+        if ( myPoint2 && !myPoint3 )
           Group3Pnts->PushButton3->click();
       }
       else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
         myPoint3 = aSelectedObject;
-        if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
+        if ( myPoint3 && !myPoint1 )
           Group3Pnts->PushButton1->click();
       }
       break;
     case 1:
       if ( myEditCurrentArgument == Group3Pnts2->LineEdit1 ) {
         myPoint1 = aSelectedObject;
-        if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+        if ( myPoint1 && !myPoint2 )
           Group3Pnts2->PushButton2->click();
       }
       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 ) {
         myPoint2 = aSelectedObject;
-        if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
+        if ( myPoint2 && !myPoint3 )
           Group3Pnts2->PushButton3->click();
       }
       else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 ) {
         myPoint3 = aSelectedObject;
-        if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
+        if ( myPoint3 && !myPoint1 )
           Group3Pnts2->PushButton1->click();
       }
       break;
     case 2:
       if ( myEditCurrentArgument == Group3Pnts3->LineEdit1 ) {
         myPoint1 = aSelectedObject;
-        if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+        if ( myPoint1 && !myPoint2 )
           Group3Pnts3->PushButton2->click();
       }
       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit2 ) {
         myPoint2 = aSelectedObject;
-        if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
+        if ( myPoint2 && !myPoint3 )
           Group3Pnts3->PushButton3->click();
       }
       else if ( myEditCurrentArgument == Group3Pnts3->LineEdit3 ) {
         myPoint3 = aSelectedObject;
-        if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
+        if ( myPoint3 && !myPoint1 )
           Group3Pnts3->PushButton1->click();
       }
       break;
@@ -466,22 +420,6 @@ void BasicGUI_ArcDlg::SetEditCurrentArgument()
 }
 
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_ArcDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == Group3Pnts->LineEdit1 || send == Group3Pnts->LineEdit2 || send == Group3Pnts->LineEdit3 ||
-       send == Group3Pnts2->LineEdit1 || send == Group3Pnts2->LineEdit2 || send == Group3Pnts2->LineEdit3 ||
-       send == Group3Pnts3->LineEdit1 || send == Group3Pnts3->LineEdit2 || send == Group3Pnts3->LineEdit3 ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -517,49 +455,15 @@ GEOM::GEOM_IOperations_ptr BasicGUI_ArcDlg::createOperation()
   return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
 }
 
-//=================================================================================
-// function : isEqual
-// purpose  : it may also be needed to check for min distance between gp_Pnt-s...
-//=================================================================================
-static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
-{
-  return thePnt1->_is_equivalent( thePnt2 );
-}
-
 //=================================================================================
 // function : isValid
 // purpose  :
 //=================================================================================
 bool BasicGUI_ArcDlg::isValid( QString& msg )
 {
-  switch (getConstructorId()) {
-  case 0:
-    {
-      if (Group3Pnts->LineEdit1->text().trimmed().isEmpty() ||
-          Group3Pnts->LineEdit2->text().trimmed().isEmpty() ||
-          Group3Pnts->LineEdit3->text().trimmed().isEmpty())
-        return false;
-      break;
-    }
-  case 1:
-    {
-      if (Group3Pnts2->LineEdit1->text().trimmed().isEmpty() ||
-          Group3Pnts2->LineEdit2->text().trimmed().isEmpty() ||
-          Group3Pnts2->LineEdit3->text().trimmed().isEmpty())
-        return false;
-      break;
-    }
-  case 2:
-    {
-      if (Group3Pnts3->LineEdit1->text().trimmed().isEmpty() ||
-          Group3Pnts3->LineEdit2->text().trimmed().isEmpty() ||
-          Group3Pnts3->LineEdit3->text().trimmed().isEmpty())
-        return false;
-      break;
-    }
-  }
-  return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
-    !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
+  bool ok = myPoint1 && myPoint2 && myPoint3 &&
+    myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3;
+  return ok;
 }
 
 //=================================================================================
@@ -576,8 +480,8 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects )
   switch ( getConstructorId() ) {
   case 0:
     {
-      if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
-        anObj = anOper->MakeArc( myPoint1, myPoint2, myPoint3 );
+      if ( myPoint1 && myPoint2 && myPoint3 ) {
+        anObj = anOper->MakeArc( myPoint1.get(), myPoint2.get(), myPoint3.get() );
         res = true;
       }
       break;
@@ -585,16 +489,16 @@ bool BasicGUI_ArcDlg::execute( ObjectList& objects )
   case 1:
     {
       bool Sense = Group3Pnts2->CheckButton1->isChecked();
-      if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
-        anObj = anOper->MakeArcCenter( myPoint1, myPoint2, myPoint3, Sense );
+      if ( myPoint1 && myPoint2 && myPoint3 ) {
+        anObj = anOper->MakeArcCenter( myPoint1.get(), myPoint2.get(), myPoint3.get(), Sense );
         res = true;
       }
       break;
     }
   case 2:
     {
-      if ( !CORBA::is_nil( myPoint1 ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) ) {
-        anObj = anOper->MakeArcOfEllipse( myPoint1, myPoint2, myPoint3 );
+      if ( myPoint1 && myPoint2 && myPoint3 ) {
+        anObj = anOper->MakeArcOfEllipse( myPoint1.get(), myPoint2.get(), myPoint3.get() );
         res = true;
       }
       break;
@@ -614,12 +518,13 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
 {
   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
 
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
+  
   switch ( constructorId ) {
   case 0:
     {
-      globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
-
       Group3Pnts->show();
       Group3Pnts2->hide();
       Group3Pnts3->hide();
@@ -632,16 +537,12 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
       Group3Pnts->LineEdit1->setEnabled(true);
       Group3Pnts->LineEdit2->setEnabled(false);
       Group3Pnts->LineEdit3->setEnabled(false);
-      myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
 
       myEditCurrentArgument = Group3Pnts->LineEdit1;
       break;
     }
   case 1:
     {
-      globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
-
       Group3Pnts->hide();
       Group3Pnts2->show();
       Group3Pnts3->hide();
@@ -654,16 +555,12 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
       Group3Pnts2->LineEdit1->setEnabled(true);
       Group3Pnts2->LineEdit2->setEnabled(false);
       Group3Pnts2->LineEdit3->setEnabled(false);
-      myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
       
       myEditCurrentArgument = Group3Pnts2->LineEdit1;
       break;
     }
   case 2:
     {
-      globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
-
       Group3Pnts->hide();
       Group3Pnts2->hide();
       Group3Pnts3->show();
@@ -676,13 +573,15 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
       Group3Pnts3->LineEdit1->setEnabled(true);
       Group3Pnts3->LineEdit2->setEnabled(false);
       Group3Pnts3->LineEdit3->setEnabled(false);
-      myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
 
       myEditCurrentArgument = Group3Pnts3->LineEdit1;
       break;
     }
   }
 
+  globalSelection(); // close local contexts, if any
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select Vertex on All Shapes
+  
   qApp->processEvents();
   updateGeometry();
   resize( minimumSizeHint() );
@@ -691,8 +590,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked( int constructorId )
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
            this, SLOT( SelectionIntoArgument() ) );
 
-  if ( CORBA::is_nil( myPoint1 ) )
-    SelectionIntoArgument();
+  SelectionIntoArgument();
 
   displayPreview();
 }
@@ -712,24 +610,15 @@ void BasicGUI_ArcDlg::ReverseSense()
 //=================================================================================
 void BasicGUI_ArcDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch ( getConstructorId() ) {
   case 0:
-    objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
-    objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
-    objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
-    break;
   case 1:
-    objMap[Group3Pnts2->LineEdit1->text()] = myPoint1;
-    objMap[Group3Pnts2->LineEdit2->text()] = myPoint2;
-    objMap[Group3Pnts2->LineEdit3->text()] = myPoint3;
-    break;
   case 2:
-    objMap[Group3Pnts3->LineEdit1->text()] = myPoint1;
-    objMap[Group3Pnts3->LineEdit2->text()] = myPoint2;
-    objMap[Group3Pnts3->LineEdit3->text()] = myPoint3;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
+    GEOMBase::PublishSubObject( myPoint3.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather( objMap );
 }
index 7694f282d886968aa5db9dff2e981c8077b5c4b7..eaf5eb5010d8f0cf852982154b8d4067f63961a7 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_ARCDLG_H
 #define BASICGUI_ARCDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_3Sel;
 class DlgRef_3Sel1Check;
@@ -56,7 +57,7 @@ private:
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::GEOM_Object_var              myPoint1, myPoint2, myPoint3;
+  GEOM::GeomObjPtr                   myPoint1, myPoint2, myPoint3;
 
   DlgRef_3Sel*                       Group3Pnts;
   DlgRef_3Sel1Check*                 Group3Pnts2;
@@ -68,7 +69,6 @@ private slots:
   
   void                               ActivateThisDialog();
   void                               ConstructorsClicked( int );
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ReverseSense();
index 3cebf40e4dedb4b723a13c3d912b4afba664bac4..c71bdf821ea71d0e8cd41210466d6c639e1fbdb4 100644 (file)
@@ -150,9 +150,14 @@ void BasicGUI_CircleDlg::Init()
   /* init variables */
   myEditCurrentArgument = GroupPntVecR->LineEdit1;
 
-  myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
-
-  // myGeomGUI->SetState( 0 );
+  myPoint.nullify();
+  myDir.nullify();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
+  myPoint4.nullify();
+  myPoint5.nullify();
+  myPoint6.nullify();
 
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -181,9 +186,6 @@ void BasicGUI_CircleDlg::Init()
   connect( GroupCenter2Pnts->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( GroupCenter2Pnts->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( GroupPntVecR->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupPntVecR->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( GroupPntVecR->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT(ValueChangedInSpinBox() ) );
   connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this, SLOT( SetDoubleSpinBoxStep( double ) ) );
 
@@ -212,7 +214,14 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId )
 {
   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
 
-  myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
+  myPoint4.nullify();
+  myPoint5.nullify();
+  myPoint6.nullify();
 
   switch ( constructorId ) {
   case 0:
@@ -320,104 +329,64 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects( aList );
 
   if ( aList.Extent() != 1 ) {
-    if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 )     myPoint  = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )     myDir    = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )       myPoint1 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )       myPoint2 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )       myPoint3 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6 = GEOM::GEOM_Object::_nil();
+    if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 )     myPoint.nullify();
+    else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )     myDir.nullify();
+    else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )       myPoint1.nullify();
+    else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )       myPoint2.nullify();
+    else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )       myPoint3.nullify();
+    else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) myPoint4.nullify();
+    else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) myPoint5.nullify();
+    else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) myPoint6.nullify();
     return;
   }
 
-  // nbSel == 1
-  Handle(SALOME_InteractiveObject) anIO = aList.First();
-
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
-  if ( !CORBA::is_nil( aSelectedObject ) ) {
-    QString aName = GEOMBase::GetName( aSelectedObject );
-
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
-      aNeedType = TopAbs_EDGE;
-
-    // If selected Vertex or Edge on the some Shape Get selection Subshape
-    TopoDS_Shape aShape;
-    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(anIO, aMap);
-      if ( aMap.Extent() == 1 ) { // Local Selection
-        int anIndex = aMap(1);
-        if ( aNeedType == TopAbs_EDGE )
-          aName += QString( ":edge_%1" ).arg( anIndex );
-        else
-          aName += QString( ":vertex_%1" ).arg( anIndex );
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-
-               if ( aFindedObject->_is_nil() ) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-          aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-        }
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if ( aShape.ShapeType() != aNeedType ) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) ?
+    TopAbs_EDGE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     
     myEditCurrentArgument->setText( aName );
 
-    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
-    }
-
     if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) {
       myPoint  = aSelectedObject;
-      if ( !myPoint->_is_nil() && myDir->_is_nil() )
+      if ( myPoint && !myDir )
         GroupPntVecR->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) {
       myDir    = aSelectedObject;
-      if ( !myDir->_is_nil() && myPoint->_is_nil() )
+      if ( myDir && !myPoint )
         GroupPntVecR->PushButton1->click();
     }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
       myPoint1 = aSelectedObject;
-      if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+      if ( myPoint1 && !myPoint2 )
         Group3Pnts->PushButton2->click();
     }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
       myPoint2 = aSelectedObject;
-      if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
+      if ( myPoint2 && !myPoint3 )
         Group3Pnts->PushButton3->click();
     }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
       myPoint3 = aSelectedObject;
-      if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
+      if ( myPoint3 && !myPoint1 )
         Group3Pnts->PushButton1->click();
     }
     else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit1 ) {
       myPoint4 = aSelectedObject;
-      if ( !myPoint4->_is_nil() && myPoint5->_is_nil() )
+      if ( myPoint4 && !myPoint5 )
         GroupCenter2Pnts->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit2 ) {
       myPoint5 = aSelectedObject;
-      if ( !myPoint5->_is_nil() && myPoint6->_is_nil() )
+      if ( myPoint5 && !myPoint6 )
         GroupCenter2Pnts->PushButton3->click();
     }
     else if ( myEditCurrentArgument == GroupCenter2Pnts->LineEdit3 ) {
       myPoint6 = aSelectedObject;
-      if ( !myPoint6->_is_nil() && myPoint4->_is_nil() )
+      if ( myPoint6 && !myPoint4 )
         GroupCenter2Pnts->PushButton1->click();
     }
   }
@@ -499,14 +468,10 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument()
   
   myEditCurrentArgument->setFocus();
 
-  if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) {
-    globalSelection(); // close local contexts, if any
-    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
-  }
-  else {
-    globalSelection(); // close local contexts, if any
-    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-  }
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) ?
+    TopAbs_EDGE : TopAbs_VERTEX;
+  globalSelection(); // close local contexts, if any
+  localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
 
   myEditCurrentArgument->setFocus();
   //  SelectionIntoArgument();
@@ -514,26 +479,6 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_CircleDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupPntVecR->LineEdit1 ||
-       send == GroupPntVecR->LineEdit2 ||
-       send == Group3Pnts->LineEdit1 ||
-       send == Group3Pnts->LineEdit2 ||
-       send == Group3Pnts->LineEdit3 ||
-       send == GroupCenter2Pnts->LineEdit1 ||
-       send == GroupCenter2Pnts->LineEdit2 ||
-       send == GroupCenter2Pnts->LineEdit3 ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 
 //=================================================================================
 // function : ActivateThisDialog()
@@ -566,7 +511,6 @@ void BasicGUI_CircleDlg::enterEvent( QEvent* )
 //=================================================================================
 void BasicGUI_CircleDlg::DeactivateActiveDialog()
 {
-  // myGeomGUI->SetState( -1 );
   GEOMBase_Skeleton::DeactivateActiveDialog();
 }
 
@@ -602,36 +546,31 @@ GEOM::GEOM_IOperations_ptr BasicGUI_CircleDlg::createOperation()
   return myGeomGUI->GetGeomGen()->GetICurvesOperations( getStudyId() );
 }
 
-//=================================================================================
-// function : isEqual
-// purpose  : it may also be needed to check for min distance between gp_Pnt-s...
-//=================================================================================
-static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
-{
-  return thePnt1->_is_equivalent( thePnt2 );
-}
-
 //=================================================================================
 // function : isValid
 // purpose  :
 //=================================================================================
 bool BasicGUI_CircleDlg::isValid( QString& msg )
 {
-  const int id = getConstructorId();
-  if ( id == 0 ) {
-    //return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0;
-    //nil point means origin of global CS
-    //nil vector means Z axis
-    bool ok = GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview());
-    return getRadius() > 0 && ok;
+  bool ok = false;
+  switch( getConstructorId() ) {
+  case 0:
+    // nil point means origin of global CS
+    // nil vector means Z axis
+    ok = GroupPntVecR->SpinBox_DX->isValid(msg, !IsPreview()) && getRadius() > 0;
+    break;
+  case 1:
+    ok = myPoint1 && myPoint2 && myPoint3 && myPoint1 != myPoint2 && 
+         myPoint1 != myPoint3 && myPoint2 != myPoint3;
+    break;
+  case 2:
+    ok = myPoint4 && myPoint5 && myPoint6 && myPoint4 != myPoint5 && 
+         myPoint5 != myPoint6 && myPoint4 != myPoint6;
+    break;
+  default:
+    break;
   }
-  else if ( id == 1 )
-    return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
-      !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 );
-  else if ( id == 2 )
-    return !myPoint4->_is_nil() && !myPoint5->_is_nil() && !myPoint6->_is_nil() &&
-      !isEqual( myPoint4, myPoint5 ) && !isEqual( myPoint5, myPoint6 ) && !isEqual( myPoint4, myPoint6 );
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -651,18 +590,18 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects )
     {
       QStringList aParameters;
       aParameters << GroupPntVecR->SpinBox_DX->text();
-      anObj = anOper->MakeCirclePntVecR( myPoint, myDir, getRadius() );
+      anObj = anOper->MakeCirclePntVecR( myPoint.get(), myDir.get(), getRadius() );
       if ( !anObj->_is_nil() && !IsPreview() )
         anObj->SetParameters(aParameters.join(":").toLatin1().constData());
       res = true;
       break;
     }
   case 1 :
-    anObj = anOper->MakeCircleThreePnt( myPoint1, myPoint2, myPoint3 );
+    anObj = anOper->MakeCircleThreePnt( myPoint1.get(), myPoint2.get(), myPoint3.get() );
     res = true;
     break;
   case 2:
-    anObj = anOper->MakeCircleCenter2Pnt( myPoint4, myPoint5, myPoint6 );
+    anObj = anOper->MakeCircleCenter2Pnt( myPoint4.get(), myPoint5.get(), myPoint6.get() );
     res = true;
     break;
   }
@@ -682,25 +621,22 @@ bool BasicGUI_CircleDlg::execute( ObjectList& objects )
 //=================================================================================
 void BasicGUI_CircleDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch ( getConstructorId() ) {
   case 0:
-    if (!CORBA::is_nil(myPoint))
-      objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
-    if (!CORBA::is_nil(myDir))
-      objMap[GroupPntVecR->LineEdit2->text()] = myDir;
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myDir.get() );
     break;
   case 1:
-    objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
-    objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
-    objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
+    GEOMBase::PublishSubObject( myPoint3.get() );
     break;
   case 2:
-    objMap[GroupCenter2Pnts->LineEdit1->text()] = myPoint4;
-    objMap[GroupCenter2Pnts->LineEdit2->text()] = myPoint5;
-    objMap[GroupCenter2Pnts->LineEdit3->text()] = myPoint6;
+    GEOMBase::PublishSubObject( myPoint4.get() );
+    GEOMBase::PublishSubObject( myPoint5.get() );
+    GEOMBase::PublishSubObject( myPoint6.get() );
     break;
+ default:
+   break;
   }
-  addSubshapesToFather( objMap );
 }
index e15bd8016878c022cbc93c5bcbed093f6ac591c5..cfb0c9e07cae3efb78465180ef993c079cc628e1 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_CIRCLEDLG_H
 #define BASICGUI_CIRCLEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_3Sel;
 class DlgRef_2Sel1Spin;
@@ -58,7 +59,7 @@ private:
   double                             getRadius() const;
 
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir, myPoint1, myPoint2, myPoint3, myPoint4, myPoint5, myPoint6;
+  GEOM::GeomObjPtr                   myPoint, myDir, myPoint1, myPoint2, myPoint3, myPoint4, myPoint5, myPoint6;
 
   DlgRef_2Sel1Spin*                  GroupPntVecR;
   DlgRef_3Sel*                       Group3Pnts;
@@ -74,7 +75,6 @@ private slots:
   void                               SelectionIntoArgument();
 
   void                               ConstructorsClicked( int );
-  void                               LineEditReturnPressed();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox();
   void                               SetDoubleSpinBoxStep( double );
index 2a962c46180c4427c13a3511d6f6c7b382b939b3..4d59a4b244e1db0ba420ca24b1e8ac99977d0c15 100644 (file)
@@ -112,8 +112,7 @@ void BasicGUI_CurveDlg::Init()
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
 
-  myPoints = new GEOM::ListOfGO();
-  myPoints->length( 0 );
+  myPoints.clear();
 
   globalSelection(); // close local contexts, if any
   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
@@ -128,7 +127,6 @@ void BasicGUI_CurveDlg::Init()
   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
 
   connect( GroupPoints->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupPoints->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
 
   connect( GroupPoints->CheckButton1,SIGNAL( toggled(bool) ),   this, SLOT( CheckButtonToggled() ) );
 
@@ -154,8 +152,7 @@ void BasicGUI_CurveDlg::ConstructorsClicked( int id )
   else
     GroupPoints->CheckButton1->hide();
 
-  myPoints = new GEOM::ListOfGO();
-  myPoints->length( 0 );
+  myPoints.clear();
 
   myEditCurrentArgument->setText( "" );
   qApp->processEvents();
@@ -177,20 +174,6 @@ void BasicGUI_CurveDlg::SetEditCurrentArgument()
   SelectionIntoArgument();
 }
 
-
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_CurveDlg::LineEditReturnPressed()
-{
-  if ( sender() == GroupPoints->LineEdit1 )
-  {
-    myEditCurrentArgument = GroupPoints->LineEdit1;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : CheckButtonToggled()
 // purpose  :
@@ -225,56 +208,29 @@ bool BasicGUI_CurveDlg::ClickOnApply()
   return true;
 }
 
-//=================================================================================
-/*! function : isPointInList()
- *  purpose  : Check is point (theObject) in the list \a thePoints.
- * \author enk
- * \retval -1, if point not in list, else 1 in list
- */
-//=================================================================================
-static int isPointInList( std::list<GEOM::GEOM_Object_var>& thePoints,
-                          GEOM::GEOM_Object_var& theObject )
-{
-  int len = thePoints.size();
-
-  if ( len < 1 ) {
-    return -1;
-  }
-
-  for ( std::list<GEOM::GEOM_Object_var>::iterator i = thePoints.begin(); i != thePoints.end(); i++ ) {
-    if ( std::string( (*i)->GetEntry() ) == std::string( theObject->GetEntry() ) ) {
-      return 1;
-    }
-  }
-
-  return -1;
-}
-//=================================================================================
-/*! function : removeUnnecessaryPnt()
- *  purpose  : Remove unnecessary points from list \a theOldPoints
- * \author enk
- * \li \a theOldPoints - ordered sequence with unnecessary point
- * \li \a theNewPoints - not ordered sequence with necessary points
- */
-//=================================================================================
-static void removeUnnecessaryPnt( std::list<GEOM::GEOM_Object_var>& theOldPoints,
-                                  GEOM::ListOfGO_var& theNewPoints )
+static void synchronize( QList<GEOM::GeomObjPtr>& left, QList<GEOM::GeomObjPtr>& right )
 {
-  std::list<GEOM::GEOM_Object_var> objs_to_remove;
-  for ( std::list<GEOM::GEOM_Object_var>::iterator i = theOldPoints.begin(); i != theOldPoints.end(); i++ ) {
+  // 1. remove items from the "left" list that are not in the "right" list
+  QMutableListIterator<GEOM::GeomObjPtr> it1( left );
+  while ( it1.hasNext() ) {
+    GEOM::GeomObjPtr o1 = it1.next();
     bool found = false;
-    for ( int j = 0; j < theNewPoints->length() && !found ; j++ ) {
-      if ( std::string( (*i)->GetEntry() ) == std::string( theNewPoints[j]->GetEntry() ) ) {
-        found = true;
-      }
-    }
-    if ( !found ) {
-      objs_to_remove.push_back( *i );
-      //cout << "removed: " << (*i)->GetEntry() << endl;
-    }
+    QMutableListIterator<GEOM::GeomObjPtr> it2( right );
+    while ( it2.hasNext() && !found )
+      found = o1 == it2.next();
+    if ( !found )
+      it1.remove();
   }
-  for ( std::list<GEOM::GEOM_Object_var>::iterator i = objs_to_remove.begin(); i != objs_to_remove.end(); i++ ) {
-    theOldPoints.remove( *i );
+  // 2. add items from the "right" list that are not in the "left" list (to keep selection order)
+  it1 = right;
+  while ( it1.hasNext() ) {
+    GEOM::GeomObjPtr o1 = it1.next();
+    bool found = false;
+    QMutableListIterator<GEOM::GeomObjPtr> it2( left );
+    while ( it2.hasNext() && !found )
+      found = o1 == it2.next();
+    if ( !found )
+      left << o1;
   }
 }
 
@@ -284,98 +240,12 @@ static void removeUnnecessaryPnt( std::list<GEOM::GEOM_Object_var>& theOldPoints
 //=================================================================================
 void BasicGUI_CurveDlg::SelectionIntoArgument()
 {
-  myEditCurrentArgument->setText( "" );
-
-  SalomeApp_Application* app = myGeomGUI->getApp();
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-  _PTR(Study) aDStudy = appStudy->studyDS();
-  GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-
-  int anIndex;
-  TopoDS_Shape aShape;
-  TColStd_IndexedMapOfInteger aMapIndexes;
-  GEOM::GEOM_Object_var anObject;
-  std::list<GEOM::GEOM_Object_var> aList;
-  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
-  SALOME_ListIO selected;
-  aSelMgr->selectedObjects(selected, QString::null, false);
-
-  int IOC = selected.Extent();
-  // bool is_append = myPoints->length() < IOC; // if true - add point, else remove
-  // myPoints->length( IOC ); // this length may be greater than number of objects,
-                           // that will actually be put into myPoints
-
-  for (SALOME_ListIteratorOfListIO anIt (selected); anIt.More(); anIt.Next()) {
-    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
-    if (!CORBA::is_nil(aSelectedObject) ) {
-      if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
-        aSelMgr->GetIndexes(anIt.Value(), aMapIndexes);
-
-        if (aMapIndexes.Extent() > 0) {
-          for (int ii = 1; ii <= aMapIndexes.Extent(); ii++) {
-            anIndex = aMapIndexes(ii);
-            QString aName = GEOMBase::GetName( aSelectedObject );
-            aName = aName + ":vertex_" + QString::number( anIndex );
-            anObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-            //Find Object in study
-            _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) );
-            bool inStudy = false;
-            _PTR(ChildIterator) iit( aDStudy->NewChildIterator( obj ) );
-            for (; iit->More() && !inStudy; iit->Next()) {
-              _PTR(SObject) child( iit->Value() );
-              QString aChildName = child->GetName().c_str();
-              if ( aChildName == aName ) {
-                inStudy = true;
-                CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject( iit->Value() );
-                anObject = GEOM::GEOM_Object::_narrow( corbaObj );
-              }
-            }
-
-            if ( !inStudy )
-              GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( aDStudy ),
-                                                     anObject, aName.toLatin1().data(), aSelectedObject );
-
-            int pos = isPointInList( myOrderedSel, anObject );
-            if ( pos == -1 ) {
-              myOrderedSel.push_back( anObject );
-            }
-            //              if (!inStudy)
-            aList.push_back(anObject);
-          }
-        }
-        else { // aMap.Extent() == 0
-          if ( aShape.ShapeType() == TopAbs_VERTEX ) {
-            int pos = isPointInList( myOrderedSel, aSelectedObject );
-            if ( pos == -1 )
-              myOrderedSel.push_back( aSelectedObject );
-            aList.push_back( aSelectedObject );
-          }
-        }
-      }
-    }
-  }
-
-  myPoints->length( aList.size()  );
-
-  int k = 0;
-  for ( std::list<GEOM::GEOM_Object_var>::iterator j = aList.begin(); j != aList.end(); j++ )
-    myPoints[k++] = *j;
-
-  if ( IOC == 0 )
-    myOrderedSel.clear();
+  QList<GEOM::GeomObjPtr> points = getSelected( TopAbs_VERTEX, -1 );
+  synchronize( myPoints, points );
+  if ( !myPoints.isEmpty()  )
+    GroupPoints->LineEdit1->setText( QString::number( myPoints.count() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
   else
-    removeUnnecessaryPnt( myOrderedSel, myPoints );
-
-  // if ( myOrderedSel.size() == myPoints->length() ) {
-  myPoints->length( myOrderedSel.size()  );
-  k = 0;
-  for ( std::list<GEOM::GEOM_Object_var>::iterator j = myOrderedSel.begin(); j != myOrderedSel.end(); j++ )
-    myPoints[k++] = *j;
-  //  }
-
-  if ( myPoints->length() > 0  )
-    GroupPoints->LineEdit1->setText( QString::number( myPoints->length() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
-
+    GroupPoints->LineEdit1->setText( "" );
   displayPreview();
 }
 
@@ -431,7 +301,7 @@ GEOM::GEOM_IOperations_ptr BasicGUI_CurveDlg::createOperation()
 //=================================================================================
 bool BasicGUI_CurveDlg::isValid( QString& msg )
 {
-  return myPoints->length() > 1;
+  return myPoints.count() > 1;
 }
 
 //=================================================================================
@@ -446,17 +316,22 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects )
 
   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );
 
+  GEOM::ListOfGO_var points = new GEOM::ListOfGO();
+  points->length( myPoints.count() );
+  for ( int i = 0; i < myPoints.count(); i++ )
+    points[i] = myPoints[i].copy();
+
   switch ( getConstructorId() ) {
   case 0 :
-    anObj = anOper->MakePolyline( myPoints );
+    anObj = anOper->MakePolyline( points.in() );
     res = true;
     break;
   case 1 :
-    anObj = anOper->MakeSplineBezier( myPoints );
+    anObj = anOper->MakeSplineBezier( points.in() );
     res = true;
     break;
   case 2 :
-    anObj = anOper->MakeSplineInterpolation( myPoints, GroupPoints->CheckButton1->isChecked() );
+    anObj = anOper->MakeSplineInterpolation( points.in(), GroupPoints->CheckButton1->isChecked() );
     res = true;
     break;
   }
@@ -466,3 +341,13 @@ bool BasicGUI_CurveDlg::execute( ObjectList& objects )
 
   return res;
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_CurveDlg::addSubshapesToStudy()
+{
+  for ( int i = 0; i < myPoints.count(); i++ )
+    GEOMBase::PublishSubObject( myPoints[i].get() );
+}
index 7dda9952308154dd60eed50b39e0091a972cc693..797466eacc3e9084f46b20aa8c2a7a290ae97041 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_CURVEDLG_H
 #define BASICGUI_CURVEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 #include <list>
 
@@ -50,6 +51,7 @@ protected:
   virtual GEOM::GEOM_IOperations_ptr createOperation();
   virtual bool                       isValid( QString& );
   virtual bool                       execute( ObjectList& );
+  virtual void                       addSubshapesToStudy();
 
 private:
   void                               Init();
@@ -57,8 +59,7 @@ private:
 
 private:
   DlgRef_1Sel1Check*                 GroupPoints;
-  GEOM::ListOfGO_var                 myPoints;
-  std::list<GEOM::GEOM_Object_var>   myOrderedSel; //!< This list used for managing orderes selection
+  QList<GEOM::GeomObjPtr>            myPoints;
 
 private slots:
   void                               ClickOnOk();
@@ -68,7 +69,6 @@ private slots:
   void                               DeactivateActiveDialog();
 
   void                               ConstructorsClicked( int );
-  void                               LineEditReturnPressed();
   void                               CheckButtonToggled();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
index 9cf7b8e014cf1f8bc8585fd9c69fde05ac5a5d4f..3f36eddac2c346ccaeee85cb643847530e8dd9b2 100644 (file)
@@ -115,11 +115,11 @@ void BasicGUI_EllipseDlg::Init()
 {
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
-  globalSelection(); // close local contexts, if any
-  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   GroupPoints->PushButton1->setDown(true);
 
-  myPoint = myDir = myMajor = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
+  myMajor.nullify();
 
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -144,10 +144,6 @@ void BasicGUI_EllipseDlg::Init()
   connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( GroupPoints->PushButton3, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupPoints->LineEdit3, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( GroupPoints->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupPoints->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
 
@@ -158,6 +154,9 @@ void BasicGUI_EllipseDlg::Init()
 
   initName( tr( "GEOM_ELLIPSE" ) );
 
+  globalSelection(); // close local contexts, if any
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+
   resize( minimumSizeHint() );
   SelectionIntoArgument();
   displayPreview();
@@ -197,7 +196,9 @@ bool BasicGUI_EllipseDlg::ClickOnApply()
   initName();
 
   // reset
-  myPoint = myDir = myMajor = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
+  myMajor.nullify();
   GroupPoints->LineEdit1->setText( "" );
   GroupPoints->LineEdit2->setText( "" );
   GroupPoints->LineEdit3->setText( "" );
@@ -229,73 +230,33 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir   = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPoints->LineEdit3) myMajor = GEOM::GEOM_Object::_nil();
+    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit3) myMajor.nullify();
     return;
   }
 
-  Handle(SALOME_InteractiveObject) anIO = aSelList.First();
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
-  if (!CORBA::is_nil(aSelectedObject) ) {
-    QString aName = GEOMBase::GetName(aSelectedObject);
-    
-    // Get Selected object if selected subshape
-    TopoDS_Shape aShape;
-
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if ( myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3 )
-      aNeedType = TopAbs_EDGE;
-    
-    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(anIO, aMap);
-      if (aMap.Extent() == 1) {
-        int anIndex = aMap(1);
-        if (aNeedType == TopAbs_EDGE)
-          aName += QString(":edge_%1").arg(anIndex);
-        else
-          aName += QString(":vertex_%1").arg(anIndex);
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-               if (aFindedObject->_is_nil()) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        } 
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if (aShape.ShapeType() != aNeedType) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
-    
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 || 
+                                myEditCurrentArgument == GroupPoints->LineEdit3 ) ?
+    TopAbs_EDGE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     myEditCurrentArgument->setText( aName );
-
-    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      localSelection( GEOM::GEOM_Object::_nil(), aNeedType );      
-    }
-
     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
       myPoint = aSelectedObject;
-      if ( !myPoint->_is_nil() && myDir->_is_nil() )
+      if ( myPoint && !myDir )
         GroupPoints->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
-      myDir   = aSelectedObject;
-      if ( !myDir->_is_nil() && myMajor->_is_nil() )
+      myDir = aSelectedObject;
+      if ( myDir && !myMajor )
         GroupPoints->PushButton3->click();
     }
     else if ( myEditCurrentArgument == GroupPoints->LineEdit3 ) {
       myMajor = aSelectedObject;
-      if ( !myMajor->_is_nil() && myPoint->_is_nil() )
+      if ( myMajor && !myPoint )
         GroupPoints->PushButton1->click();
     }
   }
@@ -337,10 +298,10 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument()
     GroupPoints->LineEdit3->setEnabled( true );
   }
 
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupPoints->LineEdit2 || 
+                                myEditCurrentArgument == GroupPoints->LineEdit3 ) ? 
+    TopAbs_EDGE : TopAbs_VERTEX;
   globalSelection(); // close local contexts, if any
-  TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-  if ( myEditCurrentArgument == GroupPoints->LineEdit2 || myEditCurrentArgument == GroupPoints->LineEdit3 )
-    aNeedType = TopAbs_EDGE;
   localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
   
   myEditCurrentArgument->setFocus();
@@ -349,21 +310,6 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_EllipseDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupPoints->LineEdit1 ||
-       send == GroupPoints->LineEdit2 ||
-       send == GroupPoints->LineEdit3 ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 
 //=================================================================================
 // function : ActivateThisDialog()
@@ -382,7 +328,8 @@ void BasicGUI_EllipseDlg::ActivateThisDialog()
   GroupPoints->LineEdit2->setText( "" );
   GroupPoints->LineEdit3->setText( "" );
 
-  myPoint = myDir = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
   //globalSelection( GEOM_POINT );
   globalSelection(); // close local contexts, if any
   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
@@ -432,18 +379,18 @@ GEOM::GEOM_IOperations_ptr BasicGUI_EllipseDlg::createOperation()
 //=================================================================================
 bool BasicGUI_EllipseDlg::isValid( QString& msg )
 {
-  double aMajorR = GroupPoints->SpinBox_DX->value();
-  double aMinorR = GroupPoints->SpinBox_DY->value();
-  if ( aMajorR < aMinorR ) {
-    msg = tr( "GEOM_ELLIPSE_ERROR_1" );
-    return false;
+  // nil point means origin of global CS
+  // nil vector means Z axis
+  bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+            GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() );
+  if ( ok ) {
+    double aMajorR = GroupPoints->SpinBox_DX->value();
+    double aMinorR = GroupPoints->SpinBox_DY->value();
+    if ( aMajorR < aMinorR ) {
+      msg = tr( "GEOM_ELLIPSE_ERROR_1" );
+      ok = false;
+    }
   }
-  //return !myPoint->_is_nil() && !myDir->_is_nil();
-  //nil point means origin of global CS
-  //nil vector means Z axis
-  bool ok = true;
-  ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-  ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
   return ok;
 }
 
@@ -461,9 +408,9 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects )
   aParameters<<GroupPoints->SpinBox_DY->text();
   
   GEOM::GEOM_ICurvesOperations_var anOper = GEOM::GEOM_ICurvesOperations::_narrow( getOperation() );
-  GEOM::GEOM_Object_var anObj = myMajor->_is_nil() ? 
-    anOper->MakeEllipse   ( myPoint, myDir, aMajorR, aMinorR )         :
-    anOper->MakeEllipseVec( myPoint, myDir, aMajorR, aMinorR, myMajor );
+  GEOM::GEOM_Object_var anObj = myMajor ? 
+    anOper->MakeEllipseVec( myPoint.get(), myDir.get(), aMajorR, aMinorR, myMajor.get() ) :
+    anOper->MakeEllipse   ( myPoint.get(), myDir.get(), aMajorR, aMinorR );
   if ( !anObj->_is_nil() ) {
     if ( !IsPreview() )
       anObj->SetParameters(aParameters.join(":").toLatin1().constData());
@@ -478,14 +425,7 @@ bool BasicGUI_EllipseDlg::execute( ObjectList& objects )
 //=================================================================================
 void BasicGUI_EllipseDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  if (!CORBA::is_nil(myPoint))
-    objMap[GroupPoints->LineEdit1->text()] = myPoint;
-  if (!CORBA::is_nil(myDir))
-    objMap[GroupPoints->LineEdit2->text()] = myDir;
-  if (!CORBA::is_nil(myMajor))
-    objMap[GroupPoints->LineEdit3->text()] = myMajor;
-
-  addSubshapesToFather( objMap );
+  GEOMBase::PublishSubObject( myPoint.get() );
+  GEOMBase::PublishSubObject( myDir.get() );
+  GEOMBase::PublishSubObject( myMajor.get() );
 }
index 9d169b1862231db9f6e1cf5c6c0f6bd84b0c7e26..9c91be481c20c79cfe66a1faf38d73cfee262a80 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_ELLIPSEDLG_H
 #define BASICGUI_ELLIPSEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_3Sel2Spin;
 
@@ -55,7 +56,7 @@ private:
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir, myMajor;
+  GEOM::GeomObjPtr                   myPoint, myDir, myMajor;
   
   DlgRef_3Sel2Spin*                  GroupPoints;
   
@@ -66,7 +67,6 @@ private slots:
   void                               ActivateThisDialog();
   void                               DeactivateActiveDialog();
   
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox( double );
index c0261ec83f71872eff763d0f0c40c3a308568883..d9396d5d01657122530203cc430df53effac6e84 100644 (file)
@@ -120,11 +120,12 @@ void BasicGUI_LineDlg::Init()
 {
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
-  myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
-  globalSelection(); // close local contexts, if any
-  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myFace1.nullify();
+  myFace2.nullify();
+
   GroupPoints->PushButton1->setDown(true);
-  
         
   /* signals and slots connections */
   connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
@@ -140,11 +141,6 @@ void BasicGUI_LineDlg::Init()
   connect( GroupFaces->PushButton1,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
   connect( GroupFaces->PushButton2,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( GroupPoints->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupPoints->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupFaces->LineEdit1,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupFaces->LineEdit2,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
            this, SLOT( SelectionIntoArgument() ) );
   
@@ -190,14 +186,11 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
   switch ( constructorId ) {
   case 0:
     {
-      globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
-      
       myEditCurrentArgument = GroupPoints->LineEdit1;
       myEditCurrentArgument->setText( "" );
       GroupPoints->LineEdit2->setText( "" );
-      myPoint1 = GEOM::GEOM_Object::_nil();
-      myPoint2 = GEOM::GEOM_Object::_nil();
+      myPoint1.nullify();
+      myPoint2.nullify();
       GroupPoints->PushButton1->setDown(true);
       GroupPoints->PushButton2->setDown(false);
       GroupPoints->LineEdit1->setEnabled(true);
@@ -208,13 +201,10 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
     }
   case 1:
     {
-      globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
-
       myEditCurrentArgument = GroupFaces->LineEdit1;
       myEditCurrentArgument->setText("");
-      myFace1 = GEOM::GEOM_Object::_nil();
-      myFace2 = GEOM::GEOM_Object::_nil();
+      myFace1.nullify();
+      myFace2.nullify();
       GroupFaces->PushButton1->setDown(true);
       GroupFaces->PushButton2->setDown(false);
       GroupFaces->LineEdit1->setEnabled(true);
@@ -225,6 +215,12 @@ void BasicGUI_LineDlg::ConstructorsClicked( int constructorId )
     }
   }
 
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
+                                myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
+    TopAbs_FACE : TopAbs_VERTEX;
+  globalSelection(); // close local selection to clear it
+  localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
+
   qApp->processEvents();
   updateGeometry();
   resize( minimumSizeHint() );
@@ -244,77 +240,40 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupFaces->LineEdit1)  myFace1  = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupFaces->LineEdit2)  myFace2  = GEOM::GEOM_Object::_nil();
+    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify();
+    else if (myEditCurrentArgument == GroupFaces->LineEdit1)  myFace1.nullify();
+    else if (myEditCurrentArgument == GroupFaces->LineEdit2)  myFace2.nullify();
     displayPreview();
     return;
   }
 
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if ( !CORBA::is_nil( aSelectedObject ) ) {
-    QString aName = GEOMBase::GetName( aSelectedObject );
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
-         myEditCurrentArgument == GroupFaces->LineEdit2 )
-      aNeedType = TopAbs_FACE;
-    
-    TopoDS_Shape aShape;
-    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if ( aMap.Extent() == 1 ) { // Local Selection
-        int anIndex = aMap( 1 );
-        if ( aNeedType == TopAbs_FACE )
-          aName += QString( ":face_%1" ).arg( anIndex );
-        else
-          aName += QString( ":vertex_%1" ).arg( anIndex );
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-
-        if ( aFindedObject->_is_nil() ) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-          aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-        }
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if ( aShape.ShapeType() != aNeedType ) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
-
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
+                                myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
+    TopAbs_FACE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     myEditCurrentArgument->setText( aName );
-
-    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      localSelection( GEOM::GEOM_Object::_nil(), aNeedType );      
-    }
-
     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
       myPoint1 = aSelectedObject;
-      if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+      if ( myPoint1 && !myPoint2 )
         GroupPoints->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
       myPoint2 = aSelectedObject;
-      if ( !myPoint2->_is_nil() && myPoint1->_is_nil() )
+      if ( myPoint2 && !myPoint1 )
         GroupPoints->PushButton1->click();
     }
     else if ( myEditCurrentArgument == GroupFaces->LineEdit1 ) {
       myFace1 = aSelectedObject;
-      if ( !myFace1->_is_nil() && myFace2->_is_nil() )
+      if ( myFace1 && !myFace2 )
         GroupFaces->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupFaces->LineEdit2 ) {
       myFace2 = aSelectedObject;
-      if ( !myFace2->_is_nil() && myFace1->_is_nil() )
+      if ( myFace2 && !myFace1 )
         GroupFaces->PushButton1->click();      
     }
   }
@@ -322,7 +281,6 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
   displayPreview();
 }
 
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -355,10 +313,10 @@ void BasicGUI_LineDlg::SetEditCurrentArgument()
     GroupFaces->LineEdit2->setEnabled(true);
   }
 
+  TopAbs_ShapeEnum aNeedType = ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
+                                myEditCurrentArgument == GroupFaces->LineEdit2 ) ?
+    TopAbs_FACE : TopAbs_VERTEX;
   globalSelection(); // close local selection to clear it
-  TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-  if ( myEditCurrentArgument == GroupFaces->LineEdit1 || myEditCurrentArgument == GroupFaces->LineEdit2 )
-    aNeedType = TopAbs_FACE;
   localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
 
   myEditCurrentArgument->setFocus();
@@ -367,23 +325,6 @@ void BasicGUI_LineDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_LineDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if      ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
-  else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
-  else if ( send == GroupFaces->LineEdit1 )  myEditCurrentArgument = GroupFaces->LineEdit1;
-  else if ( send == GroupFaces->LineEdit2 )  myEditCurrentArgument = GroupFaces->LineEdit2;
-  else return;
-  GEOMBase_Skeleton::LineEditReturnPressed();
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -431,12 +372,18 @@ GEOM::GEOM_IOperations_ptr BasicGUI_LineDlg::createOperation()
 //=================================================================================
 bool BasicGUI_LineDlg::isValid( QString& msg )
 {
-  const int id = getConstructorId();
-  if ( id == 0 )
-    return !myPoint1->_is_nil() && !myPoint2->_is_nil();
-  else if ( id == 1 )
-    return !myFace1->_is_nil() && !myFace2->_is_nil();
-  return false;
+  bool ok = false;
+  switch ( getConstructorId() ) {
+  case 0 :
+    ok = myPoint1 && myPoint2;
+    break;
+  case 1:
+    ok = myFace1 && myFace2;
+    break;
+  default:
+    break;
+  }
+  return ok;
 }
 
 //=================================================================================
@@ -450,11 +397,11 @@ bool BasicGUI_LineDlg::execute( ObjectList& objects )
   GEOM::GEOM_IBasicOperations_var anOper = GEOM::GEOM_IBasicOperations::_narrow( getOperation() );
   switch ( getConstructorId() ) {
   case 0 :
-    anObj = anOper->MakeLineTwoPnt( myPoint1, myPoint2 );
+    anObj = anOper->MakeLineTwoPnt( myPoint1.get(), myPoint2.get() );
     res = true;
     break;
   case 1 :
-    anObj = anOper->MakeLineTwoFaces( myFace1, myFace2 );
+    anObj = anOper->MakeLineTwoFaces( myFace1.get(), myFace2.get() );
     res = true;
     break;
   }
@@ -471,16 +418,16 @@ bool BasicGUI_LineDlg::execute( ObjectList& objects )
 //=================================================================================
 void BasicGUI_LineDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
   switch ( getConstructorId() ) {
   case 0 :
-    objMap[GroupPoints->LineEdit1->text()] = myPoint1;
-    objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
     break;
   case 1 :
-    objMap[GroupFaces->LineEdit1->text()] = myFace1;
-    objMap[GroupFaces->LineEdit2->text()] = myFace2;
+    GEOMBase::PublishSubObject( myFace1.get() );
+    GEOMBase::PublishSubObject( myFace2.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather( objMap );
 }
index b710774767629e2a954fdea18ddd7009fca92556..cc3e389cb7c50ed289d558ffb4a9c1eeed630589 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_LINEDLG_H
 #define BASICGUI_LINEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel;
 
@@ -55,10 +56,10 @@ private:
   void                               enterEvent( QEvent* );
   
 private:
-  GEOM::GEOM_Object_var              myPoint1;   
-  GEOM::GEOM_Object_var              myPoint2;
-  GEOM::GEOM_Object_var              myFace1;
-  GEOM::GEOM_Object_var              myFace2;
+  GEOM::GeomObjPtr                   myPoint1;   
+  GEOM::GeomObjPtr                   myPoint2;
+  GEOM::GeomObjPtr                   myFace1;
+  GEOM::GeomObjPtr                   myFace2;
   
   DlgRef_2Sel*                       GroupPoints;
   DlgRef_2Sel*                       GroupFaces;
@@ -71,7 +72,6 @@ private slots:
   void                               DeactivateActiveDialog();
   void                               ConstructorsClicked( int );    
     
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
 };
index 2b4c26e22cfd071b671fbe19d72f327886cab100..0b8309e73d26606695fbb2b4825d49340c10ceda 100644 (file)
@@ -168,7 +168,10 @@ BasicGUI_MarkerDlg::~BasicGUI_MarkerDlg()
 //=================================================================================
 void BasicGUI_MarkerDlg::Init()
 {
-  myShape = myPoint = myVectorX = myVectorY = GEOM::GEOM_Object::_nil();
+  myShape.nullify();
+  myPoint.nullify();
+  myVectorX.nullify();
+  myVectorY.nullify();
   myBlockPreview = false;
   myConstructorId = -1;
   myEditCurrentArgument = Group1->LineEdit1;
@@ -187,11 +190,6 @@ void BasicGUI_MarkerDlg::Init()
   connect( Group2->PushButton2, SIGNAL( clicked() ),      this, SLOT( SetEditCurrentArgument() ) );
   connect( Group2->PushButton3, SIGNAL( clicked() ),      this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( Group1->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group2->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group2->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group2->LineEdit3,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( myGeomGUI,           SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( onDeactivate() ) );
   connect( myGeomGUI,           SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
 
@@ -259,7 +257,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
       globalSelection( GEOM_ALLGEOM );
       myEditCurrentArgument = Group1->LineEdit1;
       Group1->LineEdit1->setText( "" );
-      myShape = GEOM::GEOM_Object::_nil();
+      myShape.nullify();
       break;
     }
   case 2:
@@ -279,9 +277,9 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
       Group2->LineEdit1->setEnabled( true );
       Group2->LineEdit2->setEnabled( false );
       Group2->LineEdit3->setEnabled( false );
-      myPoint = GEOM::GEOM_Object::_nil();
-      myVectorX = GEOM::GEOM_Object::_nil();
-      myVectorY = GEOM::GEOM_Object::_nil();
+      myPoint.nullify();
+      myVectorX.nullify();
+      myVectorY.nullify();
       break;
     }
   }
@@ -328,65 +326,43 @@ bool BasicGUI_MarkerDlg::onApply()
 //=================================================================================
 void BasicGUI_MarkerDlg::onSelectionDone0()
 {
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() == 1) {
-    Handle(SALOME_InteractiveObject) anIO = aSelList.First();
-    GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_FACE );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && aSelectedObject->GetType() == GEOM_MARKER && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    // Existing LCS selected
+    TopoDS_Face aFace = TopoDS::Face( aShape );
+    Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
     
-    if ( !aSelectedObj->_is_nil() ) {
-      TopoDS_Shape aShape;
-      if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-        // Existing LCS selected
-        if ( aSelectedObj->GetType() == GEOM_MARKER && aShape.ShapeType() == TopAbs_FACE ) {
-          TopoDS_Face aFace = TopoDS::Face( aShape );
-          Handle(Geom_Plane) aPlane = Handle(Geom_Plane)::DownCast( BRep_Tool::Surface( aFace ) );
-          
-          if ( !aPlane.IsNull() ) {
-            gp_Ax3 anAx3 = aPlane->Pln().Position();
-            gp_Pnt aLoc = anAx3.Location();
-            gp_Dir aXDir = anAx3.XDirection();
-            gp_Dir aYDir = anAx3.YDirection();
-            
-            myData[ X ]->setValue( aLoc.X() );
-            myData[ Y ]->setValue( aLoc.Y() );
-            myData[ Z ]->setValue( aLoc.Z() );
-            
-            myData[ DX1 ]->setValue( aXDir.X() );
-            myData[ DY1 ]->setValue( aXDir.Y() );
-            myData[ DZ1 ]->setValue( aXDir.Z() );
-            
-            myData[ DX2 ]->setValue( aYDir.X() );
-            myData[ DY2 ]->setValue( aYDir.Y() );
-            myData[ DZ2 ]->setValue( aYDir.Z() );
-            aSelMgr->clearSelected();
-          }
-        }
-        else {
-          TColStd_IndexedMapOfInteger aMap;
-          aSelMgr->GetIndexes( anIO, aMap );
-          if ( aMap.Extent() == 1 ) { // Local Selection
-            int anIndex = aMap( 1 );
-            TopTools_IndexedMapOfShape aShapes;
-            TopExp::MapShapes( aShape, aShapes );
-            aShape = aShapes.FindKey( anIndex );
-            aSelMgr->clearSelected(); // ???
-          }
-
-          if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
-            gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
-            myData[ X ]->setValue( aPnt.X() );
-            myData[ Y ]->setValue( aPnt.Y() );
-            myData[ Z ]->setValue( aPnt.Z() );
-          }
-        }
-      }
+    if ( !aPlane.IsNull() ) {
+      gp_Ax3 anAx3 = aPlane->Pln().Position();
+      gp_Pnt aLoc = anAx3.Location();
+      gp_Dir aXDir = anAx3.XDirection();
+      gp_Dir aYDir = anAx3.YDirection();
+      
+      myData[ X ]->setValue( aLoc.X() );
+      myData[ Y ]->setValue( aLoc.Y() );
+      myData[ Z ]->setValue( aLoc.Z() );
+      
+      myData[ DX1 ]->setValue( aXDir.X() );
+      myData[ DY1 ]->setValue( aXDir.Y() );
+      myData[ DZ1 ]->setValue( aXDir.Z() );
+      
+      myData[ DX2 ]->setValue( aYDir.X() );
+      myData[ DY2 ]->setValue( aYDir.Y() );
+      myData[ DZ2 ]->setValue( aYDir.Z() );
     }
+    displayPreview();
+    return;
+  }
+  aSelectedObject = getSelected( TopAbs_VERTEX );
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+    myData[ X ]->setValue( aPnt.X() );
+    myData[ Y ]->setValue( aPnt.Y() );
+    myData[ Z ]->setValue( aPnt.Z() );
+    displayPreview();
+    return;
   }
-  
-  displayPreview();
 }
 
 
@@ -401,91 +377,49 @@ void BasicGUI_MarkerDlg::onSelectionDone()
     return;
   }
 
-  myEditCurrentArgument->setText( "" );
-
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() == 1) {
-    Handle(SALOME_InteractiveObject) anIO = aSelList.First();
-    GEOM::GEOM_Object_var aSelectedObj = GEOMBase::ConvertIOinGEOMObject( anIO );
-
-    if ( !CORBA::is_nil( aSelectedObj ) ) {
-      QString aName = GEOMBase::GetName( aSelectedObj );
-      
-      if ( getConstructorId() == 1 ) { // by shape position
-        TopoDS_Shape aShape;
-        if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) )
-          myShape = aSelectedObj;
-        myEditCurrentArgument->setText( aName );
+  TopAbs_ShapeEnum aNeedType;
+  if ( getConstructorId() == 1 ) // by shape position
+    aNeedType = TopAbs_SHAPE;
+  else if ( getConstructorId() == 2 ) // by point and two vectors
+    aNeedType = myEditCurrentArgument == Group2->LineEdit1 ? TopAbs_VERTEX : TopAbs_EDGE;
+  
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+    myEditCurrentArgument->setText( aName );
+    if ( getConstructorId() == 1 ) { // by shape position
+      myShape = aSelectedObject;
+    }
+    else if ( getConstructorId() == 2 ) { // by point and two vectors
+      if ( myEditCurrentArgument == Group2->LineEdit1 ) {
+       myPoint = aSelectedObject;
+       if (myPoint && !myVectorX)
+         Group2->PushButton2->click();
+      }
+      else if (myEditCurrentArgument == Group2->LineEdit2) {
+       myVectorX = aSelectedObject;
+       if (myVectorX && !myVectorY)
+         Group2->PushButton3->click();
       }
-      else if ( getConstructorId() == 2 ) { // by point and two vectors
-        TopoDS_Shape aShape;
-        if ( GEOMBase::GetShape( aSelectedObj, aShape, TopAbs_SHAPE ) ) {
-          TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
-          if ( myEditCurrentArgument == Group2->LineEdit1 )
-            aNeedType = TopAbs_VERTEX;
-          
-          TColStd_IndexedMapOfInteger aMap;
-          aSelMgr->GetIndexes( anIO, aMap );
-
-          if ( aMap.Extent() == 1 ) { // Local Selection
-            int anIndex = aMap( 1 );
-            if ( aNeedType == TopAbs_EDGE )
-              aName += QString( ":edge_%1" ).arg( anIndex );
-            else
-              aName += QString( ":vertex_%1" ).arg( anIndex );
-            
-            //Find SubShape Object in Father
-            GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObj, aName );
-            if ( aFindedObject->_is_nil() ) { // Object not found in study
-              GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-              aSelectedObj = aShapesOp->GetSubShape( aSelectedObj, anIndex );
-            } 
-            else {
-              aSelectedObj = aFindedObject; // get Object from study
-            }
-          }
-          else { // Global Selection
-            if ( aShape.ShapeType() != aNeedType ) {
-              aSelectedObj = GEOM::GEOM_Object::_nil();
-              aName = "";
-            }
-          }
-          
-          if ( myEditCurrentArgument == Group2->LineEdit1 ) {
-            myPoint = aSelectedObj;
-            myEditCurrentArgument->setText( aName );
-            if (!myPoint->_is_nil() && Group2->LineEdit2->text() == "")
-                Group2->PushButton2->click();
-          }
-          else if (myEditCurrentArgument == Group2->LineEdit2) {
-            myVectorX = aSelectedObj;
-            myEditCurrentArgument->setText( aName );
-            if (!myVectorX->_is_nil() && Group2->LineEdit3->text() == "")
-              Group2->PushButton3->click();
-          }
-          else if ( myEditCurrentArgument == Group2->LineEdit3 ) {
-            myVectorY = aSelectedObj;
-            myEditCurrentArgument->setText( aName );
-            if (!myVectorX->_is_nil() && Group2->LineEdit1->text() == "")
-                Group2->PushButton1->click();
-          }
-        }
+      else if ( myEditCurrentArgument == Group2->LineEdit3 ) {
+       myVectorY = aSelectedObject;
+       if (myVectorY && !myPoint)
+         Group2->PushButton1->click();
       }
     }
   }
   else {
     if ( getConstructorId() == 1 ) {
-      myShape = GEOM::GEOM_Object::_nil();
-    } else if ( getConstructorId() == 2 ) {
+      myShape.nullify();
+    }
+    else if ( getConstructorId() == 2 ) {
       if ( myEditCurrentArgument == Group2->LineEdit1 )
-        myPoint = GEOM::GEOM_Object::_nil();
+        myPoint.nullify();
       else if ( myEditCurrentArgument == Group2->LineEdit2 )
-        myVectorX = GEOM::GEOM_Object::_nil();
+        myVectorX.nullify();
       else if ( myEditCurrentArgument == Group2->LineEdit3 )
-        myVectorY = GEOM::GEOM_Object::_nil();
+        myVectorY.nullify();
     }
   }
 
@@ -538,18 +472,6 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument()
   onSelectionDone();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_MarkerDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-
-  myEditCurrentArgument = send;
-  GEOMBase_Skeleton::LineEditReturnPressed();
-}
-
 //=================================================================================
 // function : onActivate()
 // purpose  :
@@ -597,31 +519,33 @@ GEOM::GEOM_IOperations_ptr BasicGUI_MarkerDlg::createOperation()
 //=================================================================================
 bool BasicGUI_MarkerDlg::isValid( QString& msg )
 {
-  const int id = getConstructorId();
-  switch ( id ) {
-    case 0: {
-      gp_Vec v1( myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value() ),
-        v2( myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() );
+  bool ok = false;
+  switch ( getConstructorId() ) {
+  case 0: {
+    gp_Vec v1( myData[ DX1 ]->value(), myData[ DY1 ]->value(), myData[ DZ1 ]->value() ),
+      v2( myData[ DX2 ]->value(), myData[ DY2 ]->value(), myData[ DZ2 ]->value() );
       
-      bool isOk = false;
-      // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution()
-      // Vectors shouldn't be checked for being orthogonal here!
-      if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) {
-        isOk = !v1.IsParallel( v2, Precision::Angular() );
-        if ( !isOk )
-          msg += tr( "VEC_PARALLEL" );
-      }
-      bool ok = true;
-      for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end(); ++anIter )
-        ok = anIter.value()->isValid( msg, !IsPreview()) && ok;
-      return isOk && ok;
+    // we will got exception if the magnitude of any of the 2 vectors <= gp::Resolution()
+    // Vectors shouldn't be checked for being orthogonal here!
+    if ( v1.Magnitude() > gp::Resolution() && v2.Magnitude() > gp::Resolution() ) {
+      ok = !v1.IsParallel( v2, Precision::Angular() );
+      if ( !ok )
+       msg += tr( "VEC_PARALLEL" );
     }
-    case 1:
-      return !myShape->_is_nil();
-    case 2:
-      return !myPoint->_is_nil() && !myVectorX->_is_nil() && !myVectorY->_is_nil();
+    for ( DataMap::iterator anIter = myData.begin(); anIter != myData.end() && ok; ++anIter )
+      ok = anIter.value()->isValid( msg, !IsPreview()) && ok;
+    break;
   }
-  return false;
+  case 1:
+    ok = myShape;
+    break;
+  case 2:
+    ok = myPoint && myVectorX && myVectorY;
+    break;
+  default:
+    break;
+  }
+  return ok;
 }
 
 //=================================================================================
@@ -650,9 +574,9 @@ bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
     aParameters<<myData[ DY2 ]->text();
     aParameters<<myData[ DZ2 ]->text();
   } else if (id == 1) {
-    anObj = anOper->MakeMarkerFromShape( myShape ); 
+    anObj = anOper->MakeMarkerFromShape( myShape.get() ); 
   } else if (id == 2) {
-    anObj = anOper->MakeMarkerPntTwoVec( myPoint, myVectorX, myVectorY ); 
+    anObj = anOper->MakeMarkerPntTwoVec( myPoint.get(), myVectorX.get(), myVectorY.get() ); 
   }
   
   if ( !anObj->_is_nil() ) {
@@ -664,6 +588,29 @@ bool BasicGUI_MarkerDlg::execute( ObjectList& objects )
   return true;
 }
 
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_MarkerDlg::addSubshapesToStudy()
+{
+  switch ( getConstructorId() ) {
+  case 0 :
+    break;
+  case 1 :
+    GEOMBase::PublishSubObject( myShape.get() );
+    break;
+  case 2:
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myVectorX.get() );
+    GEOMBase::PublishSubObject( myVectorY.get() );
+    break;
+  default:
+    break;
+  }
+
+}
+
 //=================================================================================
 // function : onValueChanged
 // purpose  :
index 50d3613c5ee37776bc68366e8d773d478a23d13d..e2cdb7f0711b54e17eb5959dcdeb547ecb03767c 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_MARKERDLG_H
 #define BASICGUI_MARKERDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 #include <QMap>
 
@@ -57,15 +58,16 @@ protected:
                                                  const bool   = true,
                                                  const bool   = true,
                                                  const double = -1 );
+  virtual void                  addSubshapesToStudy();
 
 private:
   void                          enterEvent( QEvent* );
   void                          onSelectionDone0();
 
-  GEOM::GEOM_Object_var         myShape;
-  GEOM::GEOM_Object_var         myPoint;
-  GEOM::GEOM_Object_var         myVectorX;
-  GEOM::GEOM_Object_var         myVectorY;
+  GEOM::GeomObjPtr              myShape;
+  GEOM::GeomObjPtr              myPoint;
+  GEOM::GeomObjPtr              myVectorX;
+  GEOM::GeomObjPtr              myVectorY;
 
 private slots:
   void                          onOk();
@@ -75,7 +77,6 @@ private slots:
   void                          onSelectionDone();
   void                          onValueChanged( double );
   void                          ConstructorsClicked( int );
-  void                          LineEditReturnPressed();
   void                          SetEditCurrentArgument();
 
 private:
index e87cde189d60af48003c0c1dd903f3176de16694..7eb3506d7b9e73063acd080928475d5085dffb1d 100644 (file)
@@ -137,6 +137,7 @@ BasicGUI_PlaneDlg::BasicGUI_PlaneDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   GroupLCS->RadioButton1->setText( tr( "GEOM_WPLANE_OXY" ) );
   GroupLCS->RadioButton2->setText( tr( "GEOM_WPLANE_OYZ" ) );
   GroupLCS->RadioButton3->setText( tr( "GEOM_WPLANE_OZX" ) );
+  GroupLCS->LineEdit1->setReadOnly( true );
   GroupLCS->PushButton1->setIcon( image3 );
   GroupLCS->PushButton1->setDown( true );
 
@@ -173,8 +174,16 @@ void BasicGUI_PlaneDlg::Init()
   /* init variables */
   myEditCurrentArgument = GroupPntDir->LineEdit1;
 
-  myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
-
+  myPoint.nullify();
+  myDir.nullify();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
+  myFace.nullify();
+  myLCS.nullify();
+  myVec1.nullify();
+  myVec2.nullify();
   // myGeomGUI->SetState( 0 );
   myOriginType = 1;
 
@@ -218,15 +227,6 @@ void BasicGUI_PlaneDlg::Init()
   connect( GroupLCS->RadioButton2,   SIGNAL( clicked() ), this, SLOT( GroupClicked() ) );
   connect( GroupLCS->RadioButton3,   SIGNAL( clicked() ), this, SLOT( GroupClicked() ) );
 
-  connect( GroupPntDir->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupPntDir->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts->LineEdit1,  SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts->LineEdit2,  SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group3Pnts->LineEdit3,  SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupFace->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group2Vec->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( Group2Vec->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( GroupPntDir->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( Group3Pnts->SpinBox_DX,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupFace->SpinBox_DX,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
@@ -262,7 +262,15 @@ void BasicGUI_PlaneDlg::SetDoubleSpinBoxStep( double step )
 void BasicGUI_PlaneDlg::ConstructorsClicked( int constructorId )
 {
   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
-  myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = myFace = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
+  myFace.nullify();
+  myLCS.nullify();
+  myVec1.nullify();
+  myVec2.nullify();
 
   switch ( constructorId ) {
   case 0: /* plane from a point and a direction (vector, edge...) */
@@ -428,115 +436,70 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint  = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir    = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )  myPoint1 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )  myPoint2 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )  myPoint3 = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupFace->LineEdit1 )   myFace   = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group2Vec->LineEdit1 )   myVec1   = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == Group2Vec->LineEdit2 )   myVec2   = GEOM::GEOM_Object::_nil();
-    else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )    myLCS   = GEOM::GEOM_Object::_nil();
+    if      ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint.nullify();
+    else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir.nullify();
+    else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )  myPoint1.nullify();
+    else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )  myPoint2.nullify();
+    else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )  myPoint3.nullify();
+    else if ( myEditCurrentArgument == GroupFace->LineEdit1 )   myFace.nullify();
+    else if ( myEditCurrentArgument == Group2Vec->LineEdit1 )   myVec1.nullify();
+    else if ( myEditCurrentArgument == Group2Vec->LineEdit2 )   myVec2.nullify();
+    else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )    myLCS.nullify();
     displayPreview();
     return;
   }
 
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if ( !CORBA::is_nil( aSelectedObject ) ) {
-    QString aName = GEOMBase::GetName( aSelectedObject );
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2)
-      aNeedType = TopAbs_EDGE;
-    else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
-      aNeedType = TopAbs_FACE;
-    else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )
-      aNeedType = TopAbs_FACE;
-
-    TopoDS_Shape aShape;
-    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if ( aMap.Extent() == 1 ) { // Local Selection
-        int anIndex = aMap( 1 );
-        if ( aNeedType == TopAbs_EDGE )
-          aName += QString( ":edge_%1" ).arg( anIndex );
-        else if (aNeedType == TopAbs_FACE)
-          aName += QString( ":face_%1" ).arg( anIndex );
-        else
-          aName += QString( ":vertex_%1" ).arg( anIndex );
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-
-        if ( aFindedObject->_is_nil() ) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-          aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-        } 
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if ( aShape.ShapeType() != aNeedType ) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
-
+  TopAbs_ShapeEnum aNeedType;
+  if ( myEditCurrentArgument == GroupPntDir->LineEdit2 || myEditCurrentArgument == Group2Vec->LineEdit1 || myEditCurrentArgument == Group2Vec->LineEdit2)
+    aNeedType = TopAbs_EDGE;
+  else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
+    aNeedType = TopAbs_FACE;
+  else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )
+    aNeedType = TopAbs_FACE;
+  else
+    aNeedType = TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     myEditCurrentArgument->setText( aName );
-
-    /*    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
-        TColStd_MapOfInteger aMap;
-        aMap.Add( GEOM_PLANE );
-        aMap.Add( GEOM_MARKER );
-        globalSelection( aMap );
-      }
-      else
-        localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
-        }*/
-
-    if      ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) {
-      myPoint  = aSelectedObject;
-      if ( !myPoint->_is_nil() && myDir->_is_nil() )
+    if ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) {
+      myPoint = aSelectedObject;
+      if ( myPoint && !myDir )
         GroupPntDir->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
-      myDir    = aSelectedObject;
-      if ( !myDir->_is_nil() && myPoint->_is_nil() )
+      myDir = aSelectedObject;
+      if ( myDir && !myPoint )
         GroupPntDir->PushButton1->click();
     }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 ) {
       myPoint1 = aSelectedObject;
-      if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+      if ( myPoint1 && !myPoint2 )
         Group3Pnts->PushButton2->click();
     }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 ) {
       myPoint2 = aSelectedObject;
-      if ( !myPoint2->_is_nil() && myPoint3->_is_nil() )
+      if ( myPoint2 && !myPoint3 )
         Group3Pnts->PushButton3->click();
     }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 ) {
       myPoint3 = aSelectedObject;
-      if ( !myPoint3->_is_nil() && myPoint1->_is_nil() )
+      if ( myPoint3 && !myPoint1 )
         Group3Pnts->PushButton1->click();
     }
     else if ( myEditCurrentArgument == GroupFace->LineEdit1 )
       myFace   = aSelectedObject;
     else if ( myEditCurrentArgument == Group2Vec->LineEdit1 ) {
       myVec1 = aSelectedObject;
-      if ( !myVec1->_is_nil() && myVec2->_is_nil() )
+      if ( myVec1 && !myVec2 )
         Group2Vec->PushButton2->click();
     } else if ( myEditCurrentArgument == Group2Vec->LineEdit2 ) {
       myVec2 = aSelectedObject;
-      if ( !myVec2->_is_nil() && myVec1->_is_nil() )
+      if ( myVec2 && !myVec1 )
         Group2Vec->PushButton1->click();
     } else if ( myEditCurrentArgument == GroupLCS->LineEdit1 )
       myLCS = aSelectedObject;
-
   }
 
   displayPreview();
@@ -631,28 +594,6 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
 }
 
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_PlaneDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupPntDir->LineEdit1 ||
-       send == GroupPntDir->LineEdit2 ||
-       send == Group3Pnts->LineEdit1 ||
-       send == Group3Pnts->LineEdit2 ||
-       send == Group3Pnts->LineEdit3 ||
-       send == GroupFace->LineEdit1  ||
-       send == Group2Vec->LineEdit1  ||
-       send == Group2Vec->LineEdit2  ||
-       send == GroupLCS->LineEdit1  ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -736,47 +677,41 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PlaneDlg::createOperation()
   return myGeomGUI->GetGeomGen()->GetIBasicOperations( getStudyId() );
 }
 
-//=================================================================================
-// function : isEqual
-// purpose  : it may also be needed to check for min distance between gp_Pnt-s...
-//=================================================================================
-static bool isEqual( const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Object_var& thePnt2 )
-{
-        return thePnt1->_is_equivalent( thePnt2 );
-}
-
 //=================================================================================
 // function : isValid
 // purpose  :
 //=================================================================================
 bool BasicGUI_PlaneDlg::isValid( QString& msg )
 {
-  const int id = getConstructorId();
+  bool ok = false;
   if ( getSize() <= 0 ) {
     msg = QString( "Please, enter size greater than 0." );
-    return false;
   }
-
-  if ( id == 0 ) { 
-    bool ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() );
-    return !CORBA::is_nil( myPoint ) && !CORBA::is_nil( myDir ) && ok;
-  }
-  else if ( id == 1 ) {
-    bool ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() );
-    return !CORBA::is_nil( myPoint1  ) && !CORBA::is_nil( myPoint2 ) && !CORBA::is_nil( myPoint3 ) &&
-      !isEqual( myPoint1, myPoint2 ) && !isEqual( myPoint1, myPoint3 ) && !isEqual( myPoint2, myPoint3 ) && ok;
-  }
-  else if ( id == 2 ) {
-    bool ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() );
-    return !CORBA::is_nil( myFace ) && ok;
-  }   else if ( id == 3 ) {
-    bool ok = Group2Vec->SpinBox_DX->isValid( msg, !IsPreview() );
-    return !CORBA::is_nil( myVec1  ) && !CORBA::is_nil( myVec2 ) && !isEqual( myVec1, myVec2 ) && ok;
-  } else if ( id == 4 ) {
-    bool ok = GroupLCS->SpinBox_DX->isValid( msg, !IsPreview() );
-    return ok;
+  else {
+    switch ( getConstructorId() ) {
+    case 0:
+      ok = GroupPntDir->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint && myDir;
+      break;
+    case 1:
+      ok = Group3Pnts->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+          myPoint1 && myPoint2 && myPoint3 &&
+          myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3;
+      break;
+    case 2:
+      ok = GroupFace->SpinBox_DX->isValid( msg, !IsPreview() ) && myFace;
+      break;
+    case 3:
+      ok = Group2Vec->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+          myVec1 && myVec2 && myVec1 != myVec2;
+      break;
+    case 4:
+      ok = GroupLCS->SpinBox_DX->isValid( msg, !IsPreview() );
+      break;
+    default:
+      break;
+    }
   }
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -793,23 +728,23 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects )
 
   switch ( getConstructorId() ) {
   case 0 :
-    anObj = anOper->MakePlanePntVec( myPoint, myDir, getSize() );
+    anObj = anOper->MakePlanePntVec( myPoint.get(), myDir.get(), getSize() );
     res = true;
     break;
   case 1 :
-    anObj = anOper->MakePlaneThreePnt( myPoint1, myPoint2, myPoint3, getSize() );
+    anObj = anOper->MakePlaneThreePnt( myPoint1.get(), myPoint2.get(), myPoint3.get(), getSize() );
     res = true;
     break;
   case 2 :
-    anObj = anOper->MakePlaneFace( myFace, getSize() );
+    anObj = anOper->MakePlaneFace( myFace.get(), getSize() );
     res = true;
     break;
   case 3 :
-    anObj = anOper->MakePlane2Vec( myVec1, myVec2, getSize() );
+    anObj = anOper->MakePlane2Vec( myVec1.get(), myVec2.get(), getSize() );
     res = true;
     break;
   case 4 :
-    anObj = anOper->MakePlaneLCS( myLCS, getSize(), myOriginType );
+    anObj = anOper->MakePlaneLCS( myLCS.get(), getSize(), myOriginType );
     res = true;
     break;
   }
@@ -827,25 +762,27 @@ bool BasicGUI_PlaneDlg::execute( ObjectList& objects )
 //=================================================================================
 void BasicGUI_PlaneDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch ( getConstructorId() ) {
   case 0:
-    objMap[GroupPntDir->LineEdit1->text()] = myPoint;
-    objMap[GroupPntDir->LineEdit2->text()] = myDir;
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myDir.get() );
     break;
   case 1:
-    objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
-    objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
-    objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
+    GEOMBase::PublishSubObject( myPoint3.get() );
     break;
   case 2:
-    objMap[GroupFace->LineEdit1->text()] = myFace;
+    GEOMBase::PublishSubObject( myFace.get() );
     break;
   case 3:
-    objMap[Group2Vec->LineEdit1->text()] = myVec1;
-    objMap[Group2Vec->LineEdit2->text()] = myVec2;
+    GEOMBase::PublishSubObject( myVec1.get() );
+    GEOMBase::PublishSubObject( myVec2.get() );
+    break;
+  case 4:
+    GEOMBase::PublishSubObject( myLCS.get() );
     break;
+ default:
+   break;
   }
-  addSubshapesToFather( objMap );
 }
index 242092823c4f0a58dd5be8ef3ce8462a91eba596..4b1cfbb657c559dc248a5b1b7e8304f1223a847b 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_PLANEDLG_H
 #define BASICGUI_PLANEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel1Spin;
 class DlgRef_2Sel1Spin;
@@ -61,7 +62,7 @@ private:
   int                                myOriginType;
 
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace, myVec1, myVec2, myLCS;
+  GEOM::GeomObjPtr                   myPoint, myDir, myPoint1, myPoint2, myPoint3, myFace, myVec1, myVec2, myLCS;
 
   DlgRef_2Sel1Spin*                  GroupPntDir;
   DlgRef_3Sel1Spin*                  Group3Pnts;
@@ -77,7 +78,6 @@ private slots:
   void                               DeactivateActiveDialog();
   
   void                               SelectionIntoArgument();
-  void                               LineEditReturnPressed();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
   void                               ValueChangedInSpinBox( double );
index f1f65dfb649cd7094d81bd6347cea4abae91ccf2..7810dcdda7031210e1752c2f5971871e6cd1a6cb 100644 (file)
@@ -68,6 +68,8 @@
 #define SPACING 6
 #define MARGIN  9
 
+enum { SelectEdge, SelectWire };
+
 //=================================================================================
 // class    : BasicGUI_PointDlg()
 // purpose  : Constructs a BasicGUI_PointDlg which is a child of 'parent', with the
@@ -150,8 +152,8 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   myBtnPopup = new QMenu(this);
   QIcon ico_line = QIcon( image6 );
   QIcon ico_wire = QIcon( image7 );
-  myActions[myBtnPopup->addAction( ico_line, tr( "GEOM_EDGE" ) )] = 0;
-  myActions[myBtnPopup->addAction( ico_wire, tr( "GEOM_WIRE" ) )] = 1;
+  myActions[myBtnPopup->addAction( ico_line, tr( "GEOM_EDGE" ) )] = SelectEdge;
+  myActions[myBtnPopup->addAction( ico_wire, tr( "GEOM_WIRE" ) )] = SelectWire;
 
   GroupLineIntersection = new DlgRef_2Sel( centralWidget() );
   GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) );
@@ -228,8 +230,11 @@ void BasicGUI_PointDlg::Init()
   GroupLineIntersection->LineEdit1->setEnabled( true );
   GroupLineIntersection->LineEdit2->setEnabled( false );
 
-  myEdge = GEOM::GEOM_Object::_nil();
-  myRefPoint = GEOM::GEOM_Object::_nil();
+  myEdge.nullify();
+  myFace.nullify();
+  myRefPoint.nullify();
+  myLine1.nullify();
+  myLine2.nullify();
   myNeedType = TopAbs_VERTEX;
 
   myEditCurrentArgument = 0;
@@ -273,17 +278,13 @@ void BasicGUI_PointDlg::Init()
   connect( this,           SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
 
   connect( myParamCoord,   SIGNAL( buttonClicked( int ) ), this, SLOT( ClickParamCoord( int ) ) );
-  connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupOnCurve->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
 
-  connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupOnSurface->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+  connect( GroupOnCurve->PushButton1,          SIGNAL( clicked() ),      this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupOnSurface->PushButton1,        SIGNAL( clicked() ),      this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupLineIntersection->PushButton1, SIGNAL( pressed() ),      this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupLineIntersection->PushButton2, SIGNAL( pressed() ),      this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( myBtnPopup, SIGNAL( triggered( QAction* ) ), SLOT( onBtnPopup( QAction* ) ) );
-  connect( GroupLineIntersection->PushButton1, SIGNAL( pressed() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupLineIntersection->PushButton2, SIGNAL( pressed() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupLineIntersection->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupLineIntersection->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+  connect( myBtnPopup, SIGNAL( triggered( QAction* ) ), this, SLOT( onBtnPopup( QAction* ) ) );
 
   connect( GroupOnCurve->SpinBox_DX,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupOnSurface->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
@@ -333,7 +334,8 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   case GEOM_POINT_XYZ:
     {
       globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+      myNeedType = TopAbs_VERTEX;
+      localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 
       GroupRefPoint->hide();
       GroupOnCurve->hide();
@@ -347,11 +349,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   case GEOM_POINT_REF:
     {
       globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+      myNeedType = TopAbs_VERTEX;
+      localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 
       myEditCurrentArgument = GroupRefPoint->LineEdit1;
       myEditCurrentArgument->setText( "" );
-      myRefPoint = GEOM::GEOM_Object::_nil();
+      myRefPoint.nullify();
       GroupRefPoint->PushButton1->setDown(true);
       myParamGroup->hide();
       GroupXYZ->hide();
@@ -365,11 +368,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   case GEOM_POINT_EDGE:
     {
       globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+      myNeedType = TopAbs_EDGE;
+      localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 
       myEditCurrentArgument = GroupOnCurve->LineEdit1;
       myEditCurrentArgument->setText( "" );
-      myEdge = GEOM::GEOM_Object::_nil();
+      myEdge.nullify();
       GroupOnCurve->PushButton1->setDown(true);
       GroupRefPoint->hide();
       GroupLineIntersection->hide();
@@ -385,16 +389,16 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   case GEOM_POINT_INTINT:
     {
       globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
       myNeedType = TopAbs_EDGE;
+      localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 
       myEditCurrentArgument = GroupLineIntersection->LineEdit1;
       GroupLineIntersection->LineEdit1->setText( "" );
       GroupLineIntersection->LineEdit2->setText( "" );
       GroupLineIntersection->LineEdit1->setEnabled( true );
       GroupLineIntersection->LineEdit2->setEnabled( false );
-      myLine1 = GEOM::GEOM_Object::_nil();
-      myLine2 = GEOM::GEOM_Object::_nil();
+      myLine1.nullify();
+      myLine2.nullify();
       GroupLineIntersection->PushButton1->setDown(true);
       GroupLineIntersection->PushButton2->setDown(false);
       myParamGroup->hide();
@@ -409,11 +413,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   case GEOM_POINT_SURF:
     {
       globalSelection(); // close local contexts, if any
-      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+      myNeedType = TopAbs_FACE;
+      localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 
       myEditCurrentArgument = GroupOnSurface->LineEdit1;
       myEditCurrentArgument->setText( "" );
-      myFace = GEOM::GEOM_Object::_nil();
+      myFace.nullify();
       GroupOnSurface->PushButton1->setDown(true);
       GroupRefPoint->hide();
       GroupOnCurve->hide();
@@ -479,137 +484,68 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
     myX->setText( "" );
     myY->setText( "" );
     myZ->setText( "" );
-    myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil();
+    myRefPoint.nullify();
+    myEdge.nullify();
+    myFace.nullify();
   } else if ( id == GEOM_POINT_INTINT ) {
     myEditCurrentArgument->setText( "" );
     if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 )
-      myLine1 = GEOM::GEOM_Object::_nil();
+      myLine1.nullify();
     else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 )
-      myLine2 = GEOM::GEOM_Object::_nil();
+      myLine2.nullify();
   }
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() == 1) {
-    Handle(SALOME_InteractiveObject) anIO = aSelList.First();
-    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
-    if ( !CORBA::is_nil( aSelectedObject ) ) {
-      QString aName = GEOMBase::GetName(aSelectedObject);
-      TopoDS_Shape aShape;
-      if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-        if ( id == GEOM_POINT_XYZ || id == GEOM_POINT_REF)
-          myNeedType = TopAbs_VERTEX;
-        else if ( id == GEOM_POINT_EDGE )
-          myNeedType = TopAbs_EDGE;
-        else if ( id == GEOM_POINT_SURF )
-          myNeedType = TopAbs_FACE;
-
-        TColStd_IndexedMapOfInteger aMap;
-        aSelMgr->GetIndexes(anIO, aMap);
-        if ( aMap.Extent() == 1 ) { // Local Selection
-          int anIndex = aMap( 1 );
-          if ( myNeedType == TopAbs_FACE )
-            aName += QString( ":face_%1" ).arg( anIndex );
-          else if ( myNeedType == TopAbs_WIRE )
-            aName += QString( ":wire_%1" ).arg( anIndex );
-          else if ( myNeedType == TopAbs_EDGE )
-            aName += QString( ":edge_%1" ).arg( anIndex );
-          else  if ( myNeedType == TopAbs_VERTEX )
-            aName += QString( ":vertex_%1" ).arg( anIndex );
-
-          //Find SubShape Object in Father
-          GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-          if ( aFindedObject->_is_nil() ) { // Object not found in study
-            GEOM::GEOM_IShapesOperations_var aShapesOp =
-              getGeomEngine()->GetIShapesOperations(getStudyId());
-            aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-          }
-          else {
-            aSelectedObject = aFindedObject; // get Object from study
-          }
-          GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
-        }
-        else { // Global Selection
-          if ( aShape.ShapeType() != myNeedType ) {
-            aSelectedObject = GEOM::GEOM_Object::_nil();
-           aName = "";
-            if ( id == GEOM_POINT_XYZ ) return;
-          }
-        }
-      }
-
-      if ( aShape.IsNull() || aShape.ShapeType() != myNeedType)
-        return;
-
-      myBusy = true;
-
-      if ( id == GEOM_POINT_XYZ ) {
-        gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
-        GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
-        GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
-        GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
-      }
-      else if ( id == GEOM_POINT_REF ) {
-        myRefPoint = aSelectedObject;
-        GroupRefPoint->LineEdit1->setText( aName );
-      }
-      else if ( id == GEOM_POINT_EDGE ) {
-        myEdge = aSelectedObject;
-        GroupOnCurve->LineEdit1->setText( aName );
-      }
-      else if ( id == GEOM_POINT_INTINT ) {
-        myEditCurrentArgument->setText( aName );
-        if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
-          myLine1 = aSelectedObject;
-          if ( !myLine1->_is_nil() && myLine2->_is_nil() ) {
-            GroupLineIntersection->PushButton2->setMenu( 0 );
-            GroupLineIntersection->PushButton2->click();
-            GroupLineIntersection->PushButton2->setDown(true);
-            GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
-          }
-        }
-        else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
-          myLine2 = aSelectedObject;
-          if ( !myLine2->_is_nil() && myLine1->_is_nil() ) {
-            GroupLineIntersection->PushButton1->setMenu( 0 );
-            GroupLineIntersection->PushButton1->click();
-            GroupLineIntersection->PushButton1->setDown(true);
-            GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
-          }
-        }
+  GEOM::GeomObjPtr aSelectedObject = getSelected( myNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+    myBusy = true;
+    if ( id == GEOM_POINT_XYZ ) {
+      gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
+      GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
+      GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
+      GroupXYZ->SpinBox_DZ->setValue( aPnt.Z() );
+    }
+    else if ( id == GEOM_POINT_REF ) {
+      myRefPoint = aSelectedObject;
+      GroupRefPoint->LineEdit1->setText( aName );
+    }
+    else if ( id == GEOM_POINT_EDGE ) {
+      myEdge = aSelectedObject;
+      GroupOnCurve->LineEdit1->setText( aName );
+    }
+    else if ( id == GEOM_POINT_INTINT ) {
+      myEditCurrentArgument->setText( aName );
+      if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
+       myLine1 = aSelectedObject;
+       if ( myLine1 && !myLine2 ) {
+         GroupLineIntersection->PushButton2->setMenu( 0 );
+         GroupLineIntersection->PushButton2->click();
+         GroupLineIntersection->PushButton2->setDown(true);
+         GroupLineIntersection->PushButton2->setMenu( myBtnPopup );
+       }
       }
-      else if ( id == GEOM_POINT_SURF )
-      {
-        myFace = aSelectedObject;
-        GroupOnSurface->LineEdit1->setText( aName );
+      else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
+       myLine2 = aSelectedObject;
+       if ( myLine2 && !myLine1 ) {
+         GroupLineIntersection->PushButton1->setMenu( 0 );
+         GroupLineIntersection->PushButton1->click();
+         GroupLineIntersection->PushButton1->setDown(true);
+         GroupLineIntersection->PushButton1->setMenu( myBtnPopup );
+       }
       }
-      myBusy = false;
     }
+    else if ( id == GEOM_POINT_SURF ) {
+      myFace = aSelectedObject;
+      GroupOnSurface->LineEdit1->setText( aName );
+    }
+    myBusy = false;
   }
 
   displayPreview();
 }
 
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_PointDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupRefPoint->LineEdit1         ||
-       send == GroupOnCurve->LineEdit1          ||
-       send == GroupLineIntersection->LineEdit1 ||
-       send == GroupLineIntersection->LineEdit2  ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -775,49 +711,45 @@ GEOM::GEOM_IOperations_ptr BasicGUI_PointDlg::createOperation()
 //=================================================================================
 bool BasicGUI_PointDlg::isValid( QString& msg )
 {
-  const int id = getConstructorId();
-  if ( id == GEOM_POINT_XYZ ) {
-    bool ok = true;
-    ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
-    return ok;
-  }
-  else if ( id == GEOM_POINT_REF ) {
-    bool ok = true;
-    ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
-
-    return !myRefPoint->_is_nil() && ok;
-  }
-  else if ( id == GEOM_POINT_EDGE ) {
-    bool ok = true;
+  bool ok = false;
+  switch ( getConstructorId() ) {
+  case GEOM_POINT_XYZ :
+    ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() );
+    break;
+  case GEOM_POINT_REF:
+    ok = GroupRefPoint->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupRefPoint->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupRefPoint->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
+         myRefPoint;
+    break;
+  case GEOM_POINT_EDGE:
     if ( myParamCoord->checkedId() == PARAM_VALUE || myParamCoord->checkedId() == LENGTH_VALUE )
       ok = GroupOnCurve->SpinBox_DX->isValid( msg, !IsPreview() );
-    else {
-      ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-      ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-      ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
-    }
-    return !myEdge->_is_nil() && ok;
-  }
-  else if ( id == GEOM_POINT_INTINT )
-    return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
-  else if ( id == GEOM_POINT_SURF ) {
-    bool ok = true;
-    if ( myParamCoord->checkedId() == PARAM_VALUE ) {
-      ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-      ok = GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    }
-    else {
-      ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-      ok = GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-      ok = GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
-    }
-    return !myFace->_is_nil() && ok;
+    else
+      ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+          GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+          GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() );
+    ok = myEdge && ok;
+    break;
+  case GEOM_POINT_INTINT:
+    ok = myLine1 && myLine2;
+    break;
+  case GEOM_POINT_SURF:
+    if ( myParamCoord->checkedId() == PARAM_VALUE )
+      ok = GroupOnSurface->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+          GroupOnSurface->SpinBox_DY->isValid( msg, !IsPreview() );
+    else
+      ok = GroupXYZ->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+          GroupXYZ->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+          GroupXYZ->SpinBox_DZ->isValid( msg, !IsPreview() );
+    ok = myFace && ok;
+    break;
+  default:
+    break;
   }
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -858,19 +790,19 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
       aParameters << GroupRefPoint->SpinBox_DY->text();
       aParameters << GroupRefPoint->SpinBox_DZ->text();
 
-      anObj = anOper->MakePointWithReference( myRefPoint, dx, dy, dz );
+      anObj = anOper->MakePointWithReference( myRefPoint.get(), dx, dy, dz );
       res = true;
       break;
     }
   case GEOM_POINT_EDGE :
     {
       if ( myParamCoord->checkedId() == PARAM_VALUE ) {
-        anObj = anOper->MakePointOnCurve( myEdge, getParameter() );
+        anObj = anOper->MakePointOnCurve( myEdge.get(), getParameter() );
         aParameters<<GroupOnCurve->SpinBox_DX->text();
       } 
       else if ( myParamCoord->checkedId() == LENGTH_VALUE ) {
        bool reversed = GroupOnCurve->CheckButton1->isChecked();
-       anObj = anOper->MakePointOnCurveByLength( myEdge, getParameter(), reversed );
+       anObj = anOper->MakePointOnCurveByLength( myEdge.get(), getParameter(), reversed );
        
        aParameters<<GroupOnCurve->SpinBox_DX->text();
        aParameters<<QString::number( reversed );
@@ -884,13 +816,13 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
         aParameters << GroupXYZ->SpinBox_DY->text();
         aParameters << GroupXYZ->SpinBox_DZ->text();
 
-        anObj = anOper->MakePointOnCurveByCoord( myEdge, x, y, z );
+        anObj = anOper->MakePointOnCurveByCoord( myEdge.get(), x, y, z );
       }
       res = true;
       break;
     }
   case GEOM_POINT_INTINT :
-    anObj = anOper->MakePointOnLinesIntersection( myLine1, myLine2 );
+    anObj = anOper->MakePointOnLinesIntersection( myLine1.get(), myLine2.get() );
     if ( !anObj->_is_nil() ) {
       QString aName = getNewObjectName();
       if ( anObj->GetShapeType() == GEOM::COMPOUND && aName.startsWith("Vertex") )
@@ -903,7 +835,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
   case GEOM_POINT_SURF :
     {
       if ( myParamCoord->checkedId() == PARAM_VALUE ) {
-        anObj = anOper->MakePointOnSurface( myFace, getUParameter(), getVParameter() );
+        anObj = anOper->MakePointOnSurface( myFace.get(), getUParameter(), getVParameter() );
         aParameters<<GroupOnSurface->SpinBox_DX->text();
         aParameters<<GroupOnSurface->SpinBox_DY->text();
       } else {
@@ -915,7 +847,7 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
         aParameters << GroupXYZ->SpinBox_DY->text();
         aParameters << GroupXYZ->SpinBox_DZ->text();
 
-        anObj = anOper->MakePointOnSurfaceByCoord( myFace, x, y, z );
+        anObj = anOper->MakePointOnSurfaceByCoord( myFace.get(), x, y, z );
       }
       res = true;
       break;
@@ -961,26 +893,23 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
 //=================================================================================
 void BasicGUI_PointDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch ( getConstructorId() ) {
-  case GEOM_POINT_XYZ:
-    break;
   case GEOM_POINT_REF:
-    objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
+    GEOMBase::PublishSubObject( myRefPoint.get() );
     break;
   case GEOM_POINT_EDGE:
-    objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
+    GEOMBase::PublishSubObject( myEdge.get() );
     break;
   case GEOM_POINT_INTINT:
-    objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
-    objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
+    GEOMBase::PublishSubObject( myLine1.get() );
+    GEOMBase::PublishSubObject( myLine2.get() );
     break;
   case GEOM_POINT_SURF:
-    objMap[GroupOnSurface->LineEdit1->text()] = myFace;
+    GEOMBase::PublishSubObject( myFace.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather( objMap );
 }
 
 //=================================================================================
@@ -1041,14 +970,8 @@ void BasicGUI_PointDlg::updateParamCoord(bool theIsUpdate)
 //=================================================================================
 void BasicGUI_PointDlg::onBtnPopup( QAction* a )
 {
-  int index = myActions[a];
   globalSelection(); // close local contexts, if any
-  QString type;
-  if ( index == 0 )
-    myNeedType = TopAbs_EDGE;
-  else 
-    myNeedType = TopAbs_WIRE;
-  
+  myNeedType = myActions[a] == SelectEdge ? TopAbs_EDGE : TopAbs_WIRE;
   localSelection( GEOM::GEOM_Object::_nil(), myNeedType );
 }
 
index fad9a15912215141b1bc081cd28afbda6aff9052..67bfae79b6ae4a28e0ee4ac0d72ea46f616e2f8f 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_POINTDLG_H
 #define BASICGUI_POINTDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 #include <QMap>
 
 class DlgRef_1Sel1Spin1Check;
@@ -76,11 +77,11 @@ private:
   void                               updateParamCoord(bool theIsUpdate);
 
 private:
-  GEOM::GEOM_Object_var              myEdge;
-  GEOM::GEOM_Object_var              myFace;
-  GEOM::GEOM_Object_var              myRefPoint; 
-  GEOM::GEOM_Object_var              myLine1; 
-  GEOM::GEOM_Object_var              myLine2;
+  GEOM::GeomObjPtr                   myEdge;
+  GEOM::GeomObjPtr                   myFace;
+  GEOM::GeomObjPtr                   myRefPoint; 
+  GEOM::GeomObjPtr                   myLine1; 
+  GEOM::GeomObjPtr                   myLine2;
 
   bool                               myBusy;
 
@@ -108,7 +109,6 @@ private slots:
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
   void                               DeactivateActiveDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 50cbb35e4ea5fa4400622d0a52e396cd5410af67..b05f3b0931e6caf2cde81facf9a9d766b7461cb3 100644 (file)
@@ -119,8 +119,8 @@ void BasicGUI_VectorDlg::Init()
     /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
 
-  myPoint1 = GEOM::GEOM_Object::_nil();
-  myPoint2 = GEOM::GEOM_Object::_nil();
+  myPoint1.nullify();
+  myPoint2.nullify();
 
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -150,9 +150,6 @@ void BasicGUI_VectorDlg::Init()
   connect( GroupPoints->PushButton1, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( GroupPoints->PushButton2, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
 
-  connect( GroupPoints->LineEdit1, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-  connect( GroupPoints->LineEdit2, SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
-
   connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupDimensions->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupDimensions->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
@@ -189,8 +186,8 @@ void BasicGUI_VectorDlg::SetDoubleSpinBoxStep( double step )
 void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId )
 {
   disconnect( myGeomGUI->getApp()->selectionMgr(), 0, this, 0 );
-  myPoint1 = GEOM::GEOM_Object::_nil();
-  myPoint2 = GEOM::GEOM_Object::_nil();
+  myPoint1.nullify();
+  myPoint2.nullify();
 
   switch ( constructorId ) {
   case 0:
@@ -272,66 +269,32 @@ bool BasicGUI_VectorDlg::ClickOnApply()
 void BasicGUI_VectorDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
-
+  
   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
   SALOME_ListIO aSelList;
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
     if (myEditCurrentArgument == GroupPoints->LineEdit1)
-      myPoint1 = GEOM::GEOM_Object::_nil();
+      myPoint1.nullify();
     else if (myEditCurrentArgument == GroupPoints->LineEdit2)
-      myPoint2 = GEOM::GEOM_Object::_nil();
+      myPoint2.nullify();
     return;
   }
 
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if (!CORBA::is_nil(aSelectedObject) ) {
-    QString aName = GEOMBase::GetName(aSelectedObject);
-
-    TopoDS_Shape aShape;
-    if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if (aMap.Extent() == 1) { // Local Selection
-        int anIndex = aMap(1);
-        aName += QString(":vertex_%1").arg(anIndex);
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-        
-        if (aFindedObject->_is_nil()) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        }
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if (aShape.ShapeType() != TopAbs_VERTEX) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
-
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     myEditCurrentArgument->setText(aName);
-
-    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
-    }
-
-    if      (myEditCurrentArgument == GroupPoints->LineEdit1) {
+    if (myEditCurrentArgument == GroupPoints->LineEdit1) {
       myPoint1 = aSelectedObject;
-      if (!myPoint1->_is_nil() && myPoint2->_is_nil())
+      if (myPoint1 && !myPoint2)
         GroupPoints->PushButton2->click();
     }
     else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
       myPoint2 = aSelectedObject;
-      if (!myPoint2->_is_nil() && myPoint1->_is_nil())
+      if (myPoint2 && !myPoint1)
         GroupPoints->PushButton1->click();
     }
   }
@@ -367,20 +330,6 @@ void BasicGUI_VectorDlg::SetEditCurrentArgument()
 }
 
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BasicGUI_VectorDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if      ( send == GroupPoints->LineEdit1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
-  else if ( send == GroupPoints->LineEdit2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
-  else return;
-  GEOMBase_Skeleton::LineEditReturnPressed();
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -454,17 +403,16 @@ GEOM::GEOM_IOperations_ptr BasicGUI_VectorDlg::createOperation()
 //=================================================================================
 bool BasicGUI_VectorDlg::isValid( QString& msg )
 {
+  bool ok = false;
   if(getConstructorId() == 0) 
-    return !myPoint1->_is_nil() && !myPoint2->_is_nil();
+    ok = myPoint1 && myPoint2;
   else if(getConstructorId() == 1)
   {
-    bool ok = true;
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
-    return ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() );
   }
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -482,7 +430,7 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
   switch ( getConstructorId() ) {
   case 0 :
     {
-      anObj = anOper->MakeVectorTwoPnt( myPoint1, myPoint2 );
+      anObj = anOper->MakeVectorTwoPnt( myPoint1.get(), myPoint2.get() );
       res = true;
       break;
     }
@@ -518,15 +466,8 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
 //=================================================================================
 void BasicGUI_VectorDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  switch ( getConstructorId() ) {
-  case 0:
-    objMap[GroupPoints->LineEdit1->text()] = myPoint1;
-    objMap[GroupPoints->LineEdit2->text()] = myPoint2;
-    break;
-  case 1:
-    return;
+  if ( getConstructorId() == 0 ) {
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
   }
-  addSubshapesToFather( objMap );
 }
index 1afe50610d9a706ce1d2a00e931d0f0598524a29..5a8ab1260e12a7993d9423be72af45ee4c802fd9 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BASICGUI_VECTORDLG_H
 #define BASICGUI_VECTORDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel;
 class DlgRef_3Spin1Check;
@@ -55,8 +56,8 @@ private:
   void                               Init();
   void                               enterEvent( QEvent* );
 
-  GEOM::GEOM_Object_var              myPoint1;   
-  GEOM::GEOM_Object_var              myPoint2;
+  GEOM::GeomObjPtr                   myPoint1;   
+  GEOM::GeomObjPtr                   myPoint2;
 
   DlgRef_2Sel*                       GroupPoints;
   DlgRef_3Spin1Check*                GroupDimensions;
@@ -68,7 +69,6 @@ private slots:
   void                               ActivateThisDialog();
   void                               DeactivateActiveDialog();
     
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 3817b4e15755e022039dcf7e050a8b4ecf5e5999..0677b115f85893a36e23652ab614985da262c291 100644 (file)
@@ -160,8 +160,12 @@ void BlocksGUI_BlockDlg::ConstructorsClicked (int constructorId)
   myConstructorId = constructorId;
 
   // init fields
-  myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
-  myFace3 = myFace4 = myFace5 = myFace6 = myFace1;
+  myFace1.nullify();
+  myFace2.nullify();
+  myFace3.nullify();
+  myFace4.nullify();
+  myFace5.nullify();
+  myFace6.nullify();
 
   switch (constructorId) {
   case 0:
@@ -228,104 +232,79 @@ bool BlocksGUI_BlockDlg::ClickOnApply()
 void BlocksGUI_BlockDlg::SelectionIntoArgument()
 {
   erasePreview();
-  myEditCurrentArgument->setText("");
-
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == Group2F->LineEdit1) myFace1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group2F->LineEdit2) myFace2 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group6F->LineEdit1) myFace1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group6F->LineEdit2) myFace2 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group6F->LineEdit3) myFace3 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group6F->LineEdit4) myFace4 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group6F->LineEdit5) myFace5 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group6F->LineEdit6) myFace6 = GEOM::GEOM_Object::_nil();
-    return;
-  }
-
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if ( CORBA::is_nil(aSelectedObject) )
-    return;
-
-  QString aName = GEOMBase::GetName(aSelectedObject);
 
-  // Get Selected object if selected subshape
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_FACE );
   TopoDS_Shape aShape;
-  if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-  {
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if (aMap.Extent() == 1) // Local Selection
-    {
-      int anIndex = aMap(1);
-      aName += QString(":face_%1").arg(anIndex);
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study
-      }
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+    myEditCurrentArgument->setText( aName );
+    if ( myEditCurrentArgument == Group2F->LineEdit1 ) {
+      myFace1 = aSelectedObject;
+      if (!myFace2) Group2F->PushButton2->click();
     }
-    else // Global Selection
-    {
-      if (aShape.ShapeType() != TopAbs_FACE) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
+    else if ( myEditCurrentArgument == Group2F->LineEdit2 ) {
+      myFace2 = aSelectedObject;
+      if (!myFace1) Group2F->PushButton1->click();
+    }
+    else if ( myEditCurrentArgument == Group6F->LineEdit1 ) {
+      myFace1 = aSelectedObject;
+      if      (!myFace2) Group6F->PushButton2->click();
+      else if (!myFace3) Group6F->PushButton3->click();
+      else if (!myFace4) Group6F->PushButton4->click();
+      else if (!myFace5) Group6F->PushButton5->click();
+      else if (!myFace6) Group6F->PushButton6->click();
+    }
+    else if ( myEditCurrentArgument == Group6F->LineEdit2 ) {
+      myFace2 = aSelectedObject;
+      if      (!myFace3) Group6F->PushButton3->click();
+      else if (!myFace4) Group6F->PushButton4->click();
+      else if (!myFace5) Group6F->PushButton5->click();
+      else if (!myFace6) Group6F->PushButton6->click();
+      else if (!myFace1) Group6F->PushButton1->click();
+    }
+    else if ( myEditCurrentArgument == Group6F->LineEdit3 ) {
+      myFace3 = aSelectedObject;
+      if      (!myFace4) Group6F->PushButton4->click();
+      else if (!myFace5) Group6F->PushButton5->click();
+      else if (!myFace6) Group6F->PushButton6->click();
+      else if (!myFace1) Group6F->PushButton1->click();
+      else if (!myFace2) Group6F->PushButton2->click();
+    }
+    else if ( myEditCurrentArgument == Group6F->LineEdit4 ) {
+      myFace4 = aSelectedObject;
+      if      (!myFace5) Group6F->PushButton5->click();
+      else if (!myFace6) Group6F->PushButton6->click();
+      else if (!myFace1) Group6F->PushButton1->click();
+      else if (!myFace2) Group6F->PushButton2->click();
+      else if (!myFace3) Group6F->PushButton3->click();
+    }
+    else if ( myEditCurrentArgument == Group6F->LineEdit5 ) {
+      myFace5 = aSelectedObject;
+      if      (!myFace6) Group6F->PushButton6->click();
+      else if (!myFace1) Group6F->PushButton1->click();
+      else if (!myFace2) Group6F->PushButton2->click();
+      else if (!myFace3) Group6F->PushButton3->click();
+      else if (!myFace4) Group6F->PushButton4->click();
+    }
+    else if ( myEditCurrentArgument == Group6F->LineEdit6 ) {
+      myFace6 = aSelectedObject;
+      if      (!myFace1) Group6F->PushButton1->click();
+      else if (!myFace2) Group6F->PushButton2->click();
+      else if (!myFace3) Group6F->PushButton3->click();
+      else if (!myFace4) Group6F->PushButton4->click();
+      else if (!myFace5) Group6F->PushButton5->click();
     }
   }
-
-  myEditCurrentArgument->setText(aName);
-
-  if (myEditCurrentArgument == Group2F->LineEdit1) {
-    myFace1 = aSelectedObject;
-    if (!myFace1->_is_nil() && myFace2->_is_nil())
-      Group2F->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == Group2F->LineEdit2) {
-    myFace2 = aSelectedObject;
-    if (!myFace2->_is_nil() && myFace1->_is_nil())
-      Group2F->PushButton1->click();
-  }
-  else if (myEditCurrentArgument == Group6F->LineEdit1) {
-    myFace1 = aSelectedObject;
-    if (!myFace1->_is_nil() && myFace2->_is_nil())
-      Group6F->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == Group6F->LineEdit2) {
-    myFace2 = aSelectedObject;
-    if (!myFace2->_is_nil() && myFace3->_is_nil())
-      Group6F->PushButton3->click();
-  }
-  else if (myEditCurrentArgument == Group6F->LineEdit3) {
-    myFace3 = aSelectedObject;
-    if (!myFace3->_is_nil() && myFace4->_is_nil())
-      Group6F->PushButton4->click();
-  }
-  else if (myEditCurrentArgument == Group6F->LineEdit4) {
-    myFace4 = aSelectedObject;
-    if (!myFace4->_is_nil() && myFace5->_is_nil())
-      Group6F->PushButton5->click();
-  }
-  else if (myEditCurrentArgument == Group6F->LineEdit5) {
-    myFace5 = aSelectedObject;
-    if (!myFace5->_is_nil() && myFace6->_is_nil())
-      Group6F->PushButton6->click();
-  }
-  else if (myEditCurrentArgument == Group6F->LineEdit6) {
-    myFace6 = aSelectedObject;
-    if (!myFace6->_is_nil() && myFace1->_is_nil())
-      Group6F->PushButton1->click();
+  else {
+    if      (myEditCurrentArgument == Group2F->LineEdit1) myFace1.nullify();
+    else if (myEditCurrentArgument == Group2F->LineEdit2) myFace2.nullify();
+    else if (myEditCurrentArgument == Group6F->LineEdit1) myFace1.nullify();
+    else if (myEditCurrentArgument == Group6F->LineEdit2) myFace2.nullify();
+    else if (myEditCurrentArgument == Group6F->LineEdit3) myFace3.nullify();
+    else if (myEditCurrentArgument == Group6F->LineEdit4) myFace4.nullify();
+    else if (myEditCurrentArgument == Group6F->LineEdit5) myFace5.nullify();
+    else if (myEditCurrentArgument == Group6F->LineEdit6) myFace6.nullify();
+    myEditCurrentArgument->setText( "" );
   }
 
   displayPreview();
@@ -449,17 +428,15 @@ GEOM::GEOM_IOperations_ptr BlocksGUI_BlockDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool BlocksGUI_BlockDlg::isValid (QString&)
+bool BlocksGUI_BlockDlg::isValid(QString&)
 {
   bool ok = false;
   switch (getConstructorId()) {
   case 0:
-    ok = !(myFace1->_is_nil() || myFace2->_is_nil());
+    ok = myFace1 && myFace2;
     break;
   case 1:
-    ok =  !(myFace1->_is_nil() || myFace2->_is_nil() ||
-            myFace3->_is_nil() || myFace4->_is_nil() ||
-            myFace5->_is_nil() || myFace6->_is_nil());
+    ok = myFace1 && myFace2 && myFace3 && myFace4 && myFace5 && myFace6;
     break;
   default:
     break;
@@ -481,16 +458,14 @@ bool BlocksGUI_BlockDlg::execute (ObjectList& objects)
 
   switch (getConstructorId()) {
   case 0:
-    if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2)) {
-      anObj = anOper->MakeHexa2Faces(myFace1, myFace2);
+    if ( myFace1 && myFace2 ) {
+      anObj = anOper->MakeHexa2Faces(myFace1.get(), myFace2.get());
       res = true;
     }
     break;
   case 1:
-    if (!CORBA::is_nil(myFace1) && !CORBA::is_nil(myFace2) &&
-        !CORBA::is_nil(myFace3) && !CORBA::is_nil(myFace4) &&
-        !CORBA::is_nil(myFace5) && !CORBA::is_nil(myFace6)) {
-      anObj = anOper->MakeHexa(myFace1, myFace2, myFace3, myFace4, myFace5, myFace6);
+    if ( myFace1 && myFace2 && myFace3 && myFace4 && myFace5 && myFace6 ) {
+      anObj = anOper->MakeHexa(myFace1.get(), myFace2.get(), myFace3.get(), myFace4.get(), myFace5.get(), myFace6.get());
       res = true;
     }
     break;
@@ -508,21 +483,20 @@ bool BlocksGUI_BlockDlg::execute (ObjectList& objects)
 //=================================================================================
 void BlocksGUI_BlockDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch (getConstructorId()) {
   case 0:
-    objMap[Group2F->LineEdit1->text()] = myFace1;
-    objMap[Group2F->LineEdit2->text()] = myFace2;
+    GEOMBase::PublishSubObject( myFace1.get() );
+    GEOMBase::PublishSubObject( myFace2.get() );
     break;
   case 1:
-    objMap[Group6F->LineEdit1->text()] = myFace1;
-    objMap[Group6F->LineEdit2->text()] = myFace2;
-    objMap[Group6F->LineEdit3->text()] = myFace3;
-    objMap[Group6F->LineEdit4->text()] = myFace4;
-    objMap[Group6F->LineEdit5->text()] = myFace5;
-    objMap[Group6F->LineEdit6->text()] = myFace6;
+    GEOMBase::PublishSubObject( myFace1.get() );
+    GEOMBase::PublishSubObject( myFace2.get() );
+    GEOMBase::PublishSubObject( myFace3.get() );
+    GEOMBase::PublishSubObject( myFace4.get() );
+    GEOMBase::PublishSubObject( myFace5.get() );
+    GEOMBase::PublishSubObject( myFace6.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather(objMap);
 }
index 6351b6ae6a0e89146cf065cdc178388b75ab081d..6dab6f90fd0c326a6f1d478129bd28940267202a 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BLOCKSGUI_BLOCKDLG_H
 #define BLOCKSGUI_BLOCKDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel;
 class DlgRef_6Sel;
@@ -58,8 +59,8 @@ private:
 private:
   int                                myConstructorId;
 
-  GEOM::GEOM_Object_var              myFace1, myFace2;
-  GEOM::GEOM_Object_var              myFace3, myFace4, myFace5, myFace6;
+  GEOM::GeomObjPtr                   myFace1, myFace2;
+  GEOM::GeomObjPtr                   myFace3, myFace4, myFace5, myFace6;
 
   // to initialize the first selection field with a selected object on the dialog creation
   bool                               myInitial;
index 6886ae2bf1a10f68740865216a5a3f8e945e47eb..0085256098f4cbf9374f79295250894936200c3e 100644 (file)
@@ -146,8 +146,10 @@ void BlocksGUI_QuadFaceDlg::ConstructorsClicked (int constructorId)
   myConstructorId = constructorId;
 
   // init fields
-  myShape1 = myShape2 = GEOM::GEOM_Object::_nil();
-  myShape3 = myShape4 = myShape1;
+  myShape1.nullify();
+  myShape2.nullify();
+  myShape3.nullify();
+  myShape4.nullify();
 
   // clear line edits
   QMap<int, QLineEdit*>::iterator anIterLE;
@@ -226,119 +228,104 @@ void BlocksGUI_QuadFaceDlg::SelectionIntoArgument()
     }
   }
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
   TopAbs_ShapeEnum aType = TopAbs_EDGE;
   if (aCurrFocus == Vertex1 || aCurrFocus == Vertex2 ||
       aCurrFocus == Vertex3 || aCurrFocus == Vertex4)
     aType = TopAbs_VERTEX;
 
-  QString aName;
-  GEOM::GEOM_Object_var anObj = GEOM::GEOM_Object::_nil();
-
-  if (aSelList.Extent() == 1) {
-    anObj = GEOMBase::ConvertIOinGEOMObject(aSelList. First() );
-    if ( !anObj->_is_nil() ) {
-      aName = GEOMBase::GetName(anObj);
-
-      // Get Selected object if selected subshape
-      TopoDS_Shape aShape;
-      if (GEOMBase::GetShape(anObj, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-      {
-        TColStd_IndexedMapOfInteger aMap;
-        aSelMgr->GetIndexes(aSelList.First(), aMap);
-        if (aMap.Extent() == 1) // Local Selection
-        {
-          int anIndex = aMap(1);
-          if (aType == TopAbs_VERTEX)
-            aName += QString(":vertex_%1").arg(anIndex);
-          else
-            aName += QString(":edge_%1").arg(anIndex);
-
-          //Find SubShape Object in Father
-          GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(anObj, aName);
-
-          if (aFindedObject->_is_nil()) { // Object not found in study
-            GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-            anObj = aShapesOp->GetSubShape(anObj, anIndex);
-          }
-          else
-            anObj = aFindedObject; // get Object from study
-        }
-        else // Global Selection
-        {
-          if (aShape.ShapeType() != aType) {
-            anObj = GEOM::GEOM_Object::_nil();
-            aName = "";
-          }
-        }
-      }
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+    myEditCurrentArgument->setText( aName );
+    switch (aCurrFocus) {
+      // four vertices
+    case Vertex1:
+      myShape1 = aSelectedObject;
+      if      (!myShape2) mySelBtn[Vertex2]->click();
+      else if (!myShape3) mySelBtn[Vertex3]->click();
+      else if (!myShape4) mySelBtn[Vertex4]->click();
+      break;
+    case Vertex2:
+      myShape2 = aSelectedObject;
+      if      (!myShape3) mySelBtn[Vertex3]->click();
+      else if (!myShape4) mySelBtn[Vertex4]->click();
+      else if (!myShape1) mySelBtn[Vertex1]->click();
+      break;
+    case Vertex3:
+      myShape3 = aSelectedObject;
+      if      (!myShape4) mySelBtn[Vertex4]->click();
+      else if (!myShape1) mySelBtn[Vertex1]->click();
+      else if (!myShape2) mySelBtn[Vertex2]->click();
+      break;
+    case Vertex4:
+      myShape4 = aSelectedObject;
+      if      (!myShape1) mySelBtn[Vertex1]->click();
+      else if (!myShape2) mySelBtn[Vertex2]->click();
+      else if (!myShape3) mySelBtn[Vertex3]->click();
+      break;
+      // two edges
+    case Edge12:
+      myShape1 = aSelectedObject;
+      if      (!myShape2) mySelBtn[Edge22]->click();
+      break;
+    case Edge22:
+      myShape2 = aSelectedObject;
+      if      (!myShape1) mySelBtn[Edge12]->click();
+      break;
+      // four edges
+    case Edge14:
+      myShape1 = aSelectedObject;
+      if      (!myShape2) mySelBtn[Edge24]->click();
+      else if (!myShape3) mySelBtn[Edge34]->click();
+      else if (!myShape4) mySelBtn[Edge44]->click();
+      break;
+    case Edge24:
+      myShape2 = aSelectedObject;
+      if      (!myShape3) mySelBtn[Edge34]->click();
+      else if (!myShape4) mySelBtn[Edge44]->click();
+      else if (!myShape1) mySelBtn[Edge14]->click();
+      break;
+    case Edge34:
+      myShape3 = aSelectedObject;
+      if      (!myShape4) mySelBtn[Edge44]->click();
+      else if (!myShape1) mySelBtn[Edge14]->click();
+      else if (!myShape2) mySelBtn[Edge24]->click();
+      break;
+    case Edge44:
+      myShape4 = aSelectedObject;
+      if      (!myShape1) mySelBtn[Edge14]->click();
+      else if (!myShape2) mySelBtn[Edge24]->click();
+      else if (!myShape3) mySelBtn[Edge34]->click();
+      break;
+    default:
+      break;
     }
   }
-
-  myEditCurrentArgument->setText(aName);
-
-  switch (aCurrFocus) {
-    // four vertices
-  case Vertex1:
-    myShape1 = anObj;
-    if (!myShape1->_is_nil() && myShape2->_is_nil())
-      mySelBtn[Vertex2]->click();
-    break;
-  case Vertex2:
-    myShape2 = anObj;
-    if (!myShape2->_is_nil() && myShape3->_is_nil())
-      mySelBtn[Vertex3]->click();
-    break;
-  case Vertex3:
-    myShape3 = anObj;
-    if (!myShape3->_is_nil() && myShape4->_is_nil())
-      mySelBtn[Vertex4]->click();
-    break;
-  case Vertex4:
-    myShape4 = anObj;
-    if (!myShape4->_is_nil() && myShape1->_is_nil())
-      mySelBtn[Vertex1]->click();
-    break;
-
-    // two edges
-  case Edge12:
-    myShape1 = anObj;
-    if (!myShape1->_is_nil() && myShape2->_is_nil())
-      mySelBtn[Edge22]->click();
-    break;
-  case Edge22:
-    myShape2 = anObj;
-    if (!myShape2->_is_nil() && myShape1->_is_nil())
-      mySelBtn[Edge12]->click();
-    break;
-
-    // four edges
-  case Edge14:
-    myShape1 = anObj;
-    if (!myShape1->_is_nil() && myShape2->_is_nil())
-      mySelBtn[Edge24]->click();
-    break;
-  case Edge24:
-    myShape2 = anObj;
-    if (!myShape2->_is_nil() && myShape3->_is_nil())
-      mySelBtn[Edge34]->click();
-    break;
-  case Edge34:
-    myShape3 = anObj;
-    if (!myShape3->_is_nil() && myShape4->_is_nil())
-      mySelBtn[Edge44]->click();
-    break;
-  case Edge44:
-    myShape4 = anObj;
-    if (!myShape4->_is_nil() && myShape1->_is_nil())
-      mySelBtn[Edge14]->click();
-    break;
-
-  default:
-    break;
+  else {
+    switch (aCurrFocus) {
+    case Vertex1:
+    case Edge12:
+    case Edge14:
+      myShape1.nullify();
+      break;
+    case Vertex2:
+    case Edge22:
+    case Edge24:
+      myShape2.nullify();
+      break;
+    case Vertex3:
+    case Edge34:
+      myShape3.nullify();
+      break;
+    case Vertex4:
+    case Edge44:
+      myShape4.nullify();
+      break;
+    default:
+      break;
+    }
+    myEditCurrentArgument->setText( "" );
   }
 
   displayPreview();
@@ -506,15 +493,13 @@ bool BlocksGUI_QuadFaceDlg::isValid (QString&)
   bool ok = false;
   switch (getConstructorId()) {
   case 0:
-    ok = (!myShape1->_is_nil() && !myShape2->_is_nil() &&
-          !myShape3->_is_nil() && !myShape4->_is_nil());
+    ok = myShape1 && myShape2 && myShape3 && myShape4;
     break;
   case 1:
-    ok = (!myShape1->_is_nil() && !myShape2->_is_nil());
+    ok = myShape1 && myShape2;
     break;
   case 2:
-    ok = (!myShape1->_is_nil() && !myShape2->_is_nil() &&
-          !myShape3->_is_nil() && !myShape4->_is_nil());
+    ok = myShape1 && myShape2 && myShape3 && myShape4;
     break;
   default:
     break;
@@ -536,15 +521,15 @@ bool BlocksGUI_QuadFaceDlg::execute (ObjectList& objects)
 
   switch (getConstructorId()) {
   case 0:
-    anObj = anOper->MakeQuad4Vertices(myShape1, myShape2, myShape3, myShape4);
+    anObj = anOper->MakeQuad4Vertices(myShape1.get(), myShape2.get(), myShape3.get(), myShape4.get());
     res = true;
     break;
   case 1:
-    anObj = anOper->MakeQuad2Edges(myShape1, myShape2);
+    anObj = anOper->MakeQuad2Edges(myShape1.get(), myShape2.get());
     res = true;
     break;
   case 2:
-    anObj = anOper->MakeQuad(myShape1, myShape2, myShape3, myShape4);
+    anObj = anOper->MakeQuad(myShape1.get(), myShape2.get(), myShape3.get(), myShape4.get());
     res = true;
     break;
   default:
@@ -563,25 +548,24 @@ bool BlocksGUI_QuadFaceDlg::execute (ObjectList& objects)
 //=================================================================================
 void BlocksGUI_QuadFaceDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch (getConstructorId()) {
   case 0:
-    objMap[mySelName[Vertex1]->text()] = myShape1;
-    objMap[mySelName[Vertex2]->text()] = myShape2;
-    objMap[mySelName[Vertex3]->text()] = myShape3;
-    objMap[mySelName[Vertex4]->text()] = myShape4;
+    GEOMBase::PublishSubObject( myShape1.get() );
+    GEOMBase::PublishSubObject( myShape2.get() );
+    GEOMBase::PublishSubObject( myShape3.get() );
+    GEOMBase::PublishSubObject( myShape4.get() );
     break;
   case 1:
-    objMap[mySelName[Edge12]->text()] = myShape1;
-    objMap[mySelName[Edge22]->text()] = myShape2;
+    GEOMBase::PublishSubObject( myShape1.get() );
+    GEOMBase::PublishSubObject( myShape2.get() );
     break;
   case 2:
-    objMap[mySelName[Edge14]->text()] = myShape1;
-    objMap[mySelName[Edge24]->text()] = myShape2;
-    objMap[mySelName[Edge34]->text()] = myShape3;
-    objMap[mySelName[Edge44]->text()] = myShape4;
+    GEOMBase::PublishSubObject( myShape1.get() );
+    GEOMBase::PublishSubObject( myShape2.get() );
+    GEOMBase::PublishSubObject( myShape3.get() );
+    GEOMBase::PublishSubObject( myShape4.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather(objMap);
 }
index 4da07d6375dbf90405bee0abb4c95787264c0d18..957dcf23d7e07b27078a1f5bef206912b16ff498 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BLOCKSGUI_QUADFACEDLG_H
 #define BLOCKSGUI_QUADFACEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 #include <QMap>
 
@@ -69,10 +70,10 @@ private:
 private:
   int                                myConstructorId;
 
-  GEOM::GEOM_Object_var              myShape1;
-  GEOM::GEOM_Object_var              myShape2;
-  GEOM::GEOM_Object_var              myShape3;
-  GEOM::GEOM_Object_var              myShape4;
+  GEOM::GeomObjPtr                   myShape1;
+  GEOM::GeomObjPtr                   myShape2;
+  GEOM::GeomObjPtr                   myShape3;
+  GEOM::GeomObjPtr                   myShape4;
 
   // to initialize the first selection field with a selected object on the dialog creation
   bool                               myInitial;
index 768dfdba1dd86af5eb921549a9caffef7fb99ca4..e9c90ce5d27fdcf27eb85bf261fae887ab76e33e 100644 (file)
@@ -135,15 +135,13 @@ void BooleanGUI_Dialog::Init()
 
   myGroup->LineEdit1->setText("");
   myGroup->LineEdit2->setText("");
-  myObject1 = myObject2 = GEOM::GEOM_Object::_nil();
+  myObject1.nullify();
+  myObject2.nullify();
  
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
   connect(buttonApply(), SIGNAL(clicked()), this, SLOT(ClickOnApply()));
 
-  connect(myGroup->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(myGroup->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(myGroup->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(myGroup->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
@@ -198,21 +196,11 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText("");
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == myGroup->LineEdit1) myObject1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2 = GEOM::GEOM_Object::_nil();
-    return;
-  }
-
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if ( GEOMBase::IsShape(aSelectedObject) )
-  {
-    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_SHAPE );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+    myEditCurrentArgument->setText( aName );
 
     // clear selection
     disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
@@ -222,15 +210,19 @@ void BooleanGUI_Dialog::SelectionIntoArgument()
 
     if (myEditCurrentArgument == myGroup->LineEdit1) {
       myObject1 = aSelectedObject;
-      if (myObject2->_is_nil())
+      if (!myObject2)
         myGroup->PushButton2->click();
     }
     else if (myEditCurrentArgument == myGroup->LineEdit2) {
       myObject2 = aSelectedObject;
-      if (myObject1->_is_nil())
+      if (!myObject1)
         myGroup->PushButton1->click();
     }
   }
+  else {
+    if      (myEditCurrentArgument == myGroup->LineEdit1) myObject1.nullify();
+    else if (myEditCurrentArgument == myGroup->LineEdit2) myObject2.nullify();
+  }
 }
 
 //=================================================================================
@@ -261,19 +253,6 @@ void BooleanGUI_Dialog::SetEditCurrentArgument()
   send->setDown(true);
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BooleanGUI_Dialog::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == myGroup->LineEdit1 || send == myGroup->LineEdit2) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -312,12 +291,7 @@ GEOM::GEOM_IOperations_ptr BooleanGUI_Dialog::createOperation()
 //=================================================================================
 bool BooleanGUI_Dialog::isValid (QString&)
 {
-  //Handle(SALOME_InteractiveObject) IO = firstIObject();
-  //GEOM::GEOM_Object_var anObject = GEOMBase::ConvertIOinGEOMObject( IO );
-  //if ( anObject->_is_nil() )
-  //  return false;
-
-  return !CORBA::is_nil(myObject1) && !CORBA::is_nil(myObject2);
+  return myObject1 && myObject2;
 }
 
 //=================================================================================
@@ -329,7 +303,7 @@ bool BooleanGUI_Dialog::execute (ObjectList& objects)
   GEOM::GEOM_Object_var anObj;
 
   GEOM::GEOM_IBooleanOperations_var anOper = GEOM::GEOM_IBooleanOperations::_narrow(getOperation());
-  anObj = anOper->MakeBoolean(myObject1, myObject2, myOperation);
+  anObj = anOper->MakeBoolean(myObject1.get(), myObject2.get(), myOperation);
   if (!anObj->_is_nil())
     objects.push_back(anObj._retn());
 
index b383f7e97b5a924b7238ab642bc8ffed9a923ceb..542658a51eb1e560fd7ea2b914523f2f0dc4e6e5 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BOOLEANGUI_DIALOG_H
 #define BOOLEANGUI_DIALOG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel;
 
@@ -58,8 +59,8 @@ private:
 private:
   int                                myOperation;
   
-  GEOM::GEOM_Object_var              myObject1;
-  GEOM::GEOM_Object_var              myObject2;
+  GEOM::GeomObjPtr                   myObject1;
+  GEOM::GeomObjPtr                   myObject2;
   
   DlgRef_2Sel*                       myGroup;
 
@@ -68,7 +69,6 @@ private slots:
   bool                               ClickOnApply();
   void                               SetEditCurrentArgument();
   void                               SelectionIntoArgument();
-  void                               LineEditReturnPressed();
   void                               ActivateThisDialog();
 };
 
index 24f18c62218978429c9f367a6f76a6ed1570b898..3efc455a38626e0aac798ac6216e7d6f34ffd0e3 100644 (file)
@@ -99,7 +99,7 @@ void BuildGUI_CompoundDlg::Init()
   myEditCurrentArgument = GroupShapes->LineEdit1;
   GroupShapes->LineEdit1->setReadOnly( true );
   
-  myOkShapes = false;
+  myShapes.clear();
 
   mainFrame()->GroupBoxPublish->show();
 
@@ -149,22 +149,13 @@ bool BuildGUI_CompoundDlg::ClickOnApply()
 void BuildGUI_CompoundDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
-  QString aString = ""; /* name of selection */
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
+  myShapes = getSelected( TopAbs_SHAPE, -1 );
 
-  myOkShapes = false;
-  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
-  if ( nbSel == 0 ) 
-    return;
-  if ( nbSel != 1 )
-    aString = QString( "%1_objects").arg( nbSel );
-  
-  GEOMBase::ConvertListOfIOInListOfGO(aSelList, myShapes, true);
-  myEditCurrentArgument->setText( aString );
-  myOkShapes = true;
+  if ( !myShapes.isEmpty() ) {
+    QString aName = myShapes.count() > 1 ? QString( "%1_objects").arg( myShapes.count() ) : GEOMBase::GetName( myShapes[0].get() );
+    myEditCurrentArgument->setText( aName );
+  }
 }
 
 
@@ -223,7 +214,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_CompoundDlg::createOperation()
 //=================================================================================
 bool BuildGUI_CompoundDlg::isValid( QString& )
 {
-  return myOkShapes;
+  return !myShapes.isEmpty();
 }
 
 //=================================================================================
@@ -233,7 +224,13 @@ bool BuildGUI_CompoundDlg::isValid( QString& )
 bool BuildGUI_CompoundDlg::execute( ObjectList& objects )
 {
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
-  GEOM::GEOM_Object_var anObj = anOper->MakeCompound( myShapes );
+
+  GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+  objlist->length( myShapes.count() );
+  for ( int i = 0; i < myShapes.count(); i++ )
+    objlist[i] = myShapes[i].copy();
+
+  GEOM::GEOM_Object_var anObj = anOper->MakeCompound( objlist );
 
   if ( !anObj->_is_nil() )
     objects.push_back( anObj._retn() );
index 8657e64585dbe921d08a641b7c6ca6e46b74d2cc..ffbcd864d81a0bd3628b66e534b6b973a5b96e77 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BUILDGUI_COMPOUNDDLG_H
 #define BUILDGUI_COMPOUNDDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel;
 
@@ -55,8 +56,7 @@ private:
   void                               enterEvent( QEvent* );
   
 private:
-  GEOM::ListOfGO                     myShapes;
-  bool                               myOkShapes;
+  QList<GEOM::GeomObjPtr>            myShapes;
   
   DlgRef_1Sel*                       GroupShapes;
     
index aa02e252dbe8232e24c0c6a310d34e6ca320e9ac..c92ea226a61a76cdffbe77db0b27b015a080fa35 100644 (file)
@@ -119,7 +119,9 @@ BuildGUI_EdgeDlg::~BuildGUI_EdgeDlg()
 void BuildGUI_EdgeDlg::Init()
 {
   // init variables
-  myPoint1 = myPoint2 = myWire = GEOM::GEOM_Object::_nil();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myWire.nullify();
   myEditCurrentArgument = GroupPoints->LineEdit1;
   GroupPoints->PushButton1->setDown(true);
   globalSelection(); // close local contexts, if any
@@ -138,10 +140,6 @@ void BuildGUI_EdgeDlg::Init()
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupWire->PushButton1,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupWire->LineEdit1,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL( currentSelectionChanged() ),
            this, SLOT( SelectionIntoArgument() ) );
 
@@ -192,8 +190,8 @@ void BuildGUI_EdgeDlg::ConstructorsClicked( int constructorId )
       myEditCurrentArgument = GroupPoints->LineEdit1;
       GroupPoints->LineEdit1->setText( "" );
       GroupPoints->LineEdit2->setText( "" );
-      myPoint1 = GEOM::GEOM_Object::_nil();
-      myPoint2 = GEOM::GEOM_Object::_nil();
+      myPoint1.nullify();
+      myPoint2.nullify();
       GroupPoints->PushButton1->setDown(true);
       GroupPoints->PushButton2->setDown(false);
       GroupPoints->LineEdit1->setEnabled(true);
@@ -209,7 +207,7 @@ void BuildGUI_EdgeDlg::ConstructorsClicked( int constructorId )
 
       myEditCurrentArgument = GroupWire->LineEdit1;
       GroupWire->LineEdit1->setText("");
-      myWire = GEOM::GEOM_Object::_nil();
+      myWire.nullify();
       GroupWire->PushButton1->setDown(true);
       GroupWire->LineEdit1->setEnabled(true);
       GroupPoints->hide();
@@ -238,61 +236,31 @@ void BuildGUI_EdgeDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupWire->LineEdit1)   myWire = GEOM::GEOM_Object::_nil();
+    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify();
+    else if (myEditCurrentArgument == GroupWire->LineEdit1)   myWire.nullify();
     displayPreview();
     return;
   }
 
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if ( !aSelectedObject->_is_nil() ) {
-    QString aName = GEOMBase::GetName( aSelectedObject );
-    TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX;
-
-    TopoDS_Shape aShape;
-    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes( aSelList.First(), aMap );
-      if ( aMap.Extent() == 1 ) { // Local Selection
-        int anIndex = aMap( 1 );
-       aName += ( aNeedType == TopAbs_WIRE ? QString( ":wire_%1" ).arg( anIndex ) : QString( ":vertex_%1" ).arg( anIndex ) );
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-        if ( CORBA::is_nil( aFindedObject ) ) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-          aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-        }
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if ( aShape.ShapeType() != aNeedType ) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
-
+  TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupWire->LineEdit1 ? TopAbs_WIRE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
     myEditCurrentArgument->setText( aName );
 
-    if (!aSelectedObject->_is_nil()) { // clear selection if something selected
-      globalSelection();
-      localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
-    }
+    globalSelection();
+    localSelection( GEOM::GEOM_Object::_nil(), aNeedType );
 
     if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
       myPoint1 = aSelectedObject;
-      if ( !myPoint1->_is_nil() && myPoint2->_is_nil() )
+      if ( myPoint1 && !myPoint2 )
         GroupPoints->PushButton2->click();
     }
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
       myPoint2 = aSelectedObject;
-      if ( !myPoint2->_is_nil() && myPoint1->_is_nil() )
+      if ( myPoint2 && !myPoint1 )
         GroupPoints->PushButton1->click();
     }
     else if ( myEditCurrentArgument == GroupWire->LineEdit1 ) {
@@ -332,19 +300,6 @@ void BuildGUI_EdgeDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void BuildGUI_EdgeDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2 || send == GroupWire->LineEdit1 ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -385,13 +340,17 @@ GEOM::GEOM_IOperations_ptr BuildGUI_EdgeDlg::createOperation()
 bool BuildGUI_EdgeDlg::isValid (QString& msg)
 {
   bool ok = false;
-  if ( getConstructorId() == 0 ) {
-    ok = !myPoint1->_is_nil() && !myPoint2->_is_nil();
-  }
-  else {
-    ok = !myWire->_is_nil();
-    ok = ok && GroupWire->SpinBox_DX->isValid( msg, !IsPreview() );
-    ok = ok && GroupWire->SpinBox_DY->isValid( msg, !IsPreview() );
+  switch ( getConstructorId() ) {
+  case 0:
+    ok = myPoint1 && myPoint2;
+    break;
+  case 1:
+    ok = GroupWire->SpinBox_DX->isValid( msg, !IsPreview() ) && 
+         GroupWire->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         myWire;
+    break;
+  default:
+    break;
   }
   return ok;
 }
@@ -410,7 +369,7 @@ bool BuildGUI_EdgeDlg::execute (ObjectList& objects)
   switch ( getConstructorId() ) {
   case 0 :
     {
-      anObj = anOper->MakeEdge( myPoint1, myPoint2 );
+      anObj = anOper->MakeEdge( myPoint1.get(), myPoint2.get() );
       res = true;
       break;
     }
@@ -423,7 +382,7 @@ bool BuildGUI_EdgeDlg::execute (ObjectList& objects)
       aParameters << GroupWire->SpinBox_DX->text();
       aParameters << GroupWire->SpinBox_DY->text();
       
-      anObj = anOper->MakeEdgeWire( myWire, aLinearTolerance, anAngularTolerance );
+      anObj = anOper->MakeEdgeWire( myWire.get(), aLinearTolerance, anAngularTolerance );
       
       if ( !anObj->_is_nil() && !IsPreview() )
        anObj->SetParameters( aParameters.join(":").toLatin1().constData() );
@@ -444,15 +403,15 @@ bool BuildGUI_EdgeDlg::execute (ObjectList& objects)
 //=================================================================================
 void BuildGUI_EdgeDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
   switch ( getConstructorId() ) {
   case 0 :
-    objMap[GroupPoints->LineEdit1->text()] = myPoint1;
-    objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
     break;
   case 1 :
-    objMap[GroupWire->LineEdit1->text()] = myWire;
+    GEOMBase::PublishSubObject( myWire.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather( objMap );
 }
index f6e09236f3e91b46b95f3740cce6210b348530b1..9ead7e356ce8a54db7cdbdda7bba3c2b4c42ccf0 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BUILDGUI_EDGEDLG_H
 #define BUILDGUI_EDGEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel2Spin;
 class DlgRef_2Sel;
@@ -56,8 +57,8 @@ private:
   void                               enterEvent( QEvent* );
   
 private:
-  GEOM::GEOM_Object_var              myPoint1, myPoint2;   /* Points containing the edge */
-  GEOM::GEOM_Object_var              myWire;               /* Wire */
+  GEOM::GeomObjPtr                   myPoint1, myPoint2;   /* Points containing the edge */
+  GEOM::GeomObjPtr                   myWire;               /* Wire */
   
   DlgRef_2Sel*                       GroupPoints;
   DlgRef_1Sel2Spin*                  GroupWire;
@@ -67,7 +68,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
 };
index 8f204e41126ca38c3bb2d905efde026b6fd5acb9..09d682fe2b670e0377b2d7332eb6c63f62fb86f1 100644 (file)
@@ -101,6 +101,7 @@ void BuildGUI_FaceDlg::Init()
   GroupWire->LineEdit1->setReadOnly( true );
 
   GroupWire->CheckButton1->setChecked( true );
+  myWires.clear();
 
   TColStd_MapOfInteger aMap;
   aMap.Add( GEOM_EDGE );
@@ -152,26 +153,15 @@ bool BuildGUI_FaceDlg::ClickOnApply()
 void BuildGUI_FaceDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
-  QString aName;
-  
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
 
-  int aNbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aName);
-  
-  if ( aNbSel < 1) {
-    myWires.length(0);
-    return;
+  QList<TopAbs_ShapeEnum> types;
+  types << TopAbs_EDGE << TopAbs_WIRE;
+  myWires = getSelected( types, -1 );
+
+  if ( !myWires.isEmpty() ) {
+    QString aName = myWires.count() > 1 ? QString( "%1_objects").arg( myWires.count() ) : GEOMBase::GetName( myWires[0].get() );
+    myEditCurrentArgument->setText( aName );
   }
-  
-  GEOMBase::ConvertListOfIOInListOfGO(aSelList, myWires);
-  if ( !myWires.length() )
-    return;
-  if ( aNbSel != 1 )
-    aName = tr( "%1_objects" ).arg( aNbSel );
-  
-  myEditCurrentArgument->setText( aName );
 }
 
 
@@ -238,7 +228,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_FaceDlg::createOperation()
 //=================================================================================
 bool BuildGUI_FaceDlg::isValid( QString& )
 {
-  return ( myWires.length() != 0 );
+  return !myWires.isEmpty();
 }
 
 //=================================================================================
@@ -248,7 +238,13 @@ bool BuildGUI_FaceDlg::isValid( QString& )
 bool BuildGUI_FaceDlg::execute( ObjectList& objects )
 {
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
-  GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( myWires, GroupWire->CheckButton1->isChecked() );
+
+  GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+  objlist->length( myWires.count() );
+  for ( int i = 0; i < myWires.count(); i++ )
+    objlist[i] = myWires[i].copy();
+
+  GEOM::GEOM_Object_var anObj = anOper->MakeFaceWires( objlist.in(), GroupWire->CheckButton1->isChecked() );
 
   if ( !anObj->_is_nil() )
     objects.push_back( anObj._retn() );
index 744a2c503b1210e432608d082bbdf9c389044a3e..8e816cc2a350a71e1ec524b2d4c5627eaf3c68e2 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BUILDGUI_FACEDLG_H
 #define BUILDGUI_FACEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel1Check;
 
@@ -54,7 +55,7 @@ private:
   void                               enterEvent( QEvent* );
   
 private:
-  GEOM::ListOfGO                     myWires;
+  QList<GEOM::GeomObjPtr>            myWires;
   
   DlgRef_1Sel1Check*                 GroupWire;
 
index 3cf46a4717578266d25dadbdeeed595f933d240d..1a6b23f432e5b03f74235db2ecf846dffd162d76 100644 (file)
@@ -101,7 +101,7 @@ void BuildGUI_ShellDlg::Init()
   myEditCurrentArgument = GroupShell->LineEdit1;
   GroupShell->LineEdit1->setReadOnly( true );
   
-  myOkFacesAndShells = false;
+  myFacesAndShells.clear();
   
   TColStd_MapOfInteger aMap;
   aMap.Add( GEOM_SHELL );
@@ -158,25 +158,15 @@ bool BuildGUI_ShellDlg::ClickOnApply()
 void BuildGUI_ShellDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
-  QString aString;
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
+  QList<TopAbs_ShapeEnum> types;
+  types << TopAbs_FACE << TopAbs_SHELL << TopAbs_COMPOUND;
+  myFacesAndShells = getSelected( types, -1 );
 
-  myOkFacesAndShells = false;
-  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString, true);
-  if ( nbSel == 0 )
-    return;
-  if ( nbSel != 1 )
-    aString = QString( "%1_objects ").arg( nbSel );
-
-  GEOMBase::ConvertListOfIOInListOfGO(aSelList, myFacesAndShells, true);
-  if ( !myFacesAndShells.length() )
-    return;
-
-  myEditCurrentArgument->setText( aString );
-  myOkFacesAndShells = true;
+  if ( !myFacesAndShells.isEmpty() ) {
+    QString aName = myFacesAndShells.count() > 1 ? QString( "%1_objects").arg( myFacesAndShells.count() ) : GEOMBase::GetName( myFacesAndShells[0].get() );
+    myEditCurrentArgument->setText( aName );
+  }
 }
 
 
@@ -251,7 +241,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_ShellDlg::createOperation()
 //=================================================================================
 bool BuildGUI_ShellDlg::isValid( QString& )
 {
-  return myOkFacesAndShells;
+  return !myFacesAndShells.isEmpty();
 }
 
 //=================================================================================
@@ -261,7 +251,13 @@ bool BuildGUI_ShellDlg::isValid( QString& )
 bool BuildGUI_ShellDlg::execute( ObjectList& objects )
 {
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
-  GEOM::GEOM_Object_var anObj = anOper->MakeShell( myFacesAndShells );
+
+  GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+  objlist->length( myFacesAndShells.count() );
+  for ( int i = 0; i < myFacesAndShells.count(); i++ )
+    objlist[i] = myFacesAndShells[i].copy();
+
+  GEOM::GEOM_Object_var anObj = anOper->MakeShell( objlist.in() );
 
   if ( !anObj->_is_nil() )
     objects.push_back( anObj._retn() );
index 4e2cc255d1ff44224ac12e57c8d988266ea940f8..81e0f8d9e6133d54ec386ee035ccf4087b78d4e9 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BUILDGUI_SHELLDLG_H
 #define BUILDGUI_SHELLDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel;
 
@@ -54,8 +55,7 @@ private:
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::ListOfGO                     myFacesAndShells;
-  bool                               myOkFacesAndShells;/* to check when arguments is defined */
+  QList<GEOM::GeomObjPtr>            myFacesAndShells;
   
   DlgRef_1Sel*                       GroupShell;
 
index 4f29cfcff4d57ff98c1b62ee77b884c92bc4e1e3..5c6ffb6706d72709f922709bc7b223a085f88593 100644 (file)
@@ -102,8 +102,8 @@ void BuildGUI_SolidDlg::Init()
   GroupSolid->LineEdit1->setReadOnly( true );
   GroupSolid->CheckButton1->setChecked( true );
 
-  myOkShells = false;
-
+  myShells.clear();
+  
   globalSelection( GEOM_SHELL );
 
   /* signals and slots connections */
@@ -137,17 +137,6 @@ void BuildGUI_SolidDlg::ClickOnOk()
 //=================================================================================
 bool BuildGUI_SolidDlg::ClickOnApply()
 {
-  for ( int i = 0, n = myShells.length(); i< n; i++ ) {
-    if ( !isClosed(i)) {
-      QString aName = GEOMBase::GetName( myShells[i] );
-      SUIT_MessageBox::warning( (QWidget*)SUIT_Session::session()->activeApplication()->desktop(),
-                                 QObject::tr("WRN_WARNING"),
-                                 QObject::tr("WRN_SHAPE_UNCLOSED").arg(aName) ,
-                                 QObject::tr("BUT_OK") );
-       return false;
-    }
-  }
-
   if ( !onAccept() )
     return false;
 
@@ -163,25 +152,13 @@ bool BuildGUI_SolidDlg::ClickOnApply()
 void BuildGUI_SolidDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
-  QString aString = "";
-  
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
 
-  myOkShells = false;
-  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString);
-  if ( nbSel == 0 )
-    return;
-  if ( nbSel != 1 )
-    aString = tr( "%1_objects" ).arg( nbSel );
-  
-  GEOMBase::ConvertListOfIOInListOfGO(aSelList, myShells);
-  if ( !myShells.length() )
-    return;
-  
-  myEditCurrentArgument->setText( aString );
-  myOkShells = true;
+  myShells = getSelected( TopAbs_SHELL, -1 );
+
+  if ( !myShells.isEmpty() ) {
+    QString aName = myShells.count() > 1 ? QString( "%1_objects").arg( myShells.count() ) : GEOMBase::GetName( myShells[0].get() );
+    myEditCurrentArgument->setText( aName );
+  }
 }
 
 //=================================================================================
@@ -248,43 +225,51 @@ GEOM::GEOM_IOperations_ptr BuildGUI_SolidDlg::createOperation()
 // function : isValid
 // purpose  :
 //=================================================================================
-bool BuildGUI_SolidDlg::isValid( QString& )
+bool BuildGUI_SolidDlg::isValid( QString& msg )
 {
-  return myOkShells;
+  bool ok = !myShells.isEmpty();
+  for ( int i = 0, n = myShells.count(); i < n && ok; i++ ) {
+    ok = isClosed( myShells[i].get() );
+    if ( !ok )
+      msg = QObject::tr("WRN_SHAPE_UNCLOSED").arg( GEOMBase::GetName( myShells[i].get() ) );
+  }
+  return ok;
 }
 
 //=================================================================================
 // function : isClosed
 // purpose  : Check the object 'i' in myShells list is closed or unclosed
 //=================================================================================
-bool BuildGUI_SolidDlg::isClosed(int i)
+bool BuildGUI_SolidDlg::isClosed( GEOM::GEOM_Object_ptr shell )
 {
-  GEOM::GEOM_Object_var aShape = myShells[i];
+  bool ok = false;
+
   GEOM::GEOM_IKindOfShape::shape_kind aKind;
   GEOM::ListOfLong_var anInts;
   GEOM::ListOfDouble_var aDbls;
 
-  if (aShape->_is_nil()) {
+  if ( !CORBA::is_nil( shell ) ) {
+    GEOM::MeasureOpPtr anOp;
+    anOp.take( myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() ) );
+    
+    // Detect kind of shape and parameters
+    aKind = anOp->KindOfShape(shell, anInts, aDbls);
+    
+    if ( anOp->IsDone() ) {
+      if ( anInts[0] == 1 )
+       ok = true;
+      else if ( anInts[0] == 2 )
+       ok = false;
+    }
+    else {
+      MESSAGE ("KindOfShape Operation is NOT DONE!!!");
+    }
+  }
+  else {
     MESSAGE ("Shape is NULL!!!");
-    return false;
   }
 
-  GEOM::GEOM_IMeasureOperations_var anOp = myGeomGUI->GetGeomGen()->GetIMeasureOperations( getStudyId() );
-
-  // Detect kind of shape and parameters
-  aKind = anOp->KindOfShape(aShape, anInts, aDbls);
-
-  if ( !anOp->IsDone() ) {
-    MESSAGE ("KindOfShape Operation is NOT DONE!!!");
-    return false;
-  }
-  
-  if ( anInts[0] == 1 )
-    return true;
-  else if ( anInts[0] == 2 )
-    return false;
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -293,19 +278,22 @@ bool BuildGUI_SolidDlg::isClosed(int i)
 //=================================================================================
 bool BuildGUI_SolidDlg::execute( ObjectList& objects )
 {
-  bool toCreateSingleSolid = GroupSolid->CheckButton1->isChecked();
-  
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
     
-  if ( toCreateSingleSolid ) {
-    GEOM::GEOM_Object_var anObj = anOper->MakeSolidShells( myShells );
+  if ( GroupSolid->CheckButton1->isChecked() ) {
+    GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+    objlist->length( myShells.count() );
+    for ( int i = 0; i < myShells.count(); i++ )
+      objlist[i] = myShells[i].copy();
+
+    GEOM::GEOM_Object_var anObj = anOper->MakeSolidShells( objlist.in() );
 
     if ( !anObj->_is_nil() )
       objects.push_back( anObj._retn() );
   }
   else {
-    for ( int i = 0, n = myShells.length(); i< n; i++ ) {
-      GEOM::GEOM_Object_var anObj = anOper->MakeSolidShell( myShells[ i ] );
+    for ( int i = 0, n = myShells.count(); i< n; i++ ) {
+      GEOM::GEOM_Object_var anObj = anOper->MakeSolidShell( myShells[ i ].get() );
 
      if ( !anObj->_is_nil() )
        objects.push_back( anObj._retn() );
index c3c58ff6045f52d0fd4b177f0d08e91d9fd6457f..2ce9bcb9659a892c61c5954c6f4762249cb25ef4 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BUILDGUI_SOLIDDLG_H
 #define BUILDGUI_SOLIDDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel1Check;
 
@@ -51,15 +52,13 @@ protected:
 
 private:
   void                               Init();
-  bool                               isClosed(int i);
+  bool                               isClosed( GEOM::GEOM_Object_ptr shell );
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::ListOfGO                     myShells;
-  bool                               myOkShells; /* to check when arguments is defined and
-                                                    all shells are closed */
+  QList<GEOM::GeomObjPtr>            myShells;
 
-  DlgRef_1Sel1Check*                GroupSolid;
+  DlgRef_1Sel1Check*                 GroupSolid;
 
 private slots:
   void                               ClickOnOk();
index bfb66731fab7ef18e717fd73c7a5b3e6c16562e3..bb161e4bcedf4498047d2ea6b78439438dc0be96 100644 (file)
@@ -119,8 +119,8 @@ void BuildGUI_WireDlg::Init()
   GroupArgs->LineEdit1->setReadOnly( true );
   GroupType->RadioButton1->setChecked(true);
   
-  myOkEdgesAndWires = false;
-  
+  myEdgesAndWires.clear();
+
   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
   /* signals and slots connections */
@@ -158,14 +158,12 @@ void BuildGUI_WireDlg::ClickOnOk()
 //=================================================================================
 bool BuildGUI_WireDlg::ClickOnApply()
 {
-  if ( !onAccept() || !myOkEdgesAndWires )
+  if ( !onAccept() )
     return false;
 
   initName();
   TypeButtonClicked();
-  myMapToStudy.clear();
-  myEdgesAndWires.length(0);
-  myOkEdgesAndWires = false;
+  myEdgesAndWires.clear();
   myEditCurrentArgument->setText( "" );
   return true;
 }
@@ -196,82 +194,15 @@ void BuildGUI_WireDlg::TypeButtonClicked()
 void BuildGUI_WireDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText( "" );
-  QString aString = ""; /* name of selection */
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
+  QList<TopAbs_ShapeEnum> types;
+  types << TopAbs_EDGE << TopAbs_WIRE;
+  myEdgesAndWires = getSelected( types, -1 );
 
-  myOkEdgesAndWires = false;
-  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aString);
-
-  if ( nbSel == 0 ) {
-    myMapToStudy.clear();
-    return;
+  if ( !myEdgesAndWires.isEmpty() ) {
+    QString aName = myEdgesAndWires.count() > 1 ? QString( "%1_objects").arg( myEdgesAndWires.count() ) : GEOMBase::GetName( myEdgesAndWires[0].get() );
+    myEditCurrentArgument->setText( aName );
   }
-
-  TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
-  if (GroupType->RadioButton2->isChecked())
-    aNeedType = TopAbs_WIRE;
-
-  std::list<GEOM::GEOM_Object_var> aList; // subshapes list
-  TopoDS_Shape aShape;
-  for (SALOME_ListIteratorOfListIO anIt (aSelList); anIt.More(); anIt.Next()) {
-    TColStd_IndexedMapOfInteger aMap;
-    GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value() );
-    if ( !CORBA::is_nil(aSelectedObject) && GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      aSelMgr->GetIndexes( anIt.Value(), aMap );
-
-      if ( aMap.Extent() > 0 ) { // local selection
-        for (int ind = 1; ind <= aMap.Extent(); ind++) {
-          aString = aSelectedObject->GetName();
-          int anIndex = aMap(ind);
-          if ( aNeedType == TopAbs_EDGE )
-            aString += QString( ":edge_%1" ).arg( anIndex );
-          else
-            aString += QString( ":wire_%1" ).arg( anIndex );
-          
-          //Find SubShape Object in Father
-          GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aString );
-          
-          if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
-            GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-            aList.push_back( aShapesOp->GetSubShape( aSelectedObject, anIndex ) );
-            myMapToStudy[aString] = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-          }
-          else {
-            aList.push_back( aFindedObject ); // get Object from study
-          }
-        }
-      } else { // global selection
-        if ( aShape.ShapeType() == aNeedType ) {
-          GEOMBase::ConvertListOfIOInListOfGO(aSelList,  myEdgesAndWires);
-        } else {
-          aList.clear();
-          myEdgesAndWires.length(0);
-        }
-      }
-    }
-  }
-
-  // convert aList in listofgo
-  if ( aList.size() ) {
-    myEdgesAndWires.length( aList.size()  );
-    int k = 0;
-    for ( std::list<GEOM::GEOM_Object_var>::iterator j = aList.begin(); j != aList.end(); j++ )
-      myEdgesAndWires[k++] = *j;
-  }
-    
-  if ( myEdgesAndWires.length() > 1 )
-    aString = tr( "%1_objects" ).arg( myEdgesAndWires.length() );
-
-  if ( !myEdgesAndWires.length() ) {
-    aString = "";
-    myMapToStudy.clear();
-  }
-
-  myEditCurrentArgument->setText( aString );
-  myOkEdgesAndWires = true;
 }
 
 
@@ -340,8 +271,7 @@ GEOM::GEOM_IOperations_ptr BuildGUI_WireDlg::createOperation()
 //=================================================================================
 bool BuildGUI_WireDlg::isValid (QString& msg)
 {
-  bool ok = GroupArgs->SpinBox_DX->isValid(msg, !IsPreview());
-  return myOkEdgesAndWires && ok;
+  return GroupArgs->SpinBox_DX->isValid(msg, !IsPreview()) && !myEdgesAndWires.isEmpty();
 }
 
 //=================================================================================
@@ -351,7 +281,13 @@ bool BuildGUI_WireDlg::isValid (QString& msg)
 bool BuildGUI_WireDlg::execute (ObjectList& objects)
 {
   GEOM::GEOM_IShapesOperations_var anOper = GEOM::GEOM_IShapesOperations::_narrow( getOperation() );
-  GEOM::GEOM_Object_var anObj = anOper->MakeWire(myEdgesAndWires, GroupArgs->SpinBox_DX->value());
+
+  GEOM::ListOfGO_var objlist = new GEOM::ListOfGO();
+  objlist->length( myEdgesAndWires.count() );
+  for ( int i = 0; i < myEdgesAndWires.count(); i++ )
+    objlist[i] = myEdgesAndWires[i].copy();
+
+  GEOM::GEOM_Object_var anObj = anOper->MakeWire(objlist.in(), GroupArgs->SpinBox_DX->value());
 
   if (!anObj->_is_nil())
     objects.push_back(anObj._retn());
@@ -365,5 +301,6 @@ bool BuildGUI_WireDlg::execute (ObjectList& objects)
 //=================================================================================
 void BuildGUI_WireDlg::addSubshapesToStudy()
 {
-  addSubshapesToFather( myMapToStudy );
+  for ( int i = 0; i < myEdgesAndWires.count(); i++ )
+    GEOMBase::PublishSubObject( myEdgesAndWires[i].get() );
 }
index 2ebe55958b8f4d108e64f3e4c3d77fd2c45a4f08..6aada55b30fd713afada12192b67e4045f152260 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef BUILDGUI_WIREDLG_H
 #define BUILDGUI_WIREDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel1Spin;
 class DlgRef_3Radio;
@@ -56,14 +57,11 @@ private:
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::ListOfGO                     myEdgesAndWires;
-  bool                               myOkEdgesAndWires;   /* to check when arguments is defined */
+  QList<GEOM::GeomObjPtr>            myEdgesAndWires;
   
   DlgRef_1Sel1Spin*                  GroupArgs;
   DlgRef_3Radio*                     GroupType;
 
-  QMap<QString, GEOM::GEOM_Object_var> myMapToStudy;
-
 private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
index 1a8bc880f042b2e919141f91d7a2c5c1c74725db..fc04203fb4d37f17789fe5ef559d9561deda28f3 100644 (file)
@@ -774,13 +774,35 @@ QString GEOMBase::GetName( GEOM::GEOM_Object_ptr object )
 {
   QString name;
   SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
-  CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( object );
-  if ( study && strcmp( IOR.in(), "" ) != 0 ) {
-    _PTR(SObject) aSObj( study->studyDS()->FindObjectIOR( std::string( IOR.in() ) ) );
-    _PTR(GenericAttribute) anAttr;
-    if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) {
-      _PTR(AttributeName) aNameAttr( anAttr );
-      name = aNameAttr->Value().c_str();
+  
+  if ( !CORBA::is_nil( object ) ) {
+    // 1. search if object is already published in the study
+    CORBA::String_var IOR = SalomeApp_Application::orb()->object_to_string( object );
+    if ( study && strcmp( IOR.in(), "" ) != 0 ) {
+      _PTR(SObject) aSObj( study->studyDS()->FindObjectIOR( std::string( IOR.in() ) ) );
+      _PTR(GenericAttribute) anAttr;
+      if ( aSObj && aSObj->FindAttribute( anAttr, "AttributeName") ) {
+       _PTR(AttributeName) aNameAttr( anAttr );
+       name = aNameAttr->Value().c_str();
+      }
+    }
+    
+    // 2. if object is not found in the study, try default name
+    if ( name.isEmpty() ) {
+      if ( object->IsMainShape() ) {
+       name = GetDefaultName( "geomObj" );
+      }
+      else {
+       GEOM::GEOM_Object_var mainShape = object->GetMainShape();
+       if ( !CORBA::is_nil( mainShape  ) ) { 
+         GEOM::ListOfLong_var indices = object->GetSubShapeIndices();
+         if ( indices->length() > 0 ) {
+           TopAbs_ShapeEnum type = (TopAbs_ShapeEnum)( object->GetShapeType() );
+           name = QString( "%1:%2_%3" ).arg( GetName( mainShape.in() ) )
+             .arg( TypeName( type ) ).arg( indices[0] );
+         }
+       }
+      }
     }
   }
 
@@ -795,3 +817,72 @@ bool GEOMBase::IsShape( GEOM::GEOM_Object_ptr object )
 {
   return !object->_is_nil() && object->IsShape();
 }
+
+//=======================================================================
+// function : TypeName()
+// purpose  : Get string representation for the shape type
+//=======================================================================
+QString GEOMBase::TypeName( TopAbs_ShapeEnum type )
+{
+  QString name = "shape";
+  switch( type ) {
+  case TopAbs_COMPSOLID:
+    name = "compsolid"; break;
+  case TopAbs_COMPOUND:
+    name = "compound";  break;
+  case TopAbs_SOLID:
+    name = "solid";     break;
+  case TopAbs_SHELL:
+    name = "shell";     break;
+  case TopAbs_FACE:
+    name = "face";      break;
+  case TopAbs_WIRE:
+    name = "wire";      break;
+  case TopAbs_EDGE:
+    name = "edge";      break;
+  case TopAbs_VERTEX:
+    name = "vertex";    break;
+  default:
+    break;
+  }
+  return name;
+}
+
+//================================================================
+// Function : GetEntry
+// Purpose  : Get study entry for the given object (if it is published)
+//================================================================
+QString GEOMBase::GetEntry( GEOM::GEOM_Object_ptr object )
+{
+  QString entry;
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+  if ( study && !CORBA::is_nil( object ) ) {
+    QString objIOR = GetIORFromObject( object );
+    if ( !objIOR.isEmpty() ) {
+      _PTR(SObject) SO( study->studyDS()->FindObjectIOR( objIOR.toLatin1().constData() ) );
+      if ( SO )
+        entry = SO->GetID().c_str();
+    }
+  }
+  return entry;
+}
+
+//================================================================
+// Function : PublishSubObject
+// Purpose  : Publish sub-shape under the main object
+//================================================================
+void GEOMBase::PublishSubObject( GEOM::GEOM_Object_ptr object )
+{
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+  if ( study && !CORBA::is_nil( object ) ) {
+    _PTR(Study) studyDS = study->studyDS();
+    QString entry = GetEntry( object );
+    GEOM::GEOM_Object_var father = object->GetMainShape();
+    QString fatherEntry = GetEntry( father );
+    if ( entry.isEmpty() && !CORBA::is_nil( father ) && !fatherEntry.isEmpty() ) {
+      QString name = GetName( object );
+      GeometryGUI::GetGeomGen()->AddInStudy( GeometryGUI::ClientStudyToStudy( studyDS ),
+                                            object, name.toLatin1().data(), father.in() );
+    }
+  }
+}
index cce06e65871b09ad1159277b8712c8a61f5db877..13d9ed03571cfab2b0f3e0522d87bf8b3b6ed441 100644 (file)
@@ -122,7 +122,17 @@ public :
   /* Gets name of object */
   static QString      GetName( GEOM::GEOM_Object_ptr object );
 
+  /* Check if object has shape */
   static bool         IsShape( GEOM::GEOM_Object_ptr object );
+
+  /* Get string representation of shape type */
+  static QString      TypeName( TopAbs_ShapeEnum type );
+  
+  /* Get study entry for the given object  */
+  static QString      GetEntry( GEOM::GEOM_Object_ptr object );
+
+  /* Publish sub-shape under the main object */
+  static void         PublishSubObject( GEOM::GEOM_Object_ptr object );
 };
 
 #endif // GEOMBASE_H
index ff06a5709f978e3380ed62cfdeeb743410957c2e..0797816621f60db5dd834ec32321fc4222977612 100755 (executable)
@@ -44,6 +44,7 @@
 #include <LightApp_SelectionMgr.h>
 #include <LightApp_DataOwner.h>
 #include <SalomeApp_Tools.h>
+#include <SALOME_ListIteratorOfListIO.hxx>
 
 #include <SALOME_Prs.h>
 
@@ -52,6 +53,7 @@
 
 #include <TColStd_MapOfInteger.hxx>
 #include <TCollection_AsciiString.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
 
 //To disable automatic genericobj management, the following line should be commented.
 //Otherwise, it should be uncommented. Refer to KERNEL_SRC/src/SALOMEDSImpl/SALOMEDSImpl_AttributeIOR.cxx
@@ -982,11 +984,6 @@ QString GEOMBase_Helper::getPrefix( GEOM::GEOM_Object_ptr theObj ) const
   if ( !myPrefix.isEmpty() || theObj->_is_nil() )
     return myPrefix;
 
-  //TopoDS_Shape aShape;
-  //if ( !GEOMBase::GetShape( theObj, aShape ) )
-  //  return "";
-  //
-  //long aType = aShape.ShapeType();
   GEOM::shape_type aType = theObj->GetShapeType();
 
   switch ( aType )
@@ -1074,6 +1071,43 @@ GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather (GEOM::GEOM_Object_ptr
   return GEOM::GEOM_Object::_nil();
 }
 
+//================================================================
+// Function : findObjectInFather
+// Purpose  : It should return an object if its founded in study or
+//            return Null object if the object is not founded
+//================================================================
+GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather,
+                                                           int theIndex )
+{
+  GEOM::GEOM_Object_var object;
+  bool found = false;
+  
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( SUIT_Session::session()->activeApplication()->activeStudy() );
+  if ( study ) {
+    _PTR(Study) studyDS = study->studyDS();
+    QString IOR = GEOMBase::GetIORFromObject( theFather );
+    _PTR(SObject) sobject( studyDS->FindObjectIOR( IOR.toLatin1().constData() ) );
+    if ( sobject ) {
+      _PTR(ChildIterator) it( studyDS->NewChildIterator( sobject ) );
+      for ( ; it->More() && !found; it->Next() ) {
+       GEOM::GEOM_Object_var cobject = GEOM::GEOM_Object::_narrow( GeometryGUI::ClientSObjectToObject( it->Value() ) );
+       if ( !CORBA::is_nil( cobject ) ) {
+         GEOM::ListOfLong_var indices = cobject->GetSubShapeIndices();
+         int length = indices->length();
+         for ( int i = 0; i < length && !found; i++ ) {
+           if ( indices[i] == theIndex ) {
+             object = cobject;
+             found = true;
+           }
+         }
+       }
+      }
+    }
+  }
+  
+  return object._retn();
+}
+
 //================================================================
 // Function : addSubshapesToStudy
 // Purpose  : Virtual method to add subshapes if needs
@@ -1084,28 +1118,172 @@ void GEOMBase_Helper::addSubshapesToStudy()
 }
 
 //================================================================
-// Function : addSubshapesToFather
-// Purpose  : Method to add Father Subshapes to Study if it`s not exist
+// Function : getSelected
+// Purpose  : Get selected object by specified type
+//
+// Returns valid object if only one object of the specified type is selected
+// (no matter global or local selection is activated). If \a type is TopAbs_SHAPE,
+// geometrical object of any valid type is expected.
+// 
+// \param type type of the object to be obtained from selection
+// \return selected geometrical object or nil object if selection is not satisfactory
+//================================================================
+GEOM::GeomObjPtr GEOMBase_Helper::getSelected( TopAbs_ShapeEnum type )
+{
+  QList<TopAbs_ShapeEnum> types;
+  types << type;
+  return getSelected( types );
+}
+
 //================================================================
-void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap )
+// Function : getSelected
+// Purpose  : Get selected object by specified types
+//
+// Returns valid object if only one object of the specified type is selected
+// (no matter global or local selection is activated). The list of allowed
+// shape types is passed via \a types. If \a types includes TopAbs_SHAPE,
+// geometrical object of any valid type is expected.
+// 
+// \param types list of allowed shape types for the objects to be obtained from selection
+// \return selected geometrical object or nil object if selection is not satisfactory
+//================================================================
+GEOM::GeomObjPtr GEOMBase_Helper::getSelected( const QList<TopAbs_ShapeEnum>& types )
 {
-  //GetStudyDS
-  SalomeApp_Application* app =
-    dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
-  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-  _PTR(Study) aDStudy = appStudy->studyDS();
+  QList<GEOM::GeomObjPtr> selected = getSelected( types, 1 );
+  return selected.count() > 0 ? selected[0] : GEOM::GeomObjPtr();
+}
+
+//================================================================
+// Function : getSelected
+// Purpose  : Get selected object(s) by specified type
+//
+// Returns list of selected objects if selection satisfies specifies selection options.
+// (no matter global or local selection is activated). If \a type is TopAbs_SHAPE,
+// geometrical objects of any valid type are expected.
+//
+// The \a type parameter specifies allowed type of the object(s) being selected.
+// The \a count parameter specifies exact number of the objects to be retrieved from selection.
+// The \a strict parameter specifies policy being applied to the selection. 
+// If \a count < 0, then any number of the selected objects is valid (including 0).
+// In this case, if \a strict is \c true (default), all selected objects should satisfy
+// the specified \a type.
+// If \a count > 0, only specified number of the objects is retrieved from the selection.
+// In this case, if \a strict is \c true (default), function returns empty list if total number of selected
+// objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false),
+// function returns valid list of objects if at least \a count objects satisfy specified \a type.
+// 
+// \param type type of the object(s) to be obtained from selection
+// \param count number of items to be retrieved from selection
+// \param strict selection policy
+// \return list of selected geometrical objects or empty list if selection is not satisfactory
+//================================================================
+QList<GEOM::GeomObjPtr> GEOMBase_Helper::getSelected( TopAbs_ShapeEnum type, int count, bool strict )
+{
+  QList<TopAbs_ShapeEnum> types;
+  types << type;
+  return getSelected( types, count, strict );
+}
+
+static bool typeInList( TopAbs_ShapeEnum type, const QList<TopAbs_ShapeEnum>& types )
+{
+  bool ok = false;
+  for ( int i = 0; i < types.count() && !ok; i++ )
+    ok = types[i] == TopAbs_SHAPE || types[i] == type;
+  return ok;
+}
+
+//================================================================
+// Function : getSelected
+// Purpose  : Get selected objects by specified types
+//
+// Returns list of selected objects if selection satisfies specifies selection options.
+// (no matter global or local selection is activated). If \a types includes TopAbs_SHAPE,
+// geometrical objects of any valid type are expected.
+//
+// The \a types parameter specifies allowed types of the object(s) being selected.
+// The \a count parameter specifies exact number of the objects to be retrieved from selection.
+// The \a strict parameter specifies policy being applied to the selection. 
+// If \a count < 0, then any number of the selected objects is valid (including 0).
+// In this case, if \a strict is \c true (default), all selected objects should satisfy
+// the specified \a type.
+// If \a count > 0, only specified number of the objects is retrieved from the selection.
+// In this case, if \a strict is \c true (default), function returns empty list if total number of selected
+// objects does not correspond to the \a count parameter. Otherwise (if \a strict is \c false),
+// function returns valid list of objects if at least \a count objects satisfy specified \a type.
+// 
+// \param types list of allowed shape types for the objects to be obtained from selection
+// \param count number of items to be retrieved from selection
+// \param strict selection policy
+// \return list of selected geometrical objects or empty list if selection is not satisfactory
+//================================================================
+QList<GEOM::GeomObjPtr> GEOMBase_Helper::getSelected( const QList<TopAbs_ShapeEnum>& types, int count, bool strict )
+{
+  SUIT_Session* session = SUIT_Session::session();
+  QList<GEOM::GeomObjPtr> result;
 
-  for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ ) {
-    GEOM::GEOM_Object_var aFatherObj = it.value()->GetMainShape();
-    if ( !aFatherObj->_is_nil() ) {
-      QString aFatherEntry = getEntry( aFatherObj );
-      if ( aFatherEntry != "") { // additional checking that object is valid 0020598 EDF 1191
-       GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key().toLatin1().data() );
-       //Add Object to study if its not exist
-       if ( aFindedObject->_is_nil() )
-         GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
-                                               it.value(), it.key().toLatin1().data(), aFatherObj );
+  SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>( session->activeApplication() );
+  if ( app ) {
+    LightApp_SelectionMgr* selMgr = app->selectionMgr();
+    if ( selMgr ) {
+      SALOME_ListIO selected;
+      selMgr->selectedObjects( selected );
+      SALOME_ListIteratorOfListIO it( selected );
+      bool stopped = false;
+      for ( ; it.More() && !stopped; it.Next() ) {
+       Handle(SALOME_InteractiveObject) IO = it.Value();
+       GEOM::GeomObjPtr object = GEOMBase::ConvertIOinGEOMObject( IO );
+       if ( object ) {
+         TColStd_IndexedMapOfInteger subShapes;
+         selMgr->GetIndexes( IO, subShapes );
+         int nbSubShapes = subShapes.Extent();
+         if ( nbSubShapes == 0 ) {
+           // global selection
+           if ( typeInList( (TopAbs_ShapeEnum)(object->GetShapeType()), types ) ) {
+             result << object;
+             if ( count > 0 ) {
+               if ( strict && result.count() > count ) {
+                 result.clear();
+                 stopped = true;
+               }
+               else if ( !strict && result.count() == count )
+                 stopped = true;
+             }
+           }
+           else if ( strict ) {
+             result.clear();
+             stopped = true;
+           }
+         }
+         else {
+           // local selection
+           for ( int i = 1; i <= nbSubShapes && !stopped; i++ ) {
+             int idx = subShapes( i );
+             GEOM::GeomObjPtr subShape = findObjectInFather( object.get(), idx );
+             if ( !subShape ) {
+               // sub-shape is not yet published in the study
+               GEOM::ShapesOpPtr shapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+               subShape.take( shapesOp->GetSubShape( object.get(), idx ) ); // take ownership!
+             }
+             if ( typeInList( (TopAbs_ShapeEnum)(subShape->GetShapeType()), types ) ) {
+               result << subShape;
+               if ( count > 0 ) {
+                 if ( strict && result.count() > count ) {
+                   result.clear();
+                   stopped = true;
+                 }
+                 else if ( !strict && result.count() == count )
+                   stopped = true;
+               }
+             }
+             else if ( strict ) {
+               result.clear();
+               stopped = true;
+             }
+           }
+         }
+       }
       }
     }
   }
+  return result;
 }
index 0a3fc2914fd827aa7bcd98a97295a41142aeec7e..4faf7b88c163c569b073fffa7d00cdf58dec98e9 100755 (executable)
@@ -28,6 +28,7 @@
 #define GEOMBASE_HELPER_H
 
 #include "GEOM_GEOMBase.hxx"
+#include "GEOM_GenericObjPtr.h"
 
 #include <GEOM_Displayer.h>
 #include <SALOME_ListIO.hxx>
@@ -166,9 +167,13 @@ protected:
   virtual void addSubshapesToStudy();
 
   GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, const QString& theName );
-  //This Metod to find SubObject in theFather Object by Name (theName)
+  GEOM::GEOM_Object_ptr findObjectInFather( GEOM::GEOM_Object_ptr theFather, int theIndex );
+  // These methods are used to find published sub-object (sub-shape) in the parent object (main shape)
 
-  void addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap );
+  GEOM::GeomObjPtr        getSelected( TopAbs_ShapeEnum type );
+  GEOM::GeomObjPtr        getSelected( const QList<TopAbs_ShapeEnum>& types );
+  QList<GEOM::GeomObjPtr> getSelected( TopAbs_ShapeEnum type, int count, bool strict = true );
+  QList<GEOM::GeomObjPtr> getSelected( const QList<TopAbs_ShapeEnum>& types, int count, bool strict = true );
 
   void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
   bool IsPreview() {return isPreview;}
diff --git a/src/GEOMBase/GEOM_GenericObjPtr.cxx b/src/GEOMBase/GEOM_GenericObjPtr.cxx
new file mode 100644 (file)
index 0000000..649cad4
--- /dev/null
@@ -0,0 +1,33 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  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.
+//
+//  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   : GEOM_GenericObjPtr.cxx
+//  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#include "GEOM_GenericObjPtr.h"
+
+namespace GEOM
+{
+  template<> bool GenericObjPtr<GEOM::GEOM_Object>::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight )
+  {
+    return !CORBA::is_nil( theLeft ) && !CORBA::is_nil( theRight ) && theLeft->IsSame( theRight );
+  }
+}
diff --git a/src/GEOMBase/GEOM_GenericObjPtr.h b/src/GEOMBase/GEOM_GenericObjPtr.h
new file mode 100644 (file)
index 0000000..61d0179
--- /dev/null
@@ -0,0 +1,234 @@
+//  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+//
+//  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.
+//
+//  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   : GEOM_GenericObjPtr.h
+//  Author : Vadim SANDLER, Open CASCADE S.A.S. (vadim.sandler@opencascade.com)
+
+#ifndef GEOM_GenericObjPtr_H
+#define GEOM_GenericObjPtr_H
+
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(GEOM_Gen)
+
+namespace GEOM
+{
+  /*!
+    \class GenericObjPtr
+    \brief A smart pointer for the SALOME GenericObj interface.
+
+    This class can be used in conjunction with the references to the CORBA objects which
+    interfaces are inherited from the SALOME::GenericObj CORBA interface.
+
+    The smart pointer class automatically invokes Register() / Destroy() functions of th
+    interface in order to prevent memory leaks and other such problems caused by improper
+    usage of the CORBA references.
+
+    Smart pointers can be easily copied, stored within class as data members, passed to the
+    functions requiring native CORBA reference as parameters, etc.
+
+    Usage:
+    - If you want to assign the smart pointer to the CORBA _var type variable, use copy()
+    function to make a copy of the stored CORBA object. Otherwise you might cause Segmentation
+    Fault error.
+    - To pass the smart pointer to the function that requires CORBA _ptr type parameter,
+    use get() function.
+    - If you want to take an ownership on the CORBA object, use take() function.
+    In case of SALOME Generic object this is useful when some function returns newly created
+    object that should be removed by the caller as soon as the object is no more required.
+    For example, function GetSubShape() of the GEOM_IShapesOperation interface always creates
+    new servant object and returns new object reference to it. If the object is not published
+    in the study, it has to be destroyed and the coresponding servant should be deleted.
+    
+    Examples:
+    \code
+    typedef GEOM::GenericObjPtr<MyInterface> MyIPtr;
+    void MyInterface_ptr foo();
+    void MyInterface_ptr bar( MyInterface_ptr p );
+
+    MyIPtr v1;                       // create empty (nil) pointer
+    MyIPtr v2 = foo();               // get some CORBA reference and store it within the smart pointer
+    v1 = v2;                         // copy smart pointer (reference counter is incremented)
+    v2 = bar( v1.get() );            // pass smart pointer to the function
+    MyInterface_var var = v2.copy(); // initialize _var variable with the smart pointer contents
+    v1.take( foo() );                // take ownership on the newly created object
+    \endcode
+   */
+  
+  template <typename TInterface> class GenericObjPtr
+  {
+    typedef typename TInterface::_var_type TInterfaceVar;
+    typedef typename TInterface::_ptr_type TInterfacePtr;
+    
+  private:
+    TInterfaceVar myObject;
+
+  private:
+    //! Increment counter for the object.
+    void Register()
+    {
+      if ( !CORBA::is_nil( this->myObject ) )
+       this->myObject->Register();
+    }
+
+    //! Decrement counter for the object.
+    void Destroy()
+    {
+      if ( !CORBA::is_nil( this->myObject ) ) {
+       this->myObject->Destroy();
+       this->myObject = TInterface::_nil();
+      }
+    }
+      
+  public:
+    //! Initialize pointer to nil generic object reference.
+    GenericObjPtr()
+    {}
+    
+    //! Initialize pointer to the given generic object reference.
+    GenericObjPtr( TInterfacePtr theObject )
+    {
+      this->myObject = TInterface::_duplicate( theObject );
+      this->Register();
+    }
+    
+    //! Initialize pointer with a new reference to the same object referenced by given pointer.
+    GenericObjPtr( const GenericObjPtr& thePointer )
+    {
+      this->myObject = thePointer.myObject;
+      this->Register();
+    }
+    
+    //! Destroy pointer and remove the reference to the object.
+    ~GenericObjPtr()
+    {
+      this->Destroy();
+    }
+    
+    //! Assign object to reference and remove reference to an old object.
+    GenericObjPtr& operator=( TInterfacePtr theObject )
+    {
+      this->Destroy();
+      this->myObject = TInterface::_duplicate( theObject );
+      this->Register();
+      return *this;
+    }
+
+    //! Assign object to reference and remove reference to an old object.
+    GenericObjPtr& operator=( const GenericObjPtr& thePointer )
+    {
+      this->Destroy();
+      this->myObject = thePointer.myObject;
+      this->Register();
+      return *this;
+    }
+
+    static bool isSame( TInterfacePtr theLeft, TInterfacePtr theRight )
+    {
+      return theLeft->_is_equivalent( theRight );
+    }
+
+    //! Check equivalence
+    bool operator==( TInterfacePtr theObject )
+    {
+      return isSame( this->myObject, theObject );
+    }
+
+    //! Check equivalence
+    bool operator==( const GenericObjPtr& thePointer )
+    {
+      return isSame( this->myObject, thePointer.get() );;
+    }
+
+    //! Check difference
+    bool operator!=( TInterfacePtr theObject )
+    {
+      return !isSame( this->myObject, theObject );
+    }
+
+    //! Check difference
+    bool operator!=( const GenericObjPtr& thePointer )
+    {
+      return !isSame( this->myObject, thePointer.get() );;
+    }
+
+    //! Provides normal pointer target member access using operator ->.
+    TInterfacePtr operator->() const
+    {
+      return this->get();
+    }
+
+    //! Check validity of the pointer.
+    operator bool() const
+    {
+       return !this->isNull();
+    }
+
+    //! Initialize pointer to the given generic object reference and take ownership on it.
+    void take( TInterfacePtr theObject )
+    {
+      this->Destroy();
+      this->myObject = TInterface::_duplicate( theObject );
+    }
+
+    //! Get the contained object.
+    TInterfacePtr get() const
+    {
+      return this->myObject;
+    }
+
+    //! Make the copy of the contained object and return it (caller becomes owner of the CORBA reference).
+    TInterfacePtr copy() const
+    {
+      return TInterface::_duplicate( this->myObject );
+    }
+    
+    //! Check if pointer is null.
+    bool isNull() const
+    {
+      return CORBA::is_nil( this->myObject );
+    }
+
+    //! Nullify pointer.
+    void nullify()
+    {
+      this->Destroy();
+    }
+  };
+  
+  typedef GenericObjPtr<GEOM::GEOM_Object>               GeomObjPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IBasicOperations>     BasicOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_ITransformOperations> TransformOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_I3DPrimOperations>    I3DPrimOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IShapesOperations>    ShapesOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IBlocksOperations>    BlocksOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IBooleanOperations>   BooleanOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_ICurvesOperations>    CurvesOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_ILocalOperations>     LocalOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IHealingOperations>   HealingOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IInsertOperations>    InsertOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IMeasureOperations>   MeasureOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IGroupOperations>     GroupOpPtr;
+  typedef GenericObjPtr<GEOM::GEOM_IAdvancedOperations>  AdvancedOpPtr;
+
+  template<> bool GenericObjPtr<GEOM::GEOM_Object>::isSame( GEOM::GEOM_Object_ptr theLeft, GEOM::GEOM_Object_ptr theRight );
+}
+
+#endif // GEOM_GenericObjPtr_H
index 9d45bc750a557c86b0636b7cb11d402409d0e41f..c5cbe96c3911269d411f0ccf7ed96a43821e11d1 100644 (file)
@@ -33,13 +33,15 @@ salomeinclude_HEADERS =             \
        GEOMBase_Skeleton.h     \
        GEOMBase_Helper.h       \
        GEOM_Operation.h        \
-       GEOM_GEOMBase.hxx
+       GEOM_GEOMBase.hxx       \
+       GEOM_GenericObjPtr.h
 
 dist_libGEOMBase_la_SOURCES =          \
        GEOMBase.cxx                    \
        GEOMBase_Skeleton.cxx           \
        GEOMBase_Helper.cxx             \
-       GEOM_Operation.cxx
+       GEOM_Operation.cxx              \
+       GEOM_GenericObjPtr.cxx
 
 MOC_FILES =                            \
        GEOMBase_Skeleton_moc.cxx
index 930aedc657482fb0d82c01c7d69b39dcc8ca2022..7223d4b1d35ff3a620d0754aa14c9bbaefb6a85c 100644 (file)
@@ -105,15 +105,6 @@ void GenerationGUI_FillingDlg::Init()
   myEditCurrentArgument = GroupPoints->LineEdit1;
   GroupPoints->LineEdit1->setReadOnly( true );
 
-  myMinDeg = 2;
-  myMaxDeg = 5;
-  myTol3D = 0.0001;
-  myTol2D = 0.0001;
-  myNbIter = 0;
-  myMethod = 0;
-  myIsApprox = false;
-  myOkCompound = false;
-
   globalSelection( GEOM_COMPOUND );
 
   int SpecificStep1 = 1;
@@ -125,11 +116,11 @@ void GenerationGUI_FillingDlg::Init()
   initSpinBox( GroupPoints->SpinBox4, 1, MAX_NUMBER,  SpecificStep1 );
   initSpinBox( GroupPoints->SpinBox5, 0.00001, 10000.0, SpecificStep2, "len_tol_precision" );
 
-  GroupPoints->SpinBox1->setValue( myMinDeg );
-  GroupPoints->SpinBox2->setValue( myTol2D );
-  GroupPoints->SpinBox3->setValue( myNbIter );
-  GroupPoints->SpinBox4->setValue( myMaxDeg );
-  GroupPoints->SpinBox5->setValue( myTol3D );
+  GroupPoints->SpinBox1->setValue( 2 );
+  GroupPoints->SpinBox2->setValue( 0.0001 );
+  GroupPoints->SpinBox3->setValue( 0 );
+  GroupPoints->SpinBox4->setValue( 5 );
+  GroupPoints->SpinBox5->setValue( 0.0001 );
 
   GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_DEFAULT"));
   GroupPoints->ComboBox1->addItem(tr("GEOM_FILLING_USEORI"));
@@ -140,7 +131,6 @@ void GenerationGUI_FillingDlg::Init()
   connect( buttonApply(), SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
 
   connect( GroupPoints->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupPoints->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
 
   connect( GroupPoints->ComboBox1, SIGNAL(activated(int)), this, SLOT(MethodChanged()));
 
@@ -208,37 +198,19 @@ void GenerationGUI_FillingDlg::SelectionIntoArgument()
   erasePreview();
   myEditCurrentArgument->setText("");
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() != 1) {
-    if (myEditCurrentArgument == GroupPoints->LineEdit1)
-      myOkCompound = false;
-    return;
-  }
-
-  // nbSel == 1
-  GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if ( CORBA::is_nil( aSelectedObject ) )
-    return;
-
   if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    TopoDS_Shape S;
-    myOkCompound = false;
-
-    if (GEOMBase::GetShape(aSelectedObject, S) && S.ShapeType() == TopAbs_COMPOUND) {
-      // myCompound should be a compound of edges
-      for (TopoDS_Iterator it (S); it.More(); it.Next())
-        if ( it.Value().ShapeType() != TopAbs_EDGE && 
-             it.Value().ShapeType() != TopAbs_WIRE )
-          return;
-      myCompound = aSelectedObject;
-      myOkCompound = true;
+    myCompound = getSelected( TopAbs_COMPOUND );
+    if ( myCompound ) {
+      if ( myCompound->GetMaxShapeType() < GEOM::WIRE || myCompound->GetMinShapeType() > GEOM::EDGE ) {
+       myCompound.nullify();
+      }
+      else {
+       QString aName = GEOMBase::GetName( myCompound.get() );
+       myEditCurrentArgument->setText( aName );
+      }
     }
   }
 
-  myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
   displayPreview();
 }
 
@@ -260,20 +232,6 @@ void GenerationGUI_FillingDlg::SetEditCurrentArgument()
 }
 
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void GenerationGUI_FillingDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupPoints->LineEdit1 ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -305,19 +263,6 @@ void GenerationGUI_FillingDlg::enterEvent( QEvent* )
 //=================================================================================
 void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue )
 {
-  QObject* send = (QObject*)sender();
-
-  if ( send == GroupPoints->SpinBox1 )
-    myMinDeg = int( newValue );
-  else if ( send == GroupPoints->SpinBox2 )
-    myTol2D = newValue;
-  else if ( send == GroupPoints->SpinBox3 )
-    myNbIter = int(newValue);
-  else if ( send == GroupPoints->SpinBox4 )
-    myMaxDeg = int(newValue);
-  else if ( send == GroupPoints->SpinBox5 )
-    myTol3D = newValue;
-
   displayPreview();
 }
 
@@ -327,7 +272,6 @@ void GenerationGUI_FillingDlg::ValueChangedInSpinBox( double newValue )
 //=================================================================================
 void GenerationGUI_FillingDlg::MethodChanged()
 {
-  myMethod = GroupPoints->ComboBox1->currentIndex();
   displayPreview();
 }
 
@@ -337,7 +281,6 @@ void GenerationGUI_FillingDlg::MethodChanged()
 //=================================================================================
 void GenerationGUI_FillingDlg::ApproxChanged()
 {
-  myIsApprox = GroupPoints->CheckBox1->isChecked();
   displayPreview();
 }
 
@@ -357,14 +300,13 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_FillingDlg::createOperation()
 //=================================================================================
 bool GenerationGUI_FillingDlg::isValid( QString& msg )
 {
-  bool ok = true;
-  ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) && ok;
-  ok = GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) && ok;
-  ok = GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) && ok;
-  ok = GroupPoints->SpinBox4->isValid( msg, !IsPreview() ) && ok;
-  ok = GroupPoints->SpinBox5->isValid( msg, !IsPreview() ) && ok;
-
-  return myOkCompound > 0 && ok;
+  bool ok = GroupPoints->SpinBox1->isValid( msg, !IsPreview() ) &&
+            GroupPoints->SpinBox2->isValid( msg, !IsPreview() ) &&
+            GroupPoints->SpinBox3->isValid( msg, !IsPreview() ) &&
+            GroupPoints->SpinBox4->isValid( msg, !IsPreview() ) &&
+            GroupPoints->SpinBox5->isValid( msg, !IsPreview() ) &&
+            myCompound;
+  return ok;
 }
 
 //=================================================================================
@@ -386,8 +328,14 @@ bool GenerationGUI_FillingDlg::execute( ObjectList& objects )
   }
 
   GEOM::GEOM_Object_var anObj =
-    anOper->MakeFilling( myCompound, myMinDeg, myMaxDeg, myTol2D, myTol3D,
-                         myNbIter, aMethod, myIsApprox );
+    anOper->MakeFilling( myCompound.get(), 
+                        GroupPoints->SpinBox1->value(), 
+                        GroupPoints->SpinBox4->value(), 
+                        GroupPoints->SpinBox2->value(),
+                        GroupPoints->SpinBox5->value(),
+                         GroupPoints->SpinBox3->value(), 
+                        aMethod,
+                        GroupPoints->CheckBox1->isChecked() );
   if ( !anObj->_is_nil() )
   {
     if ( !IsPreview() )
index a6ebd66a91cae51ed4b91f4adddbfcad2773d3b2..5d73962f7b82a488087cf0f72df077f566d79bc0 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef GENERATIONGUI_FILLINGDLG_H
 #define GENERATIONGUI_FILLINGDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel5Spin1Check;
 
@@ -54,23 +55,13 @@ private:
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::GEOM_Object_var              myCompound; /* compound of curves */
-  Standard_Integer                   myMinDeg;
-  Standard_Integer                   myMaxDeg;
-  Standard_Real                      myTol3D;
-  Standard_Real                      myTol2D;
-  Standard_Integer                   myNbIter;
-  bool                               myIsApprox;
-  int                                myMethod;
-  bool                               myOkCompound; /* to check when curv. compound is defined */
-
+  GEOM::GeomObjPtr                   myCompound; /* compound of curves */
   DlgRef_1Sel5Spin1Check*            GroupPoints;
     
 private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox( double );
index ca440e62d887c9c7e1f56fd04a4266d7dc06ecbe..1b75a21ab66ba4bc42b16fee82876a0e0b0e3cfa 100644 (file)
@@ -114,8 +114,8 @@ void GenerationGUI_PipeDlg::Init()
   GroupPoints->LineEdit1->setText("");
   GroupPoints->LineEdit2->setText("");
   GroupPoints->LineEdit3->setText("");
-  myPath = myVec = GEOM::GEOM_Object::_nil();
-  myOkBase = myOkPath = myOkVec = false;
+  myPath.nullify();
+  myVec.nullify();
 
   GroupPoints->CheckButton1->setEnabled(false);
 
@@ -129,10 +129,6 @@ void GenerationGUI_PipeDlg::Init()
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton3, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit3,   SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupPoints->CheckButton1,   SIGNAL(toggled(bool)), this, SLOT(SelectionTypeButtonClicked()));
 
   initName(tr("GEOM_PIPE"));
@@ -155,27 +151,27 @@ void GenerationGUI_PipeDlg::ConstructorsClicked( int constructorId )
 {
   erasePreview();
 
-  switch (constructorId)
-  {
-    case 0:
-    {
-      GroupPoints->TextLabel3->hide();
-      GroupPoints->PushButton3->hide();
-      GroupPoints->LineEdit3->hide();
-      break;
-    }
-    case 1:
-    {
-      GroupPoints->TextLabel3->show();
-      GroupPoints->PushButton3->show();
-      GroupPoints->LineEdit3->show();
-      break;
-    }
+  switch (constructorId) {
+  case 0:
+    GroupPoints->TextLabel3->hide();
+    GroupPoints->PushButton3->hide();
+    GroupPoints->LineEdit3->hide();
+    GroupPoints->PushButton1->click();
+    break;
+  case 1:
+    GroupPoints->TextLabel3->show();
+    GroupPoints->PushButton3->show();
+    GroupPoints->LineEdit3->show();
+    break;
+  default:
+    break;
   }
+
   qApp->processEvents();
   updateGeometry();
   resize(100,100);
 
+  SelectionIntoArgument();
   displayPreview();
 }
 
@@ -195,9 +191,9 @@ void GenerationGUI_PipeDlg::SelectionTypeButtonClicked()
     aMap.Add(GEOM_LINE);
     globalSelection(aMap);
   }
-  if(myEditCurrentArgument == GroupPoints->LineEdit2) {
+  if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
     myEditCurrentArgument->setText("");
-    myOkPath = false;
+    myPath.nullify();
   }
   displayPreview();
 }
@@ -223,7 +219,7 @@ bool GenerationGUI_PipeDlg::ClickOnApply()
 
   initName();
   if ( getConstructorId() != 1 )
-        ConstructorsClicked( getConstructorId() );
+    ConstructorsClicked( getConstructorId() );
   // activate selection and connect selection manager
   GroupPoints->PushButton1->click();
   return true;
@@ -237,109 +233,48 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
 {
   erasePreview();
   myEditCurrentArgument->setText("");
-  if      (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkPath = false;
-  else if (myEditCurrentArgument == GroupPoints->LineEdit3) myOkVec  = false;
-
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() < 1)
-    return;
-
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  if ( aSelectedObject->_is_nil() )
-    return;
-
-  TopoDS_Shape S;
-  if (!GEOMBase::GetShape(aSelectedObject, S))
-    return;
-
-  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    myOkBase = false;
-    GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true);
-    if (aSelList.Extent() > 1)
-      aName = QString( "%1_objects").arg( aSelList.Extent() );
-
-    if ( aSelList.Extent() > 0 ) {
-      // check base shapes
-      for (int i=0; i < myBaseObjects.length(); i++) {
-        GEOMBase::GetShape(myBaseObjects[i], S);
-        if (S.ShapeType() == TopAbs_COMPSOLID ||
-            /*S.ShapeType() == TopAbs_COMPOUND ||*/
-            S.ShapeType() == TopAbs_SOLID ||
-            S.ShapeType() == TopAbs_SHAPE)
-          return;
-        if ( getConstructorId() == 1 && 
-             (S.ShapeType() == TopAbs_SHELL || 
-              S.ShapeType() == TopAbs_VERTEX))
-          return;
-      }
-    }
 
-    myEditCurrentArgument->setText(aName);
-    myOkBase = true;
-  } else if (myEditCurrentArgument == GroupPoints->LineEdit2 || 
-           myEditCurrentArgument == GroupPoints->LineEdit3) {
-    myEditCurrentArgument == GroupPoints->LineEdit2 ? myOkPath = false : myOkVec = false;
-    bool myOk = false;
-
-    if (myEditCurrentArgument == GroupPoints->LineEdit2 && !GroupPoints->CheckButton1->isChecked() ){
-      myPath = aSelectedObject;
-      myOkPath = true;
-      myEditCurrentArgument->setText(aName);
-    } else { 
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if (aMap.Extent() == 1) {
-        int anIndex = aMap(1);
-        aName.append(":edge_" + QString::number(anIndex));
-        
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-        if (aFindedObject->_is_nil()) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp =
-            getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-          myOk = true;
-        } else { // get Object from study
-          aSelectedObject = aFindedObject;
-          myOk = true;
-        }
-      } else {
-        myOk = true;
-        if (S.ShapeType() != TopAbs_EDGE) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-          myOk = false;
-        }
-      }
-      if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-        myPath = aSelectedObject;
-        myOkPath = myOk;
-      } else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
-        myVec = aSelectedObject;
-        myOkVec = myOk;
-      }
-      myEditCurrentArgument->setText(aName);
-      
-      if (myOkPath) {
-        if (!myOkBase)
-          GroupPoints->PushButton1->click();
-        else if (!myOkVec)
-          GroupPoints->PushButton3->click();
-      } else if (myOkVec) {
-        if (!myOkBase)
-          GroupPoints->PushButton1->click();
-        else if (!myOkPath)
-          GroupPoints->PushButton2->click();
-      }
+  if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
+    myBaseObjects.clear();
+    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
+    for ( int i = 0; i < objects.count(); i++ ) {
+      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
+      GEOM::shape_type maxallowed = getConstructorId() == 1 ? GEOM::FACE : GEOM::SHELL;
+      GEOM::shape_type minallowed = getConstructorId() == 1 ? GEOM::EDGE : GEOM::VERTEX;
+      if ( stype < maxallowed || stype > minallowed )
+       continue;
+      myBaseObjects << objects[i];
+    }
+    if ( !myBaseObjects.isEmpty() ) {
+      QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
+      myEditCurrentArgument->setText( aName );
+    }
+  }
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+    QList<TopAbs_ShapeEnum> types;
+    types << TopAbs_EDGE << TopAbs_WIRE;
+    myPath = getSelected( types );
+    if ( myPath ) {
+      QString aName = GEOMBase::GetName( myPath.get() );
+      myEditCurrentArgument->setText( aName );
+      if ( getConstructorId() == 1 && !myVec )
+       GroupPoints->PushButton3->click();
+      else if ( myBaseObjects.isEmpty() )
+       GroupPoints->PushButton1->click();
+    }
+  }
+  else if (myEditCurrentArgument == GroupPoints->LineEdit3) {
+    myVec = getSelected( TopAbs_EDGE );
+    if ( myVec ) {
+      QString aName = GEOMBase::GetName( myVec.get() );
+      myEditCurrentArgument->setText( aName );
+      if ( myBaseObjects.isEmpty() )
+       GroupPoints->PushButton1->click();
+      else if ( !myPath )
+       GroupPoints->PushButton2->click();
     }
   }
+
   displayPreview();
 }
 
@@ -395,26 +330,6 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void GenerationGUI_PipeDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 ||
-      send == GroupPoints->LineEdit2 ||
-      send == GroupPoints->LineEdit3) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-
-  if (send == GroupPoints->LineEdit2)
-    GroupPoints->CheckButton1->setEnabled(true);
-  else
-    GroupPoints->CheckButton1->setEnabled(false);
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -453,12 +368,18 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PipeDlg::createOperation()
 //=================================================================================
 bool GenerationGUI_PipeDlg::isValid (QString&)
 {
+  bool ok = false;
   switch ( getConstructorId() ) {
   case 0 :
-    return myOkBase && myOkPath;
+    ok = !myBaseObjects.isEmpty() && myPath;
+    break;
   case 1 :
-    return myOkBase && myOkPath && myOkVec;
+    ok = !myBaseObjects.isEmpty() && myPath && myVec;
+    break;
+  default:
+    break;
   }
+  return ok;
 }
 
 //=================================================================================
@@ -467,18 +388,17 @@ bool GenerationGUI_PipeDlg::isValid (QString&)
 //=================================================================================
 bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
 {
-  GEOM::GEOM_Object_var anObj, aBase;
+  GEOM::GEOM_Object_var anObj;
 
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
 
-  for (int i=0; i < myBaseObjects.length(); i++) {
-    aBase = myBaseObjects[i];
+  for (int i = 0; i < myBaseObjects.count(); i++) {
     switch ( getConstructorId() ) {
     case 0 :
-      anObj = anOper->MakePipe(aBase, myPath);
+      anObj = anOper->MakePipe(myBaseObjects[i].get(), myPath.get());
       break;
     case 1 :
-      anObj = anOper->MakePipeBiNormalAlongVector(aBase, myPath, myVec);
+      anObj = anOper->MakePipeBiNormalAlongVector(myBaseObjects[i].get(), myPath.get(), myVec.get());
       break;
     }
     
@@ -494,11 +414,8 @@ bool GenerationGUI_PipeDlg::execute (ObjectList& objects)
 //=================================================================================
 void GenerationGUI_PipeDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  objMap[GroupPoints->LineEdit2->text()] = myPath;
-
-  addSubshapesToFather(objMap);
+  GEOMBase::PublishSubObject( myPath.get() );
+  GEOMBase::PublishSubObject( myVec.get() );
 }
 
 //=================================================================================
@@ -507,5 +424,5 @@ void GenerationGUI_PipeDlg::addSubshapesToStudy()
 //=================================================================================
 bool GenerationGUI_PipeDlg::extractPrefix() const
 {
-  return myBaseObjects.length() > 1;
+  return myBaseObjects.count() > 1;
 }
index 35c3316a8272dc49dad5e8e99121094e647a4c38..bef9dd172d03e8951eb276bf63ecb484f7556841 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef GENERATIONGUI_PIPEDLG_H
 #define GENERATIONGUI_PIPEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_3Sel1Check;
 
@@ -56,20 +57,16 @@ private:
   void                               enterEvent( QEvent* );
   
 private:
-  GEOM::ListOfGO                     myBaseObjects;  /* Base shapes */
-  GEOM::GEOM_Object_var              myPath; /* Shape, defining the path */
-  GEOM::GEOM_Object_var              myVec;  /* Vector, defining the constant binormal direction */
-  bool                               myOkBase;
-  bool                               myOkPath;
-  bool                               myOkVec; /* to check when arguments are defined */
+  QList<GEOM::GeomObjPtr>            myBaseObjects;  /* Base shapes */
+  GEOM::GeomObjPtr                   myPath; /* Shape, defining the path */
+  GEOM::GeomObjPtr                   myVec;  /* Vector, defining the constant binormal direction */
   
-  DlgRef_3Sel1Check*                       GroupPoints;
+  DlgRef_3Sel1Check*                 GroupPoints;
 
 private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 7c3c4b1b82ed7d1383db4e5cc1c17b0ae96638fc..1bdd4afc5adf7e801bdc26b33a5dbe83599e2857 100644 (file)
@@ -54,8 +54,7 @@
 //=================================================================================
 GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWidget* parent,
                                                 bool modal, Qt::WindowFlags fl)
-  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl),
-    myInitial(true)
+  : GEOMBase_Skeleton(theGeometryGUI, parent, modal, fl)
 {
   SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
   QPixmap image0 (aResMgr->loadPixmap("GEOM", tr("ICON_DLG_PRISM")));
@@ -72,7 +71,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi
   mainFrame()->RadioButton3->setIcon(image3);
 
   mainFrame()->RadioButton1->setChecked(true);
-  myBothway = myBothway2 = myBothway3 = false;
 
   GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
   GroupPoints->GroupBox1->setTitle(tr("GEOM_EXTRUSION_BSV"));
@@ -84,7 +82,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi
   GroupPoints->LineEdit1->setReadOnly(true);
   GroupPoints->LineEdit2->setReadOnly(true);
   GroupPoints->CheckButton1->setText(tr("GEOM_BOTHWAY"));
-  GroupPoints->CheckButton1->setChecked(myBothway);
   GroupPoints->CheckButton2->setText(tr("GEOM_REVERSE"));
 
   GroupPoints2 = new DlgRef_3Sel1Check(centralWidget());
@@ -96,7 +93,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi
   GroupPoints2->PushButton2->setIcon(image1);
   GroupPoints2->PushButton3->setIcon(image1);
   GroupPoints2->CheckButton1->setText(tr("GEOM_BOTHWAY"));
-  GroupPoints2->CheckButton1->setChecked(myBothway2);
 
   GroupPoints3 = new DlgRef_1Sel3Spin1Check(centralWidget());
   GroupPoints3->GroupBox1->setTitle(tr("GEOM_EXTRUSION_DXDYDZ"));
@@ -106,7 +102,6 @@ GenerationGUI_PrismDlg::GenerationGUI_PrismDlg (GeometryGUI* theGeometryGUI, QWi
   GroupPoints3->TextLabel3->setText(tr("GEOM_DY"));
   GroupPoints3->TextLabel4->setText(tr("GEOM_DZ"));
   GroupPoints3->CheckButton1->setText(tr("GEOM_BOTHWAY"));
-  GroupPoints3->CheckButton1->setChecked(myBothway3);
 
   QVBoxLayout* layout = new QVBoxLayout(centralWidget());
   layout->setMargin(0); layout->setSpacing(6);
@@ -170,8 +165,10 @@ void GenerationGUI_PrismDlg::Init()
 
   GroupPoints3->LineEdit1->setText("");
 
-  myPoint1 = myPoint2 = myVec = GEOM::GEOM_Object::_nil();
-  myOkBase = myOkVec = myOkPnt1 = myOkPnt2 = false;
+  myBaseObjects.clear();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myVec.nullify();
 
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@@ -182,10 +179,7 @@ void GenerationGUI_PrismDlg::Init()
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
-  connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupPoints->SpinBox_DX, SIGNAL(valueChanged(double)),    this, SLOT(ValueChangedInSpinBox()));
   connect(myGeomGUI, SIGNAL(SignalDefaultStepValueChanged(double)), this, SLOT(SetDoubleSpinBoxStep(double)));
 
   connect(GroupPoints->CheckButton1,  SIGNAL(toggled(bool)), this, SLOT(onBothway()));
@@ -194,18 +188,13 @@ void GenerationGUI_PrismDlg::Init()
   connect(GroupPoints2->PushButton1,  SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints2->PushButton2,  SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints2->PushButton3,  SIGNAL(clicked()),       this, SLOT(SetEditCurrentArgument()));
-  connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
-
-  connect(GroupPoints2->LineEdit1,    SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints2->LineEdit2,    SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints2->LineEdit3,    SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
+  connect(GroupPoints2->CheckButton1, SIGNAL(toggled(bool)),   this, SLOT(onBothway()));
 
-  connect(GroupPoints3->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
-  connect(GroupPoints3->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints3->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
-  connect(GroupPoints3->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
-  connect(GroupPoints3->SpinBox_DZ, SIGNAL(valueChanged (double)), this, SLOT(ValueChangedInSpinBox()));
-  connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)), this, SLOT(onBothway()));
+  connect(GroupPoints3->PushButton1,  SIGNAL(clicked()),            this, SLOT(SetEditCurrentArgument()));
+  connect(GroupPoints3->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupPoints3->SpinBox_DY,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupPoints3->SpinBox_DZ,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
+  connect(GroupPoints3->CheckButton1, SIGNAL(toggled(bool)),        this, SLOT(onBothway()));
 
   initName(tr("GEOM_EXTRUSION"));
 
@@ -230,49 +219,38 @@ void GenerationGUI_PrismDlg::SetDoubleSpinBoxStep (double step)
 //=================================================================================
 void GenerationGUI_PrismDlg::ConstructorsClicked (int constructorId)
 {
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-
   switch (constructorId) {
   case 0:
-    {
-      GroupPoints2->hide();
-      GroupPoints3->hide();
-      GroupPoints->show();
-
-      GroupPoints->LineEdit1->setText(GroupPoints2->LineEdit1->text()); // keep base
-      GroupPoints->LineEdit2->setText("");
-      myVec = GEOM::GEOM_Object::_nil();
-      myOkVec = false;
-
-      GroupPoints->PushButton1->click();
-      break;
-    }
+    GroupPoints2->hide();
+    GroupPoints3->hide();
+    GroupPoints->show();
+    
+    GroupPoints->LineEdit2->setText("");
+    myVec.nullify();
+    
+    GroupPoints->PushButton1->click();
+    break;
   case 1:
-    {
-      GroupPoints->hide();
-      GroupPoints2->show();
-      GroupPoints3->hide();
-
-      GroupPoints2->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
-      GroupPoints2->LineEdit2->setText("");
-      GroupPoints2->LineEdit3->setText("");
-      myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
-      myOkPnt1 = myOkPnt2 = false;
-
-      GroupPoints2->PushButton1->click();
-      break;
-    }
+    GroupPoints->hide();
+    GroupPoints2->show();
+    GroupPoints3->hide();
+    
+    GroupPoints2->LineEdit2->setText("");
+    GroupPoints2->LineEdit3->setText("");
+    myPoint1.nullify();
+    myPoint2.nullify();
+    
+    GroupPoints2->PushButton1->click();
+    break;
   case 2:
-    {
-      GroupPoints->hide();
-      GroupPoints2->hide();
-      GroupPoints3->show();
-
-      GroupPoints3->LineEdit1->setText(GroupPoints->LineEdit1->text()); // keep base
-
-      GroupPoints3->PushButton1->click();
-      break;
-    }
+    GroupPoints->hide();
+    GroupPoints2->hide();
+    GroupPoints3->show();
+    
+    GroupPoints3->PushButton1->click();
+    break;
+  default:
+    break;
   }
 
   qApp->processEvents();
@@ -317,146 +295,58 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
   erasePreview();
   myEditCurrentArgument->setText("");
 
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  QString aBaseName = ""; /* name of base object selection */
-  int nbSel = GEOMBase::GetNameOfSelectedIObjects(aSelList, aBaseName, true);
-
-  if (nbSel > 1)
-    aBaseName = QString( "%1_objects").arg( nbSel );
-
-  // Base Object(s) selected
-  if (myEditCurrentArgument == GroupPoints->LineEdit1 ||
-      myEditCurrentArgument == GroupPoints2->LineEdit1 ||
-      getConstructorId() == 2 ) {
-    myOkBase = false;
-    if ( nbSel > 0 ) {
-      GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true);
-      myEditCurrentArgument->setText( aBaseName );
-      myOkBase = true;
+  if ( myEditCurrentArgument == GroupPoints->LineEdit1  ||
+       myEditCurrentArgument == GroupPoints2->LineEdit1 ||
+       myEditCurrentArgument == GroupPoints3->LineEdit1 ) {
+    myBaseObjects.clear();
+    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
+    for ( int i = 0; i < objects.count(); i++ ) {
+      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
+      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
+       continue;
+      myBaseObjects << objects[i];
     }
-    displayPreview();
-    return;
-  }
-
-  if (getConstructorId() == 0)
-  {
-    if (aSelList.Extent() < 1) {
-      if (myEditCurrentArgument == GroupPoints->LineEdit2)
-        myOkVec = false;
-      return;
+    if ( !myBaseObjects.isEmpty() ) {
+      QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
+      GroupPoints->LineEdit1->setText( aName );
+      GroupPoints2->LineEdit1->setText( aName );
+      GroupPoints3->LineEdit1->setText( aName );
     }
-
-    GEOM::GEOM_Object_var aSelectedObject =
-      GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-    if ( CORBA::is_nil(aSelectedObject) )
-      return;
-
-    QString aName = GEOMBase::GetName(aSelectedObject);
-
-    // Get Selected object if selected subshape
-    bool myOk = true;
-    TopoDS_Shape aShape;
-    if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-    {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if (aMap.Extent() == 1) {
-        int anIndex = aMap(1);
-        aName.append(":edge_" + QString::number(anIndex));
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-        if (aFindedObject->_is_nil()) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp =
-            getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        }
-        else {
-          aSelectedObject = aFindedObject; // get Object from study
-        }
-      }
-      else { // Global Selection
-        if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-          myOk = false;
-        }
-      }
-    }
-
-    if (myEditCurrentArgument == GroupPoints->LineEdit2 && myOk) {
-      myEditCurrentArgument->setText(aName);
-      myOkVec = true;
-      myVec = aSelectedObject;
+    else {
+      GroupPoints->LineEdit1->setText( "" );
+      GroupPoints2->LineEdit1->setText( "" );
+      GroupPoints3->LineEdit1->setText( "" );
     }
   }
-  else if (getConstructorId() == 1) { // getConstructorId()==1 - extrusion using 2 points
-    if (aSelList.Extent() != 1) {
-      if (myEditCurrentArgument == GroupPoints2->LineEdit2) {
-        myPoint1 = GEOM::GEOM_Object::_nil();
-        myOkPnt1 = false;
-      }
-      else if (myEditCurrentArgument == GroupPoints2->LineEdit3) {
-        myPoint2 = GEOM::GEOM_Object::_nil();
-        myOkPnt2 = false;
-      }
-      return;
+  else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) {
+    myVec = getSelected( TopAbs_EDGE );
+    if ( myVec ) {
+      QString aName = GEOMBase::GetName( myVec.get() );
+      myEditCurrentArgument->setText( aName );
+      if ( myBaseObjects.isEmpty() )
+       GroupPoints->PushButton1->click();
     }
-
-    GEOM::GEOM_Object_var aSelectedObject =
-      GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-    if ( CORBA::is_nil(aSelectedObject) )
-      return;
-
-    QString aName = GEOMBase::GetName(aSelectedObject);
-    TopoDS_Shape aShape;
-    bool myOk = true;
-    if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull()) {
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes(aSelList.First(), aMap);
-      if (aMap.Extent() == 1) {
-        int anIndex = aMap(1);
-        aName.append(":vertex_" + QString::number(anIndex));
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
-
-        if (aFindedObject->_is_nil()) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        }
-        else {
-          aSelectedObject = aFindedObject;
-        }
-      }
-      else {
-        if ((aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit2) ||
-             (aShape.ShapeType() != TopAbs_VERTEX && myEditCurrentArgument == GroupPoints2->LineEdit3)) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-          myOk = false;
-        }
-      }
-    }
-
-    myEditCurrentArgument->setText(aName);
-
-    if (myEditCurrentArgument == GroupPoints2->LineEdit2 && myOk) {
-      myOkPnt1 = true;
-      myPoint1 = aSelectedObject;
-      if (!myOkPnt2)
-        GroupPoints2->PushButton3->click();
+  }
+  if ( myEditCurrentArgument == GroupPoints2->LineEdit2 ) {
+    myPoint1 = getSelected( TopAbs_VERTEX );
+    if ( myPoint1 ) {
+      QString aName = GEOMBase::GetName( myPoint1.get() );
+      myEditCurrentArgument->setText( aName );
+      if ( !myPoint2 )
+       GroupPoints2->PushButton3->click();
+      else if ( myBaseObjects.isEmpty() )
+       GroupPoints2->PushButton1->click();
     }
-    else if (myEditCurrentArgument == GroupPoints2->LineEdit3 && myOk) {
-      myOkPnt2 = true;
-      myPoint2 = aSelectedObject;
-      if (!myOkBase)
-        GroupPoints2->PushButton1->click();
+  }
+  if ( myEditCurrentArgument == GroupPoints2->LineEdit3 ) {
+    myPoint2 = getSelected( TopAbs_VERTEX );
+    if ( myPoint2 ) {
+      QString aName = GEOMBase::GetName( myPoint2.get() );
+      myEditCurrentArgument->setText( aName );
+      if ( myBaseObjects.isEmpty() )
+       GroupPoints2->PushButton1->click();
+      else if ( !myPoint1 )
+       GroupPoints2->PushButton2->click();
     }
   }
 
@@ -523,24 +413,6 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void GenerationGUI_PrismDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 ||
-      send == GroupPoints->LineEdit2 ||
-      send == GroupPoints2->LineEdit1 ||
-      send == GroupPoints2->LineEdit2 ||
-      send == GroupPoints2->LineEdit3 ||
-      send == GroupPoints3->LineEdit1) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -598,24 +470,26 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_PrismDlg::createOperation()
 //=================================================================================
 bool GenerationGUI_PrismDlg::isValid (QString& msg)
 {
-  bool ok = true;
-  if( getConstructorId() == 0 )
-    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-  else if( getConstructorId() == 2 )
-  {
-    ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+  bool ok = false;
+  switch ( getConstructorId() ) {
+  case 0:
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         !myBaseObjects.isEmpty() && myVec;
+    break;
+  case 1:
+    ok = !myBaseObjects.isEmpty() && myPoint1 && myPoint2;
+    break;
+  case 2:
+    ok = GroupPoints3->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupPoints3->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupPoints3->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
+         !myBaseObjects.isEmpty();
+    break;
+  default:
+    break;
   }
 
-  if (getConstructorId() == 0)
-    return (myOkBase && myOkVec) && ok;     // by vector and height
-  else if (getConstructorId() == 1)
-    return (myOkBase && myOkPnt1 && myOkPnt2);   // by two points
-  else if (getConstructorId() == 2)
-    return myOkBase && ok;
-
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -625,19 +499,17 @@ bool GenerationGUI_PrismDlg::isValid (QString& msg)
 bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
 {
   QStringList aParameters;
-  GEOM::GEOM_Object_var anObj, aBaseObj;
+  GEOM::GEOM_Object_var anObj;
 
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
 
-  for (int i=0; i < myBaseObjects.length(); i++) {
-    aBaseObj = myBaseObjects[i];
-    
+  for (int i = 0; i < myBaseObjects.count(); i++) {
     switch (getConstructorId()) {
     case 0:
-      if (!myBothway)
-        anObj = anOper->MakePrismVecH(aBaseObj, myVec, getHeight());
+      if (!GroupPoints->CheckButton1->isChecked())
+        anObj = anOper->MakePrismVecH(myBaseObjects[i].get(), myVec.get(), getHeight());
       else
-        anObj = anOper->MakePrismVecH2Ways(aBaseObj, myVec, getHeight());
+        anObj = anOper->MakePrismVecH2Ways(myBaseObjects[i].get(), myVec.get(), getHeight());
       
       if (!anObj->_is_nil() && !IsPreview()) {
         aParameters << GroupPoints->SpinBox_DX->text();
@@ -645,20 +517,20 @@ bool GenerationGUI_PrismDlg::execute (ObjectList& objects)
       }
       break;
     case 1:
-      if (!myBothway2)
-        anObj = anOper->MakePrismTwoPnt(aBaseObj, myPoint1, myPoint2);
+      if (!GroupPoints2->CheckButton1->isChecked())
+        anObj = anOper->MakePrismTwoPnt(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
       else
-        anObj = anOper->MakePrismTwoPnt2Ways(aBaseObj, myPoint1, myPoint2);
+        anObj = anOper->MakePrismTwoPnt2Ways(myBaseObjects[i].get(), myPoint1.get(), myPoint2.get());
       break;
     case 2:
       double dx = GroupPoints3->SpinBox_DX->value();
       double dy = GroupPoints3->SpinBox_DY->value();
       double dz = GroupPoints3->SpinBox_DZ->value();
       
-      if (!myBothway3)
-        anObj = anOper->MakePrismDXDYDZ(aBaseObj, dx, dy, dz);
+      if (!GroupPoints3->CheckButton1->isChecked())
+        anObj = anOper->MakePrismDXDYDZ(myBaseObjects[i].get(), dx, dy, dz);
       else
-        anObj = anOper->MakePrismDXDYDZ2Ways(aBaseObj, dx, dy, dz);
+        anObj = anOper->MakePrismDXDYDZ2Ways(myBaseObjects[i].get(), dx, dy, dz);
       
       if (!anObj->_is_nil() && !IsPreview()) {
         aParameters << GroupPoints3->SpinBox_DX->text();
@@ -692,25 +564,8 @@ void GenerationGUI_PrismDlg::onReverse()
 //=================================================================================
 void GenerationGUI_PrismDlg::onBothway()
 {
-  bool anOldValue;
-  switch (getConstructorId()) {
-  case 0:
-    anOldValue = myBothway;
-    myBothway = !anOldValue;
-    GroupPoints->CheckButton2->setEnabled(!myBothway);
-    displayPreview();
-    break;
-  case 1:
-    anOldValue = myBothway2;
-    myBothway2 = !anOldValue;
-    displayPreview();
-    break;
-  case 2:
-    anOldValue = myBothway3;
-    myBothway3 = !anOldValue;
-    displayPreview();
-    break;
-  }
+  GroupPoints->CheckButton2->setEnabled(!GroupPoints->CheckButton1->isChecked());
+  displayPreview();
 }
 
 //=================================================================================
@@ -719,18 +574,17 @@ void GenerationGUI_PrismDlg::onBothway()
 //=================================================================================
 void GenerationGUI_PrismDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch (getConstructorId()) {
   case 0:
-    objMap[GroupPoints->LineEdit2->text()] = myVec;
+    GEOMBase::PublishSubObject( myVec.get() );
     break;
   case 1:
-    objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
-    objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather(objMap);
 }
 
 //=================================================================================
@@ -739,5 +593,5 @@ void GenerationGUI_PrismDlg::addSubshapesToStudy()
 //=================================================================================
 bool GenerationGUI_PrismDlg::extractPrefix() const
 {
-  return myBaseObjects.length() > 1;
+  return myBaseObjects.count() > 1;
 }
index 0a0bad169fe1e118b67b145fd58f5d04eb46cad9..bebfa3feca2f2d582e89fbffffd08f6002bcca4f 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef GENERATIONGUI_PRISMDLG_H
 #define GENERATIONGUI_PRISMDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel1Spin2Check;
 class DlgRef_3Sel1Check;
@@ -59,20 +60,9 @@ private:
   double                             getHeight() const;
  
 private:
-  GEOM::ListOfGO                     myBaseObjects;  /* Base shapes */
-  GEOM::GEOM_Object_var              myVec;  /* Vector, defining the direction */
-  GEOM::GEOM_Object_var              myPoint1, myPoint2;   /* Points for extrusion */ 
-  
-  bool                               myOkBase;
-  bool                               myOkVec;
-  bool                               myOkPnt1;
-  bool                               myOkPnt2;
-  bool                               myBothway;
-  bool                               myBothway2;
-  bool                               myBothway3;
-  
-  // to initialize the first selection field with a selected object on the dialog creation
-  bool                               myInitial;
+  QList<GEOM::GeomObjPtr>            myBaseObjects;  /* Base shapes */
+  GEOM::GeomObjPtr                   myVec;  /* Vector, defining the direction */
+  GEOM::GeomObjPtr                   myPoint1, myPoint2;   /* Points for extrusion */ 
   
   DlgRef_2Sel1Spin2Check*            GroupPoints;
   DlgRef_3Sel1Check*                 GroupPoints2; // for second layout for extrusion using 2 points
@@ -82,7 +72,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 53ba3d6256f4bac61ac7ffc56da9050f6f9f2f98..837165e6d9277bdf2191832b6d1cb61839de7228 100644 (file)
@@ -68,7 +68,6 @@ GenerationGUI_RevolDlg::GenerationGUI_RevolDlg (GeometryGUI* theGeometryGUI, QWi
   mainFrame()->RadioButton2->close();
   mainFrame()->RadioButton3->setAttribute(Qt::WA_DeleteOnClose);
   mainFrame()->RadioButton3->close();
-  myBothway = false;
 
   GroupPoints = new DlgRef_2Sel1Spin2Check(centralWidget());
   GroupPoints->GroupBox1->setTitle(tr("GEOM_ARGUMENTS"));
@@ -119,8 +118,9 @@ void GenerationGUI_RevolDlg::Init()
 
   GroupPoints->LineEdit1->setText("");
   GroupPoints->LineEdit2->setText("");
-  myAxis = GEOM::GEOM_Object::_nil();
-  myOkBase = myOkAxis = false;
+
+  myBaseObjects.clear();
+  myAxis.nullify();
 
   // signals and slots connections
   connect(buttonOk(),    SIGNAL(clicked()), this, SLOT(ClickOnOk()));
@@ -129,9 +129,6 @@ void GenerationGUI_RevolDlg::Init()
   connect(GroupPoints->PushButton1,  SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2,  SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1,    SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2,    SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupPoints->SpinBox_DX,   SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupPoints->CheckButton1, SIGNAL(toggled(bool)),        this, SLOT(onBothway()));
   connect(GroupPoints->CheckButton2, SIGNAL(toggled(bool)),        this, SLOT(onReverse()));
@@ -180,32 +177,6 @@ bool GenerationGUI_RevolDlg::ClickOnApply()
   return true;
 }
 
-//=======================================================================
-//function : isAcceptableBase
-//purpose  : return true if theBase can be used as algo argument
-//=======================================================================
-static bool isAcceptableBase (const TopoDS_Shape& theBase)
-{
-  switch (theBase.ShapeType()) {
-  case TopAbs_VERTEX:
-  case TopAbs_EDGE:
-  case TopAbs_WIRE:
-  case TopAbs_FACE:
-  case TopAbs_SHELL:
-    return true;
-  case TopAbs_SOLID:
-  case TopAbs_COMPSOLID:
-    return false;
-  case TopAbs_COMPOUND: {
-    TopExp_Explorer exp(theBase, TopAbs_SOLID);
-    return !exp.More();
-  }
-  default:
-    return false;
-  }
-  return false;
-}
-
 //=================================================================================
 // function : SelectionIntoArgument()
 // purpose  : Called when selection is changed or on dialog initialization or activation
@@ -214,76 +185,30 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
 {
   erasePreview();
   myEditCurrentArgument->setText("");
-  if      (myEditCurrentArgument == GroupPoints->LineEdit1) myOkBase = false;
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) myOkAxis = false;
-
-  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
-  SALOME_ListIO aSelList;
-  aSelMgr->selectedObjects(aSelList);
-
-  if (aSelList.Extent() < 1)
-    return;
-
-  GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  if ( aSelectedObject->_is_nil() )
-    return;
-
-  TopoDS_Shape S;
-  if (!GEOMBase::GetShape(aSelectedObject, S) || S.IsNull())
-    return;
-
-  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    myOkBase = false;
-    if (aSelList.Extent() > 1)
-      aName = QString( "%1_objects").arg( aSelList.Extent() );
-
-    if ( aSelList.Extent() > 0 ) {
-      GEOMBase::ConvertListOfIOInListOfGO(aSelList, myBaseObjects, true);
-      // check base shapes
-      for (int i=0; i < myBaseObjects.length(); i++) {
-        GEOMBase::GetShape(myBaseObjects[i], S);
-        if (!isAcceptableBase(S))
-          return;
-      }
+
+  if ( myEditCurrentArgument == GroupPoints->LineEdit1 ) {
+    myBaseObjects.clear();
+    QList<GEOM::GeomObjPtr> objects = getSelected( TopAbs_SHAPE, -1 );
+    for ( int i = 0; i < objects.count(); i++ ) {
+      GEOM::shape_type stype = objects[i]->GetMaxShapeType();
+      if ( stype < GEOM::SHELL || stype > GEOM::VERTEX )
+       continue;
+      myBaseObjects << objects[i];
+    }
+    if ( !myBaseObjects.isEmpty() ) {
+      QString aName = myBaseObjects.count() > 1 ? QString( "%1_objects").arg( myBaseObjects.count() ) : GEOMBase::GetName( myBaseObjects[0].get() );
       myEditCurrentArgument->setText( aName );
-      myOkBase = true;
     }
   }
   else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if (aMap.Extent() == 1) {
-      int anIndex = aMap(1);
-      aName.append(":edge_" + QString::number(anIndex));
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          getGeomEngine()->GetIShapesOperations(getStudyId());
-        myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        myOkAxis = true;
-      } else {
-        myAxis = aFindedObject;
-        myOkAxis = true;
-      }
-    } else {
-      myOkAxis = true;
-      if (S.ShapeType() != TopAbs_EDGE) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-        myOkAxis = false;
-      }
-      myAxis = aSelectedObject;
+    myAxis = getSelected( TopAbs_EDGE );
+    if ( myAxis ) {
+      QString aName = GEOMBase::GetName( myAxis.get() );
+      myEditCurrentArgument->setText( aName );
+      if ( myBaseObjects.isEmpty() )
+       GroupPoints->PushButton1->click();
     }
-    myEditCurrentArgument->setText(aName);
-    if (myOkAxis && !myOkBase)
-      GroupPoints->PushButton1->click();
   }
-
   displayPreview();
 }
 
@@ -321,20 +246,6 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void GenerationGUI_RevolDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 ||
-      send == GroupPoints->LineEdit2) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -391,8 +302,7 @@ GEOM::GEOM_IOperations_ptr GenerationGUI_RevolDlg::createOperation()
 //=================================================================================
 bool GenerationGUI_RevolDlg::isValid (QString& msg)
 {
-  bool ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() );
-  return myOkBase && myOkAxis && ok;
+  return GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && !myBaseObjects.isEmpty() && myAxis;
 }
 
 //=================================================================================
@@ -401,16 +311,14 @@ bool GenerationGUI_RevolDlg::isValid (QString& msg)
 //=================================================================================
 bool GenerationGUI_RevolDlg::execute (ObjectList& objects)
 {
-  GEOM::GEOM_Object_var anObj, aBase;
+  GEOM::GEOM_Object_var anObj;
   GEOM::GEOM_I3DPrimOperations_var anOper = GEOM::GEOM_I3DPrimOperations::_narrow(getOperation());
 
-  for (int i=0; i < myBaseObjects.length(); i++) {
-    aBase = myBaseObjects[i];
-
-    if (!myBothway)
-      anObj = anOper->MakeRevolutionAxisAngle(aBase, myAxis, getAngle() * PI180);
+  for (int i = 0; i < myBaseObjects.count(); i++) {
+    if (!GroupPoints->CheckButton1->isChecked())
+      anObj = anOper->MakeRevolutionAxisAngle(myBaseObjects[i].get(), myAxis.get(), getAngle() * PI180);
     else
-      anObj = anOper->MakeRevolutionAxisAngle2Ways(aBase, myAxis, getAngle() * PI180);
+      anObj = anOper->MakeRevolutionAxisAngle2Ways(myBaseObjects[i].get(), myAxis.get(), getAngle() * PI180);
     
     if (!anObj->_is_nil()) {
       if (!IsPreview()) {
@@ -441,9 +349,7 @@ void GenerationGUI_RevolDlg::onReverse()
 //=================================================================================
 void GenerationGUI_RevolDlg::onBothway()
 {
-  bool anOldValue = myBothway;
-  myBothway = !anOldValue;
-  GroupPoints->CheckButton2->setEnabled(!myBothway);
+  GroupPoints->CheckButton2->setEnabled(!GroupPoints->CheckButton1->isChecked());
   displayPreview();
 }
 
@@ -453,11 +359,7 @@ void GenerationGUI_RevolDlg::onBothway()
 //=================================================================================
 void GenerationGUI_RevolDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  objMap[GroupPoints->LineEdit2->text()] = myAxis;
-
-  addSubshapesToFather(objMap);
+  GEOMBase::PublishSubObject( myAxis.get() );
 }
 
 //=================================================================================
@@ -466,5 +368,5 @@ void GenerationGUI_RevolDlg::addSubshapesToStudy()
 //=================================================================================
 bool GenerationGUI_RevolDlg::extractPrefix() const
 {
-  return myBaseObjects.length() > 1;
+  return myBaseObjects.count() > 1;
 }
index aee184f008552cafa52bb50cce99df12d318bb41..199d7f3d456271ad37623f200cd2add595c9fb7c 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef GENERATIONGUI_REVOLUTIONDLG_H
 #define GENERATIONGUI_REVOLUTIONDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel1Spin2Check;
 
@@ -57,11 +58,8 @@ private:
   double                             getAngle() const;
   
 private:
-  GEOM::ListOfGO                     myBaseObjects;  /* Base shapes */
-  GEOM::GEOM_Object_var              myAxis; /* Axis of the revolution */
-  bool                               myOkBase; 
-  bool                               myOkAxis;
-  bool                               myBothway;
+  QList<GEOM::GeomObjPtr>            myBaseObjects;  /* Base shapes */
+  GEOM::GeomObjPtr                   myAxis; /* Axis of the revolution */
   
   DlgRef_2Sel1Spin2Check*            GroupPoints;
     
@@ -69,7 +67,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox();
index 5ca674101dd52dd4d41f78eb1f62612c9482a4c0..a5a400628d359871683ca65f14695d831d02151e 100644 (file)
@@ -43,7 +43,6 @@
 #include <TopTools_IndexedMapOfShape.hxx>
 
 #include <GEOMImpl_Types.hxx>
-//#include <ostream>
 
 //=================================================================================
 // class    : PrimitiveGUI_BoxDlg()
@@ -123,7 +122,8 @@ void PrimitiveGUI_BoxDlg::Init()
 
   GroupPoints->LineEdit1->setText("");
   GroupPoints->LineEdit2->setText("");
-  myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
+  myPoint1.nullify();
+  myPoint2.nullify();
 
   double initValue = 200.0;
   GroupDimensions->SpinBox_DX->setValue(initValue);
@@ -139,9 +139,6 @@ void PrimitiveGUI_BoxDlg::Init()
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DY, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DZ, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
@@ -242,70 +239,36 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2 = GEOM::GEOM_Object::_nil();
+    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint1.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myPoint2.nullify();
     return;
   }
 
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if ( CORBA::is_nil(aSelectedObject) )
-    return;
-
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  // Get Selected object if selected subshape
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
   TopoDS_Shape aShape;
-  if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-  {
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if (aMap.Extent() == 1) // Local Selection
-    {
-      int anIndex = aMap(1);
-      aName.append(":vertex_" + QString::number(anIndex));        
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
 
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+    myEditCurrentArgument->setText(aName);
 
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          getGeomEngine()->GetIShapesOperations(getStudyId());
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study        
-      }
+    // clear selection
+    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+    myGeomGUI->getApp()->selectionMgr()->clearSelected();
+    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+           this, SLOT(SelectionIntoArgument()));
+    
+    if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+      myPoint1 = aSelectedObject;
+      if (myPoint1 && !myPoint2)
+       GroupPoints->PushButton2->click();
     }
-    else // Global Selection
-    {
-      if (aShape.ShapeType() != TopAbs_VERTEX) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+      myPoint2 = aSelectedObject;
+      if (myPoint2 && !myPoint1)
+       GroupPoints->PushButton1->click();
     }
+    
   }
-
-  myEditCurrentArgument->setText(aName);
-
-  // clear selection
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-  myGeomGUI->getApp()->selectionMgr()->clearSelected();
-  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-          this, SLOT(SelectionIntoArgument()));
-
-  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    myPoint1 = aSelectedObject;
-    if (!myPoint1->_is_nil() && myPoint2->_is_nil())
-      GroupPoints->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-    myPoint2 = aSelectedObject;
-    if (!myPoint2->_is_nil() && myPoint1->_is_nil())
-      GroupPoints->PushButton1->click();
-  }
-
   displayPreview();
 }
 
@@ -351,19 +314,6 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_BoxDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 || send == GroupPoints->LineEdit2) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -413,18 +363,21 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_BoxDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_BoxDlg::isValid (QString& msg)
 {
-  bool ok = true;
+  bool ok = false;
   if( getConstructorId() == 1 )
   {
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
-
-    ok = fabs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() && ok;
-    ok = fabs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() && ok;
-    ok = fabs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion() && ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
+         qAbs( GroupDimensions->SpinBox_DX->value() ) > Precision::Confusion() &&
+         qAbs( GroupDimensions->SpinBox_DY->value() ) > Precision::Confusion() &&
+         qAbs( GroupDimensions->SpinBox_DZ->value() ) > Precision::Confusion();
+  }
+  else
+  {
+    ok = myPoint1 && myPoint2 && myPoint1 != myPoint2;
   }
-  return getConstructorId() == 0 ? !(myPoint1->_is_nil() || myPoint2->_is_nil()) : ok;
+  return ok;
 }
 
 //=================================================================================
@@ -442,8 +395,8 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
   switch (getConstructorId()) {
   case 0:
     {
-      if (!CORBA::is_nil(myPoint1) && !CORBA::is_nil(myPoint2)) {
-        anObj = anOper->MakeBoxTwoPnt(myPoint1, myPoint2);
+      if ( myPoint1 && myPoint2 ) {
+        anObj = anOper->MakeBoxTwoPnt(myPoint1.get(), myPoint2.get());
         res = true;
       }
     }
@@ -481,9 +434,7 @@ bool PrimitiveGUI_BoxDlg::execute (ObjectList& objects)
 void PrimitiveGUI_BoxDlg::addSubshapesToStudy()
 {
   if (getConstructorId() == 0) {
-    QMap<QString, GEOM::GEOM_Object_var> objMap;
-    objMap[GroupPoints->LineEdit1->text()] = myPoint1;
-    objMap[GroupPoints->LineEdit2->text()] = myPoint2;
-    addSubshapesToFather(objMap);
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
   }
 }
index bdc8e6af87b5763565d95437368538ffbbcaa0c6..48a94363fa32f85840b6daacba709d860b569a3a 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef PRIMITIVEGUI_BOXDLG_H
 #define PRIMITIVEGUI_BOXDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel;
 class DlgRef_3Spin;
@@ -56,7 +57,7 @@ private:
   void                               enterEvent( QEvent* );
 
 private:
-  GEOM::GEOM_Object_var              myPoint1, myPoint2; /* Points containing the vector */
+  GEOM::GeomObjPtr                   myPoint1, myPoint2; /* Points containing the vector */
 
   DlgRef_2Sel*                       GroupPoints;
   DlgRef_3Spin*                      GroupDimensions;
@@ -65,7 +66,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 4b479141492c8203e6afb14f527c56f4d9041ae9..1f02d00b2c225b32c09b356d393e96946e72ed95 100644 (file)
@@ -129,7 +129,8 @@ void PrimitiveGUI_ConeDlg::Init()
 
   GroupPoints->LineEdit1->setText("");
   GroupPoints->LineEdit2->setText("");
-  myPoint = myDir = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
 
   double aRadius1(100.0), aRadius2(0.0), aHeight(300.0);
   GroupPoints->SpinBox_DX->setValue(aRadius1);
@@ -148,9 +149,6 @@ void PrimitiveGUI_ConeDlg::Init()
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupPoints->SpinBox_DX,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupPoints->SpinBox_DY,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupPoints->SpinBox_DZ,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
@@ -257,77 +255,37 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir   = GEOM::GEOM_Object::_nil();
+    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir.nullify();
     return;
   }
 
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if ( CORBA::is_nil(aSelectedObject) )
-    return;
-
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  // Get Selected object if selected subshape
+  TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
   TopoDS_Shape aShape;
-  if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-  {
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if (myEditCurrentArgument == GroupPoints->LineEdit2)
-      aNeedType = TopAbs_EDGE;
-
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if (aMap.Extent() == 1) // Local Selection
-    {
-      int anIndex = aMap(1);
-      if (aNeedType == TopAbs_EDGE)
-        aName.append(":edge_" + QString::number(anIndex));
-      else
-        aName.append(":vertex_" + QString::number(anIndex));
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          getGeomEngine()->GetIShapesOperations(getStudyId());
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study
-      }
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+
+    myEditCurrentArgument->setText(aName);
+
+    // clear selection
+    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+    myGeomGUI->getApp()->selectionMgr()->clearSelected();
+    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+           this, SLOT(SelectionIntoArgument()));
+    
+    if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+      myPoint = aSelectedObject;
+      if (myPoint && !myDir)
+       GroupPoints->PushButton2->click();
     }
-    else // Global Selection
-    {
-      if (aShape.ShapeType() != aNeedType) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+      myDir = aSelectedObject;
+      if (myDir && !myPoint)
+       GroupPoints->PushButton1->click();
     }
   }
 
-  myEditCurrentArgument->setText(aName);
-
-  // clear selection
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-  myGeomGUI->getApp()->selectionMgr()->clearSelected();
-  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-          this, SLOT(SelectionIntoArgument()));
-
-  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    myPoint = aSelectedObject;
-    if (!myPoint->_is_nil() && myDir->_is_nil())
-      GroupPoints->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-    myDir = aSelectedObject;
-    if (!myDir->_is_nil() && myPoint->_is_nil())
-      GroupPoints->PushButton1->click();
-  }
-
   displayPreview();
 }
 
@@ -371,20 +329,6 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_ConeDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 ||
-      send == GroupPoints->LineEdit2) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -433,24 +377,22 @@ GEOM::GEOM_IOperations_ptr  PrimitiveGUI_ConeDlg::createOperation()
 //=================================================================================
 bool  PrimitiveGUI_ConeDlg::isValid (QString& msg)
 {
-  if (!getRadius1() && !getRadius2())
-    return false;
-
-  bool ok = true;
+  bool ok = false;
   if( getConstructorId() == 0 )
   {
-    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupPoints->SpinBox_DZ->isValid( msg, !IsPreview() ) &&
+         myPoint && myDir;
   }
   else if( getConstructorId() == 1 )
   {
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DZ->isValid( msg, !IsPreview() );
   }
-  ok = fabs( getHeight() ) > Precision::Confusion() && ok;
-  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
+  ok = ( getRadius1() > 0 || getRadius2() > 0 ) && qAbs( getHeight() ) > Precision::Confusion() && ok;
+  return ok;
 }
 
 //=================================================================================
@@ -467,8 +409,8 @@ bool PrimitiveGUI_ConeDlg::execute (ObjectList& objects)
 
   switch (getConstructorId()) {
   case 0:
-    if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
-      anObj = anOper->MakeConePntVecR1R2H(myPoint, myDir, getRadius1(), getRadius2(), getHeight());
+    if ( myPoint && myDir ) {
+      anObj = anOper->MakeConePntVecR1R2H(myPoint.get(), myDir.get(), getRadius1(), getRadius2(), getHeight());
       if (!anObj->_is_nil() && !IsPreview())
       {
         QStringList aParameters;
@@ -548,15 +490,8 @@ double PrimitiveGUI_ConeDlg::getHeight() const
 //=================================================================================
 void PrimitiveGUI_ConeDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  switch (getConstructorId()) {
-  case 0:
-    objMap[GroupPoints->LineEdit1->text()] = myPoint;
-    objMap[GroupPoints->LineEdit2->text()] = myDir;
-    break;
-  case 1:
-    return;
+  if ( getConstructorId() == 0 ) {
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myDir.get() );
   }
-  addSubshapesToFather(objMap);
 }
index abea2e72b37b89279cbcac32babc2079055852cf..ed369e4f950baef44478cf94edb693c6d0033b4d 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef PRIMITIVEGUI_CONEDLG_H
 #define PRIMITIVEGUI_CONEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel3Spin;
 class DlgRef_3Spin;
@@ -59,7 +60,7 @@ private:
   double                             getHeight() const;
 
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir;
+  GEOM::GeomObjPtr                   myPoint, myDir;
 
   DlgRef_2Sel3Spin*                  GroupPoints;
   DlgRef_3Spin*                      GroupDimensions;
@@ -68,7 +69,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 29532dabb8bc9020abdfda865129a0c2b2ea667c..cff112c7aa098c3f137b67f0b9506ba433fb46e2 100644 (file)
@@ -127,7 +127,8 @@ void PrimitiveGUI_CylinderDlg::Init()
 
   GroupPoints->LineEdit1->setText("");
   GroupPoints->LineEdit2->setText("");
-  myPoint = myDir = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
 
   double aRadius(100.0), aHeight(300.0);
   GroupPoints->SpinBox_DX->setValue(aRadius);
@@ -144,9 +145,6 @@ void PrimitiveGUI_CylinderDlg::Init()
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupPoints->SpinBox_DX,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupPoints->SpinBox_DY,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
@@ -250,76 +248,38 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
 
   if (aSelList.Extent() != 1) {
     if (myEditCurrentArgument == GroupPoints->LineEdit1)
-      myPoint = GEOM::GEOM_Object::_nil();
+      myPoint.nullify();
     else if (myEditCurrentArgument == GroupPoints->LineEdit2)
-      myDir = GEOM::GEOM_Object::_nil();
+      myDir.nullify();
     return;
   }
 
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if (CORBA::is_nil(aSelectedObject))
-    return;
-
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  // Get Selected object if selected subshape
+  TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
   TopoDS_Shape aShape;
-  if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-  {
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if (myEditCurrentArgument == GroupPoints->LineEdit2)
-      aNeedType = TopAbs_EDGE;
-
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if (aMap.Extent() == 1) { // Local Selection
-      int anIndex = aMap(1);
-      if (aNeedType == TopAbs_EDGE)
-        aName.append(":edge_" + QString::number(anIndex));
-      else
-        aName.append(":vertex_" + QString::number(anIndex));
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          getGeomEngine()->GetIShapesOperations(getStudyId());
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study
-      }
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+
+    myEditCurrentArgument->setText(aName);
+  
+    // clear selection
+    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+    myGeomGUI->getApp()->selectionMgr()->clearSelected();
+    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+           this, SLOT(SelectionIntoArgument()));
+    
+    if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+      myPoint = aSelectedObject;
+      if (myPoint && !myDir)
+       GroupPoints->PushButton2->click();
     }
-    else { // Global Selection
-      if (aShape.ShapeType() != aNeedType) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+      myDir = aSelectedObject;
+      if (myDir && !myPoint)
+       GroupPoints->PushButton1->click();
     }
   }
 
-  myEditCurrentArgument->setText(aName);
-
-  // clear selection
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-  myGeomGUI->getApp()->selectionMgr()->clearSelected();
-  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-          this, SLOT(SelectionIntoArgument()));
-
-  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    myPoint = aSelectedObject;
-    if (!myPoint->_is_nil() && myDir->_is_nil())
-      GroupPoints->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-    myDir = aSelectedObject;
-    if (!myDir->_is_nil() && myPoint->_is_nil())
-      GroupPoints->PushButton1->click();
-  }
-
   displayPreview();
 }
 
@@ -363,20 +323,6 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_CylinderDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 ||
-      send == GroupPoints->LineEdit2) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -425,19 +371,20 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_CylinderDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_CylinderDlg::isValid (QString& msg)
 {
-  bool ok = true;
+  bool ok = false;
   if( getConstructorId() == 0 )
   {
-    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         myPoint && myDir;
   }
   else if( getConstructorId() == 1 )
   {
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() );
   }
-  ok = fabs( getHeight() ) > Precision::Confusion() && ok;
-  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
+  ok = qAbs( getHeight() ) > Precision::Confusion() && ok;
+  return ok;
 }
 
 //=================================================================================
@@ -454,8 +401,8 @@ bool PrimitiveGUI_CylinderDlg::execute (ObjectList& objects)
 
   switch (getConstructorId()) {
   case 0:
-    if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
-      anObj = anOper->MakeCylinderPntVecRH(myPoint, myDir, getRadius(), getHeight());
+    if ( myPoint && myDir ) {
+      anObj = anOper->MakeCylinderPntVecRH(myPoint.get(), myDir.get(), getRadius(), getHeight());
       if (!anObj->_is_nil() && !IsPreview())
       {
         QStringList aParameters;
@@ -519,15 +466,8 @@ double PrimitiveGUI_CylinderDlg::getHeight() const
 //=================================================================================
 void PrimitiveGUI_CylinderDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  switch (getConstructorId()) {
-  case 0:
-    objMap[GroupPoints->LineEdit1->text()] = myPoint;
-    objMap[GroupPoints->LineEdit2->text()] = myDir;
-    break;
-  case 1:
-    return;
+  if ( getConstructorId() == 0 ) {
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myDir.get() );
   }
-  addSubshapesToFather(objMap);
 }
index 370153dd6b7c40a3037f967f3e17bec11f58f81d..5639999603a75ccb95b240ee9f6ab9ee614a1b17 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef PRIMITIVEGUI_CYLINDERDLG_H
 #define PRIMITIVEGUI_CYLINDERDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel2Spin;
 class DlgRef_2Spin;
@@ -58,7 +59,7 @@ private:
   double                             getHeight() const;
   
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir;
+  GEOM::GeomObjPtr                   myPoint, myDir;
 
   // to initialize the first selection field with a selected object on the dialog creation
   bool                               myInitial;
@@ -70,7 +71,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 397188996cce99568bebcfd8097962a0c2bc86b4..07bbd4cc67a71dcac66d7aa800bf37cde1f4d659 100755 (executable)
@@ -142,7 +142,11 @@ void PrimitiveGUI_DiskDlg::Init()
   Group3Pnts->LineEdit1->setText("");
   Group3Pnts->LineEdit2->setText("");
   Group3Pnts->LineEdit3->setText("");
-  myPoint = myDir = myPoint1 = myPoint2 = myPoint3 = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
+  myPoint1.nullify();
+  myPoint2.nullify();
+  myPoint3.nullify();
 
   GroupPntVecR->SpinBox_DX->setValue(100);
   GroupDimensions->SpinBox_DX->setValue(100);
@@ -156,17 +160,10 @@ void PrimitiveGUI_DiskDlg::Init()
   connect(GroupPntVecR->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPntVecR->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPntVecR->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPntVecR->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(Group3Pnts->PushButton1,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(Group3Pnts->PushButton2,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(Group3Pnts->PushButton3,   SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(Group3Pnts->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(Group3Pnts->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(Group3Pnts->LineEdit3, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupPntVecR->SpinBox_DX,    SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
 
@@ -299,91 +296,53 @@ void PrimitiveGUI_DiskDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    if      (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint  = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir    = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group3Pnts->LineEdit1)   myPoint1 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group3Pnts->LineEdit2)   myPoint2 = GEOM::GEOM_Object::_nil();
-    else if (myEditCurrentArgument == Group3Pnts->LineEdit3)   myPoint3 = GEOM::GEOM_Object::_nil();
+    if      (myEditCurrentArgument == GroupPntVecR->LineEdit1) myPoint.nullify();
+    else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) myDir.nullify();
+    else if (myEditCurrentArgument == Group3Pnts->LineEdit1)   myPoint1.nullify();
+    else if (myEditCurrentArgument == Group3Pnts->LineEdit2)   myPoint2.nullify();
+    else if (myEditCurrentArgument == Group3Pnts->LineEdit3)   myPoint3.nullify();
     return;
   }
 
-  // nbSel == 1
-  Handle(SALOME_InteractiveObject) anIO = aSelList.First();
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO );
-
-  if ( CORBA::is_nil(aSelectedObject) )
-    return;
-
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  // If selected Vertex or Edge on the some Shape Get selection Subshape
+  TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPntVecR->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
   TopoDS_Shape aShape;
-  if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-  {
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if (myEditCurrentArgument == GroupPntVecR->LineEdit2)
-      aNeedType = TopAbs_EDGE;
-
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(anIO, aMap);
-    if (aMap.Extent() == 1) { // Local Selection
-      int anIndex = aMap(1);
-      if (aNeedType == TopAbs_EDGE)
-        aName += QString(":edge_%1").arg(anIndex);
-      else
-        aName += QString(":vertex_%1").arg(anIndex);
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study
-      }
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+
+    myEditCurrentArgument->setText(aName);
+    
+    // clear selection
+    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+    myGeomGUI->getApp()->selectionMgr()->clearSelected();
+    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+           this, SLOT(SelectionIntoArgument()));
+    
+    if (myEditCurrentArgument == GroupPntVecR->LineEdit1) {
+      myPoint = aSelectedObject;
+      if (myPoint && !myDir)
+       GroupPntVecR->PushButton2->click();
     }
-    else { // Global Selection
-      if (aShape.ShapeType() != aNeedType) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
+    else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
+      myDir = aSelectedObject;
+      if (myDir && !myPoint)
+       GroupPntVecR->PushButton1->click();
+    }
+    else if (myEditCurrentArgument == Group3Pnts->LineEdit1) {
+      myPoint1 = aSelectedObject;
+      if (myPoint1 && !myPoint2)
+       Group3Pnts->PushButton2->click();
+    }
+    else if (myEditCurrentArgument == Group3Pnts->LineEdit2) {
+      myPoint2 = aSelectedObject;
+      if (myPoint2 && !myPoint3)
+       Group3Pnts->PushButton3->click();
+    }
+    else if (myEditCurrentArgument == Group3Pnts->LineEdit3) {
+      myPoint3 = aSelectedObject;
+      if (myPoint3 && !myPoint1)
+       Group3Pnts->PushButton1->click();
     }
-  }
-
-  myEditCurrentArgument->setText(aName);
-
-  // clear selection
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-  myGeomGUI->getApp()->selectionMgr()->clearSelected();
-  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-          this, SLOT(SelectionIntoArgument()));
-
-  if (myEditCurrentArgument == GroupPntVecR->LineEdit1) {
-    myPoint = aSelectedObject;
-    if (!myPoint->_is_nil() && myDir->_is_nil())
-      GroupPntVecR->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == GroupPntVecR->LineEdit2) {
-    myDir = aSelectedObject;
-    if (!myDir->_is_nil() && myPoint->_is_nil())
-      GroupPntVecR->PushButton1->click();
-  }
-  else if (myEditCurrentArgument == Group3Pnts->LineEdit1) {
-    myPoint1 = aSelectedObject;
-    if (!myPoint1->_is_nil() && myPoint2->_is_nil())
-      Group3Pnts->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == Group3Pnts->LineEdit2) {
-    myPoint2 = aSelectedObject;
-    if (!myPoint2->_is_nil() && myPoint3->_is_nil())
-      Group3Pnts->PushButton3->click();
-  }
-  else if (myEditCurrentArgument == Group3Pnts->LineEdit3) {
-    myPoint3 = aSelectedObject;
-    if (!myPoint3->_is_nil() && myPoint1->_is_nil())
-      Group3Pnts->PushButton1->click();
   }
 
   displayPreview();
@@ -456,23 +415,6 @@ void PrimitiveGUI_DiskDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_DiskDlg::LineEditReturnPressed()
-{
-QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPntVecR->LineEdit1 ||
-      send == GroupPntVecR->LineEdit2 ||
-      send == Group3Pnts->LineEdit1 ||
-      send == Group3Pnts->LineEdit2 ||
-      send == Group3Pnts->LineEdit3) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -529,21 +471,14 @@ static bool isEqual (const GEOM::GEOM_Object_var& thePnt1, const GEOM::GEOM_Obje
 //=================================================================================
 bool PrimitiveGUI_DiskDlg::isValid (QString& msg)
 {
-  bool ok = true;
-  if( getConstructorId() == 0 )
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-  else if( getConstructorId() == 1 )
-    ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-
-  const int id = getConstructorId();
-  if (id == 0)
-    return ok;
-  else if (id == 1)
-    return !myPoint->_is_nil() && !myDir->_is_nil() && getRadius() > 0 && ok;
-  else if (id == 2)
-    return !myPoint1->_is_nil() && !myPoint2->_is_nil() && !myPoint3->_is_nil() &&
-      !isEqual(myPoint1, myPoint2) && !isEqual(myPoint1, myPoint3) && !isEqual(myPoint2, myPoint3);
-  return false;
+  bool ok = false;
+  if ( getConstructorId() == 0 )
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && getRadius() > 0;
+  else if ( getConstructorId() == 1 )
+    ok = GroupPntVecR->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint && myDir && getRadius() > 0;
+  else if ( getConstructorId() == 2 )
+    ok = myPoint1 && myPoint2 && myPoint3 && myPoint1 != myPoint2 && myPoint1 != myPoint3 && myPoint2 != myPoint3;
+  return ok;
 }
 
 //=================================================================================
@@ -570,7 +505,7 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
     res = true;
     break;
   case 1:
-    anObj = anOper->MakeDiskPntVecR(myPoint, myDir, getRadius());
+    anObj = anOper->MakeDiskPntVecR(myPoint.get(), myDir.get(), getRadius());
     if (!anObj->_is_nil() && !IsPreview())
     {
       aParameters << GroupPntVecR->SpinBox_DX->text();
@@ -579,7 +514,7 @@ bool PrimitiveGUI_DiskDlg::execute (ObjectList& objects)
     res = true;
     break;
   case 2:
-    anObj = anOper->MakeDiskThreePnt(myPoint1, myPoint2, myPoint3);
+    anObj = anOper->MakeDiskThreePnt(myPoint1.get(), myPoint2.get(), myPoint3.get());
     res = true;
     break;
   }
@@ -612,18 +547,17 @@ double PrimitiveGUI_DiskDlg::getRadius() const
 //=================================================================================
 void PrimitiveGUI_DiskDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
   switch (getConstructorId()) {
   case 1:
-    objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
-    objMap[GroupPntVecR->LineEdit2->text()] = myDir;
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myDir.get() );
     break;
   case 2:
-    objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
-    objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
-    objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+    GEOMBase::PublishSubObject( myPoint1.get() );
+    GEOMBase::PublishSubObject( myPoint2.get() );
+    GEOMBase::PublishSubObject( myPoint3.get() );
+    break;
+  default:
     break;
   }
-  addSubshapesToFather(objMap);
 }
index e7f4e9cc279a6dbe84c731e42001c08ff63260f2..bd7708b052dd39167ac8e37d8c8c067044f9bca7 100755 (executable)
@@ -24,7 +24,8 @@
 #ifndef BASICGUI_DISKDLG_H
 #define BASICGUI_DISKDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_3Sel;
 class DlgRef_2Sel1Spin;
@@ -58,7 +59,7 @@ private:
   int                                myOrientationType;
 
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir, myPoint1, myPoint2, myPoint3;
+  GEOM::GeomObjPtr                   myPoint, myDir, myPoint1, myPoint2, myPoint3;
 
   DlgRef_2Sel1Spin*                  GroupPntVecR;
   DlgRef_3Sel*                       Group3Pnts;
@@ -74,7 +75,6 @@ private slots:
   void                               SelectionIntoArgument();
 
   void                               ConstructorsClicked( int );
-  void                               LineEditReturnPressed();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox();
   void                               SetDoubleSpinBoxStep( double );
index b5b4b4aaf3407417891e22e3486f31fc41d08e56..2cb125bbb1c50fa70cf7a854a5f0fd8250633161 100755 (executable)
@@ -124,8 +124,8 @@ void PrimitiveGUI_FaceDlg::Init()
   /* init variables */
   myEditCurrentArgument = GroupPlane->LineEdit1;
   GroupType->RadioButton1->setChecked(true);
-  myEdge = GEOM::GEOM_Object::_nil();
-  myFace = GEOM::GEOM_Object::_nil();
+  myEdge.nullify();
+  myFace.nullify();
   globalSelection(); // close local contexts, if any
   //  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
@@ -159,7 +159,6 @@ void PrimitiveGUI_FaceDlg::Init()
   connect( buttonApply(),  SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
 
   connect( GroupPlane->PushButton1,  SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupPlane->LineEdit1,    SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
   connect( GroupPlane->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
   connect( GroupPlane->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
 
@@ -233,6 +232,10 @@ void PrimitiveGUI_FaceDlg::TypeButtonClicked()
     localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
     GroupPlane->TextLabel1->setText( tr( "GEOM_FACE" ) );
   }
+  myEditCurrentArgument = GroupPlane->LineEdit1;
+  myEditCurrentArgument->setText( "" );
+  myEdge.nullify();
+  myFace.nullify();
 }
 
 //=================================================================================
@@ -287,8 +290,8 @@ void PrimitiveGUI_FaceDlg::ConstructorsClicked( int constructorId )
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
       myEditCurrentArgument = GroupPlane->LineEdit1;
       myEditCurrentArgument->setText("");
-      myEdge = GEOM::GEOM_Object::_nil();
-      myFace = GEOM::GEOM_Object::_nil();
+      myEdge.nullify();
+      myFace.nullify();
       GroupType->RadioButton1->setChecked( true );
       TypeButtonClicked();
       GroupDimensions->hide();
@@ -324,54 +327,24 @@ void PrimitiveGUI_FaceDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if ( aSelList.Extent() != 1 ) {
-    if ( myEditCurrentArgument == GroupPlane->LineEdit1 )  myEdge = GEOM::GEOM_Object::_nil();
+    if ( myEditCurrentArgument == GroupPlane->LineEdit1 )  myEdge.nullify();
     return;
   }
 
-  // nbSel == 1 
-  TopAbs_ShapeEnum aNeedType = TopAbs_EDGE;
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-  if ( !CORBA::is_nil( aSelectedObject ) ) {
-    QString aName = GEOMBase::GetName( aSelectedObject );
-    
-    TopoDS_Shape aShape;
-    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
-      if (GroupType->RadioButton2->isChecked())
-        aNeedType = TopAbs_FACE;
-
-      TColStd_IndexedMapOfInteger aMap;
-      aSelMgr->GetIndexes( aSelList.First(), aMap );
-      if ( aMap.Extent() == 1 ) { // Local Selection
-        int anIndex = aMap( 1 );
-        if ( aNeedType == TopAbs_EDGE )
-          aName += QString( ":edge_%1" ).arg( anIndex );
-        else
-          aName += QString( ":face_%1" ).arg( anIndex );
-
-        //Find SubShape Object in Father
-        GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
-
-        if ( aFindedObject->_is_nil() ) { // Object not found in study
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-          aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-        }
-        else
-          aSelectedObject = aFindedObject; // get Object from study
-      }
-      else { // Global Selection
-        if ( aShape.ShapeType() != aNeedType ) {
-          aSelectedObject = GEOM::GEOM_Object::_nil();
-          aName = "";
-        }
-      }
-    }
+  TopAbs_ShapeEnum aNeedType = GroupType->RadioButton2->isChecked() ? TopAbs_FACE : TopAbs_EDGE;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
+  TopoDS_Shape aShape;
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
 
     myEditCurrentArgument->setText( aName );
+    
     if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_EDGE )
       myEdge = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPlane->LineEdit1 && aNeedType == TopAbs_FACE )
       myFace = aSelectedObject;
   }
+
   displayPreview();
 }
 
@@ -397,20 +370,6 @@ void PrimitiveGUI_FaceDlg::SetEditCurrentArgument()
   SelectionIntoArgument();
 }
 
-
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_FaceDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupPlane->LineEdit1 )  myEditCurrentArgument = GroupPlane->LineEdit1;
-  else return;
-  GEOMBase_Skeleton::LineEditReturnPressed();
-}
-
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -458,28 +417,19 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_FaceDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_FaceDlg::isValid( QString& msg )
 {
-  bool ok = true;
+  bool ok = false;
   if( getConstructorId() == 0 )
   {
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() );
   }
   else if( getConstructorId() == 1 )
   {
-    ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPlane->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupPlane->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         ( GroupType->RadioButton1->isChecked() ? myEdge : myFace );
   }
-
-  const int id = getConstructorId();
-  if ( id == 0 )
-    return ok;
-  else if ( id == 1 ) {
-    if (GroupType->RadioButton1->isChecked())
-      return !myEdge->_is_nil() && ok;
-    else if (GroupType->RadioButton2->isChecked())
-      return !myFace->_is_nil() && ok;
-  }
-  return false;
+  return ok;
 }
 
 //=================================================================================
@@ -508,8 +458,8 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
     break;
   case 1:
     anObj = GroupType->RadioButton1->isChecked() ? 
-      anOper->MakeFaceObjHW(myEdge, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) : 
-      anOper->MakeFaceObjHW(myFace, GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
+      anOper->MakeFaceObjHW(myEdge.get(), GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value()) : 
+      anOper->MakeFaceObjHW(myFace.get(), GroupPlane->SpinBox_DX->value(), GroupPlane->SpinBox_DY->value());
     if (!anObj->_is_nil() && !IsPreview())
     {
       aParameters << GroupPlane->SpinBox_DX->text();
@@ -532,14 +482,10 @@ bool PrimitiveGUI_FaceDlg::execute (ObjectList& objects)
 //=================================================================================
 void PrimitiveGUI_FaceDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-  switch ( getConstructorId() ) {
-  case 1 :
+  if ( getConstructorId() == 1 ) {
     if ( GroupType->RadioButton1->isChecked() )
-      objMap[GroupPlane->LineEdit1->text()] = myEdge;
+     GEOMBase::PublishSubObject( myEdge.get() );
     if ( GroupType->RadioButton2->isChecked() )
-      objMap[GroupPlane->LineEdit1->text()] = myFace;
-    break;
+     GEOMBase::PublishSubObject( myFace.get() );
   }
-  addSubshapesToFather( objMap );
 }
index f4def5b7f638da5c2c534f6c220bb8de5c2c6afe..6d657ad107083f1ac034d51e9ccae36d3333e9d6 100755 (executable)
@@ -24,7 +24,8 @@
 #ifndef BASICGUI_FACEDLG_H
 #define BASICGUI_FACEDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Spin;
 class DlgRef_1Sel2Spin;
@@ -54,8 +55,8 @@ private:
   void                               enterEvent( QEvent* );
   
 private:
-  GEOM::GEOM_Object_var              myEdge;
-  GEOM::GEOM_Object_var              myFace;
+  GEOM::GeomObjPtr                   myEdge;
+  GEOM::GeomObjPtr                   myFace;
 
   int                                myOrientationType;
   
@@ -72,7 +73,6 @@ private slots:
   void                               DeactivateActiveDialog();
   void                               ConstructorsClicked( int );    
     
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ValueChangedInSpinBox( double );
index 1102a37a5c5042118c7bf4a72e0e659b0d606fa7..fab3651b22bfd7d2885b542d8d283d2adbe0a266 100644 (file)
@@ -109,7 +109,7 @@ void PrimitiveGUI_SphereDlg::Init()
   myEditCurrentArgument = GroupPoints->LineEdit1;
   GroupPoints->LineEdit1->setReadOnly( true );
   
-  myPoint = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
   
   /* Get setting of step value from file configuration */
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
@@ -128,7 +128,6 @@ void PrimitiveGUI_SphereDlg::Init()
   connect( this,          SIGNAL( constructorsClicked( int ) ), this, SLOT( ConstructorsClicked( int ) ) );
 
   connect( GroupPoints->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
-  connect( GroupPoints->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
 
   connect( GroupDimensions->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
   connect( GroupPoints->SpinBox_DX,     SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox() ) );
@@ -173,7 +172,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked( int constructorId )
       
       myEditCurrentArgument = GroupPoints->LineEdit1;
       GroupPoints->LineEdit1->setText( "" );
-      myPoint = GEOM::GEOM_Object::_nil();
+      myPoint.nullify();
       
       connect( myGeomGUI->getApp()->selectionMgr(), 
                SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );
@@ -241,65 +240,21 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
   aSelMgr->selectedObjects(aSelList);
 
   if (aSelList.Extent() != 1) {
-    myPoint = GEOM::GEOM_Object::_nil();
+    myPoint.nullify();
     return;
   }
 
-  /* nbSel == 1 ! */
-  GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if ( CORBA::is_nil( aSelectedObject ) )
-    return;
-  QString aName = GEOMBase::GetName( aSelectedObject );
+  GEOM::GeomObjPtr aSelectedObject = getSelected( TopAbs_VERTEX );
   TopoDS_Shape aShape;
-  if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull() ) {
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if ( aMap.Extent() == 1 ) { // Local Selection
-      int anIndex = aMap( 1 );
-      aName.append( ":vertex_" + QString::number( anIndex ) );
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName );
-
-      if ( aFindedObject->_is_nil() ) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          getGeomEngine()->GetIShapesOperations( getStudyId() );
-        aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study
-      }
-    }
-    else { // Global Selection
-      if (aShape.ShapeType() != TopAbs_VERTEX) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
-    }
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+    myEditCurrentArgument->setText( aName );
+    myPoint = aSelectedObject;
   }
 
-  myEditCurrentArgument->setText( aName );
-  myPoint = aSelectedObject;
-
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_SphereDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupPoints->LineEdit1 ) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
-
 //=================================================================================
 // function : SetEditCurrentArgument()
 // purpose  :
@@ -379,12 +334,12 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_SphereDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_SphereDlg::isValid( QString& msg  )
 {
-  bool ok = true;
+  bool ok = false;
   if( getConstructorId() == 0 )
-    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && myPoint;
   else if( getConstructorId() == 1 )
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-  return getConstructorId() == 0 ? !myPoint->_is_nil() && ok : ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() );
+  return ok;
 }
 
 //=================================================================================
@@ -402,8 +357,8 @@ bool PrimitiveGUI_SphereDlg::execute( ObjectList& objects )
   switch ( getConstructorId() ) {
   case 0 :
     {
-      if ( !CORBA::is_nil( myPoint ) ) {
-        anObj = anOper->MakeSpherePntR( myPoint, getRadius() );
+      if ( myPoint ) {
+        anObj = anOper->MakeSpherePntR( myPoint.get(), getRadius() );
         if (!anObj->_is_nil() && !IsPreview())
         {
           QStringList aParameters;
@@ -455,14 +410,7 @@ double PrimitiveGUI_SphereDlg::getRadius() const
 //=================================================================================
 void PrimitiveGUI_SphereDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  switch ( getConstructorId() ) {
-  case 0:
-    objMap[GroupPoints->LineEdit1->text()] = myPoint;
-    break;
-  case 1:
-    return;
+  if ( getConstructorId() == 0 ) {
+    GEOMBase::PublishSubObject( myPoint.get() );
   }
-  addSubshapesToFather( objMap );
 }
index 8f288af120ce9fb25c20d8c456b9cfb62a0dedd0..1c82622c273f45ca6a6c652fc85d293cfa8f7915 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef PRIMITIVEGUI_SPHEREDLG_H
 #define PRIMITIVEGUI_SPHEREDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_1Sel1Spin;
 class DlgRef_1Spin;
@@ -57,7 +58,7 @@ private:
   double                             getRadius() const;
   
 private:
-  GEOM::GEOM_Object_var              myPoint; /* Center point */
+  GEOM::GeomObjPtr                   myPoint; /* Center point */
   
   DlgRef_1Sel1Spin*                  GroupPoints;
   DlgRef_1Spin*                      GroupDimensions;
@@ -67,7 +68,6 @@ private slots:
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
   void                               DeactivateActiveDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );
index 3b7ba62aa1ce83b9557218931fce8479a5d7e713..f709fd9a25a8f06cfe362e33186f30290bca4fa2 100644 (file)
@@ -126,7 +126,8 @@ void PrimitiveGUI_TorusDlg::Init()
 
   GroupPoints->LineEdit1->setText("");
   GroupPoints->LineEdit2->setText("");
-  myPoint = myDir = GEOM::GEOM_Object::_nil();
+  myPoint.nullify();
+  myDir.nullify();
 
   GroupPoints->SpinBox_DX->setValue(300.0);
   GroupPoints->SpinBox_DY->setValue(100.0);
@@ -142,9 +143,6 @@ void PrimitiveGUI_TorusDlg::Init()
   connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
   connect(GroupPoints->PushButton2, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
 
-  connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-  connect(GroupPoints->LineEdit2, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
-
   connect(GroupPoints->SpinBox_DX,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupPoints->SpinBox_DY,     SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
   connect(GroupDimensions->SpinBox_DX, SIGNAL(valueChanged(double)), this, SLOT(ValueChangedInSpinBox()));
@@ -242,80 +240,42 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
   erasePreview();
   myEditCurrentArgument->setText("");
 
-  if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint = GEOM::GEOM_Object::_nil();
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir   = GEOM::GEOM_Object::_nil();
-
   LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
   SALOME_ListIO aSelList;
   aSelMgr->selectedObjects(aSelList);
 
-  if (aSelList.Extent() != 1)
-    return;
-
-  // nbSel == 1
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( aSelList.First() );
-
-  if ( CORBA::is_nil(aSelectedObject) )
+  if (aSelList.Extent() != 1) {
+    if      (myEditCurrentArgument == GroupPoints->LineEdit1) myPoint.nullify();
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) myDir.nullify();
     return;
+  }
 
-  QString aName = GEOMBase::GetName(aSelectedObject);
-
-  // Get Selected object if selected subshape
+  TopAbs_ShapeEnum aNeedType = myEditCurrentArgument == GroupPoints->LineEdit2 ? TopAbs_EDGE : TopAbs_VERTEX;
+  GEOM::GeomObjPtr aSelectedObject = getSelected( aNeedType );
   TopoDS_Shape aShape;
-  if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
-  {
-    TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
-    if (myEditCurrentArgument == GroupPoints->LineEdit2)
-      aNeedType = TopAbs_EDGE;
-
-    TColStd_IndexedMapOfInteger aMap;
-    aSelMgr->GetIndexes(aSelList.First(), aMap);
-    if (aMap.Extent() == 1) { // Local Selection
-      int anIndex = aMap(1);
-      if (aNeedType == TopAbs_EDGE)
-        aName.append(":edge_" + QString::number(anIndex));
-      else
-        aName.append(":vertex_" + QString::number(anIndex));
-
-      //Find SubShape Object in Father
-      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
-
-      if (aFindedObject->_is_nil()) { // Object not found in study
-        GEOM::GEOM_IShapesOperations_var aShapesOp =
-          getGeomEngine()->GetIShapesOperations(getStudyId());
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      }
-      else {
-        aSelectedObject = aFindedObject; // get Object from study
-      }
+  if ( aSelectedObject && GEOMBase::GetShape( aSelectedObject.get(), aShape ) && !aShape.IsNull() ) {
+    QString aName = GEOMBase::GetName( aSelectedObject.get() );
+
+    myEditCurrentArgument->setText(aName);
+    
+    // clear selection
+    disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
+    myGeomGUI->getApp()->selectionMgr()->clearSelected();
+    connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
+           this, SLOT(SelectionIntoArgument()));
+    
+    if (myEditCurrentArgument == GroupPoints->LineEdit1) {
+      myPoint = aSelectedObject;
+      if (myPoint && !myDir)
+       GroupPoints->PushButton2->click();
     }
-    else { // Global Selection
-      if (aShape.ShapeType() != aNeedType) {
-        aSelectedObject = GEOM::GEOM_Object::_nil();
-        aName = "";
-      }
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+      myDir = aSelectedObject;
+      if (myDir && !myPoint)
+       GroupPoints->PushButton1->click();
     }
   }
 
-  myEditCurrentArgument->setText(aName);
-
-  // clear selection
-  disconnect(myGeomGUI->getApp()->selectionMgr(), 0, this, 0);
-  myGeomGUI->getApp()->selectionMgr()->clearSelected();
-  connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()),
-          this, SLOT(SelectionIntoArgument()));
-
-  if (myEditCurrentArgument == GroupPoints->LineEdit1) {
-    myPoint = aSelectedObject;
-    if (!myPoint->_is_nil() && myDir->_is_nil())
-      GroupPoints->PushButton2->click();
-  }
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-    myDir = aSelectedObject;
-    if (!myDir->_is_nil() && myPoint->_is_nil())
-      GroupPoints->PushButton1->click();
-  }
-
   displayPreview();
 }
 
@@ -359,20 +319,6 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
   displayPreview();
 }
 
-//=================================================================================
-// function : LineEditReturnPressed()
-// purpose  :
-//=================================================================================
-void PrimitiveGUI_TorusDlg::LineEditReturnPressed()
-{
-  QLineEdit* send = (QLineEdit*)sender();
-  if (send == GroupPoints->LineEdit1 ||
-      send == GroupPoints->LineEdit2) {
-    myEditCurrentArgument = send;
-    GEOMBase_Skeleton::LineEditReturnPressed();
-  }
-}
-
 //=================================================================================
 // function : ActivateThisDialog()
 // purpose  :
@@ -421,18 +367,19 @@ GEOM::GEOM_IOperations_ptr PrimitiveGUI_TorusDlg::createOperation()
 //=================================================================================
 bool PrimitiveGUI_TorusDlg::isValid (QString& msg)
 {
-  bool ok = true;
+  bool ok = false;
   if( getConstructorId() == 0 )
   {
-    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupPoints->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupPoints->SpinBox_DY->isValid( msg, !IsPreview() ) &&
+         myPoint && myDir;
   }
   else if( getConstructorId() == 1 )
   {
-    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) && ok;
-    ok = GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() ) && ok;
+    ok = GroupDimensions->SpinBox_DX->isValid( msg, !IsPreview() ) &&
+         GroupDimensions->SpinBox_DY->isValid( msg, !IsPreview() );
   }
-  return getConstructorId() == 0 ? !(myPoint->_is_nil() || myDir->_is_nil()) && ok : ok;
+  return ok;
 }
 
 //=================================================================================
@@ -449,8 +396,8 @@ bool PrimitiveGUI_TorusDlg::execute (ObjectList& objects)
 
   switch (getConstructorId()) {
   case 0:
-    if (!CORBA::is_nil(myPoint) && !CORBA::is_nil(myDir)) {
-      anObj = anOper->MakeTorusPntVecRR(myPoint, myDir, getRadius1(), getRadius2());
+    if ( myPoint && myDir ) {
+      anObj = anOper->MakeTorusPntVecRR(myPoint.get(), myDir.get(), getRadius1(), getRadius2());
       if (!anObj->_is_nil() && !IsPreview())
       {
         QStringList aParameters;
@@ -514,15 +461,8 @@ double PrimitiveGUI_TorusDlg::getRadius2() const
 //=================================================================================
 void PrimitiveGUI_TorusDlg::addSubshapesToStudy()
 {
-  QMap<QString, GEOM::GEOM_Object_var> objMap;
-
-  switch (getConstructorId()) {
-  case 0:
-    objMap[GroupPoints->LineEdit1->text()] = myPoint;
-    objMap[GroupPoints->LineEdit2->text()] = myDir;
-    break;
-  case 1:
-    return;
+  if ( getConstructorId() == 0 ) {
+    GEOMBase::PublishSubObject( myPoint.get() );
+    GEOMBase::PublishSubObject( myDir.get() );
   }
-  addSubshapesToFather(objMap);
 }
index 8cc2a57e2de76cf14278236a20fbc9d2878ec0a9..1cd406a5c7707fc7b83e11d41b3a65d0522fdb23 100644 (file)
@@ -27,7 +27,8 @@
 #ifndef PRIMITIVEGUI_TORUSDLG_H
 #define PRIMITIVEGUI_TORUSDLG_H
 
-#include <GEOMBase_Skeleton.h>
+#include "GEOMBase_Skeleton.h"
+#include "GEOM_GenericObjPtr.h"
 
 class DlgRef_2Sel2Spin;
 class DlgRef_2Spin;
@@ -58,7 +59,7 @@ private:
   double                             getRadius2() const;
   
 private:
-  GEOM::GEOM_Object_var              myPoint, myDir;
+  GEOM::GeomObjPtr                   myPoint, myDir;
 
   DlgRef_2Sel2Spin*                  GroupPoints;
   DlgRef_2Spin*                      GroupDimensions;
@@ -67,7 +68,6 @@ private slots:
   void                               ClickOnOk();
   bool                               ClickOnApply();
   void                               ActivateThisDialog();
-  void                               LineEditReturnPressed();
   void                               SelectionIntoArgument();
   void                               SetEditCurrentArgument();
   void                               ConstructorsClicked( int );