]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL 18378
authordmv <dmv@opencascade.com>
Wed, 26 Dec 2007 12:52:34 +0000 (12:52 +0000)
committerdmv <dmv@opencascade.com>
Wed, 26 Dec 2007 12:52:34 +0000 (12:52 +0000)
47 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_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_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/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx
src/GEOMBase/GEOMBase_Helper.cxx
src/GEOMBase/GEOMBase_Helper.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/OperationGUI/OperationGUI_ChamferDlg.cxx
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_SphereDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_SphereDlg.h
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.h
src/TransformationGUI/TransformationGUI_MirrorDlg.cxx
src/TransformationGUI/TransformationGUI_MirrorDlg.h
src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
src/TransformationGUI/TransformationGUI_MultiRotationDlg.h
src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
src/TransformationGUI/TransformationGUI_MultiTranslationDlg.h
src/TransformationGUI/TransformationGUI_RotationDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.h
src/TransformationGUI/TransformationGUI_ScaleDlg.cxx
src/TransformationGUI/TransformationGUI_ScaleDlg.h
src/TransformationGUI/TransformationGUI_TranslationDlg.cxx
src/TransformationGUI/TransformationGUI_TranslationDlg.h

index b894242d9fb024f88e66f382e3b9b4b6ae66deda..46e1434e4973b0888ce0aa644e59e9cd2ba74f90 100644 (file)
@@ -299,12 +299,18 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
       aSelMgr->GetIndexes(firstIObject(), aMap);
       if (aMap.Extent() == 1) // Local Selection
       {
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
         int anIndex = aMap(1);
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        aSelMgr->clearSelected(); // ???
-
         aName += QString(":vertex_%1").arg(anIndex);
+
+       //Find SubShape Object in Father
+       GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+       if ( aFindedObject == GEOM::GEOM_Object::_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
       {
@@ -486,3 +492,27 @@ void BasicGUI_ArcDlg::ReverseSense(int sense)
 {
   displayPreview();
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+  }
+ addSubshapesToFather( objMap );
+}
index d2fa847b771c2ea5000fa021dda2cd2ebb7ee2a0..485ce7931fb8ca024c907c00bc514b74d74542e8 100644 (file)
@@ -56,6 +56,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
+    virtual void addSubshapesToStudy();
 
 private:
     void Init();
index 9fe4edf76ceff08c3b56f189aa2e1ad8566f72cb..6245a874bc168d9bed2a30f040e077f0ce771963 100644 (file)
@@ -328,18 +328,21 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
       aSelMgr->GetIndexes(anIO, aMap);
       if (aMap.Extent() == 1) // Local Selection
       {
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
         int anIndex = aMap(1);
-        TopTools_IndexedMapOfShape aShapes;
-        TopExp::MapShapes(aShape, aShapes);
-        aShape = aShapes.FindKey(anIndex);
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        aSelMgr->clearSelected(); // ???
-
         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 == GEOM::GEOM_Object::_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
       {
@@ -555,3 +558,31 @@ void BasicGUI_CircleDlg::closeEvent (QCloseEvent* e)
 {
   GEOMBase_Skeleton::closeEvent(e);
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_CircleDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+  {
+  case 0:
+    objMap[GroupPntVecR->LineEdit1->text()] = myPoint;
+    objMap[GroupPntVecR->LineEdit2->text()] = myDir;
+    break;
+  case 1:
+    objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+    objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+    objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+    break;
+  case 2:
+    objMap[GroupCenter2Pnts->LineEdit1->text()] = myPoint4;
+    objMap[GroupCenter2Pnts->LineEdit2->text()] = myPoint5;
+    objMap[GroupCenter2Pnts->LineEdit3->text()] = myPoint6;
+    break;
+  }
+ addSubshapesToFather( objMap );
+}
index c97ab51ed93050628c2d731f6cbe5a4d38a21c94..698bec7f12d84e84638ec97872c30374f677a7f8 100644 (file)
@@ -60,8 +60,8 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
     virtual void closeEvent( QCloseEvent* e );    
+    virtual void addSubshapesToStudy();
 
 private:
     void   Init();
index dcb7efd5cb86af0bea6a942b9ad2c9ce5dfbf4c5..75909f4f68c0c1e7745876b029a6fa9cbdb9711b 100644 (file)
@@ -231,15 +231,21 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
       aSelMgr->GetIndexes(anIO, aMap);
       if (aMap.Extent() == 1)
       {
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
         int anIndex = aMap(1);
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        aSelMgr->clearSelected(); // ???
-
         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 == GEOM::GEOM_Object::_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
       {
@@ -398,3 +404,16 @@ void BasicGUI_EllipseDlg::closeEvent( QCloseEvent* e )
   GEOMBase_Skeleton::closeEvent( e );
 }
 
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_EllipseDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+  objMap[GroupPoints->LineEdit1->text()] = myPoint;
+  objMap[GroupPoints->LineEdit2->text()] = myDir;
+
+  addSubshapesToFather( objMap );
+}
index f3c5db3ac2effd541b021752c2367e2a72866f38..31fa1ad1ec0a3fc8834edb7ca41968908afafe8e 100644 (file)
@@ -58,8 +58,8 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
     virtual void closeEvent( QCloseEvent* e );
+    virtual void addSubshapesToStudy();
 
 private :
     void Init();
index 6e3a7c4ef225bcaa1a30fbfb982daba2517102da..17451f04963db90bbfb97fbd0e33430303257942 100644 (file)
@@ -172,6 +172,7 @@ void BasicGUI_LineDlg::ClickOnCancel()
 //=================================================================================
 bool BasicGUI_LineDlg::ClickOnApply()
 {
+
   if ( !onAccept() )
     return false;
 
@@ -244,7 +245,7 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
   if (!CORBA::is_nil(aSelectedObject) && aRes)
   {
     QString aName = GEOMBase::GetName(aSelectedObject);
-
+    
     TopoDS_Shape aShape;
     if (GEOMBase::GetShape(aSelectedObject, aShape, TopAbs_SHAPE) && !aShape.IsNull())
     {
@@ -258,15 +259,21 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
       aSelMgr->GetIndexes(firstIObject(), aMap);
       if (aMap.Extent() == 1) // Local Selection
       {
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-        int anIndex = aMap( 1 );
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        aSelMgr->clearSelected(); // ???
-
+       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 == GEOM::GEOM_Object::_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
       {
@@ -410,3 +417,20 @@ void BasicGUI_LineDlg::closeEvent( QCloseEvent* e )
 {
   GEOMBase_Skeleton::closeEvent( e );
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_LineDlg::addSubshapesToStudy()
+{
+  if (getConstructorId() != 0)
+    return;
+
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+  objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+  objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+
+  addSubshapesToFather( objMap );
+}
index ef0f2bd3737588531efca5a2b921a5fdb27b8bb1..ed6484d68cf06713904c5fc554f316fcebbacf1e 100644 (file)
@@ -57,6 +57,7 @@ protected:
     virtual bool execute( ObjectList& objects );
 
     virtual void closeEvent( QCloseEvent* e );
+    virtual void addSubshapesToStudy();
     
 private :
     void Init();
index 88ade8405018a782b68486b8a8d634f2d01e49f4..c56e5d3fe55f4b46b37550439998e31e1976b324 100644 (file)
@@ -451,14 +451,14 @@ void BasicGUI_MarkerDlg::onSelectionDone()
 
           if (!aMap.IsEmpty()) {
             int anIndex = aMap(1);
-            TopTools_IndexedMapOfShape aShapes;
-            TopExp::MapShapes(aShape, aShapes);
-            aShape = aShapes.FindKey(anIndex);
-
             if (aNeedType == TopAbs_EDGE)
               aName += QString("_edge_%1").arg(anIndex);
             else
               aName += QString("_vertex_%1").arg(anIndex);
+
+            TopTools_IndexedMapOfShape aShapes;
+            TopExp::MapShapes(aShape, aShapes);
+            aShape = aShapes.FindKey(anIndex);
           }
 
           if (myEditCurrentArgument == Group2->LineEdit1) {
index 4216a12395d1de176d216672ad4d174bd92fda92..5b970481e1cbbc29f4e071f4a731648940be4480 100644 (file)
@@ -335,17 +335,24 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
       aSelMgr->GetIndexes(firstIObject(), aMap);
       if (aMap.Extent() == 1) // Local Selection
       {
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-        int anIndex = aMap(1);
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        aSelMgr->clearSelected(); // ???
 
+        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 == GEOM::GEOM_Object::_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
       {
@@ -563,3 +570,28 @@ void BasicGUI_PlaneDlg::closeEvent( QCloseEvent* e )
   GEOMBase_Skeleton::closeEvent( e );
 }
 
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+    break;
+  case 1:
+    objMap[Group3Pnts->LineEdit1->text()] = myPoint1;
+    objMap[Group3Pnts->LineEdit2->text()] = myPoint2;
+    objMap[Group3Pnts->LineEdit3->text()] = myPoint3;
+    break;
+  case 2:
+    objMap[GroupFace->LineEdit1->text()] = myFace;
+    break;
+  }
+ addSubshapesToFather( objMap );
+}
index c03f934c0427a9cd17be2a1ea6500e707f2975e0..776ecfb5386e39efb7faf61e34f7f5fba25faba7 100644 (file)
@@ -57,7 +57,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private :
index 85cf23b03b6d9213766a800f3ba452c5fe652265..0ad39e8b0e818c0c3269f9d7298009d016d53eeb 100644 (file)
@@ -386,15 +386,21 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
         aSelMgr->GetIndexes(firstIObject(), aMap);
         if (aMap.Extent() == 1) // Local Selection
         {
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
           int anIndex = aMap(1);
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-          aSelMgr->clearSelected(); // ???
-
           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 == GEOM::GEOM_Object::_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
         {
@@ -669,3 +675,29 @@ void BasicGUI_PointDlg::closeEvent( QCloseEvent* e )
 {
   GEOMBase_Skeleton::closeEvent( e );
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void BasicGUI_PointDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+  {
+  case 0:
+    break;
+  case 1:
+    objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
+    break;
+  case 2:
+    objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
+    break;
+  case 3:
+    objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
+    objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
+    break;
+  }
+ addSubshapesToFather( objMap );
+}
index cb4b02d60f83262dee98e390c699a5e0e91c98bd..e82fca247206718ef07cbeca13893b0fd550b382 100644 (file)
@@ -64,7 +64,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private :
index ac2afbfa55e187269472ed249c476c05066a7f4b..46d0a0033a36a18e4d3816ac8cc45f21930113e6 100644 (file)
@@ -287,12 +287,19 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
       aSelMgr->GetIndexes(firstIObject(), aMap);
       if (aMap.Extent() == 1) // Local Selection
       {
-        GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
-        int anIndex = aMap(1);
-        aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-        aSelMgr->clearSelected(); // ???
 
+        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 == GEOM::GEOM_Object::_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
       {
@@ -447,3 +454,23 @@ bool BasicGUI_VectorDlg::execute( ObjectList& objects )
 
   return res;
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+  }
+ addSubshapesToFather( objMap );
+}
index 1656038f8363ee9b2cfa53c956ebb5ca81af3442..8915e813a43306b63a546f51f5f558dca0fe05c5 100644 (file)
@@ -58,6 +58,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
+    virtual void addSubshapesToStudy();
 
 private :
     void Init();
index 6ff682163d7fad5b739015d15b29db2cf00e874f..e672b56af15c5a3d8dc4109cd704df2ac2f7071c 100644 (file)
@@ -223,7 +223,7 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId)
 
         myEditCurrentArgument = Group2->LineEdit1;
         Group2->LineEdit1->setText("");
-         Group2->LineEdit2->setText("");
+       Group2->LineEdit2->setText("");
         myVectX = GEOM::GEOM_Object::_nil();
         myVectZ = GEOM::GEOM_Object::_nil();
 
@@ -328,17 +328,15 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
         aSelMgr->GetIndexes( firstIObject(), aMap );
         if ( aMap.Extent() == 1 )
         {
-          GEOM::GEOM_IShapesOperations_var aShapesOp =
-            getGeomEngine()->GetIShapesOperations( getStudyId() );
           int anIndex = aMap( 1 );
-          TopTools_IndexedMapOfShape aShapes;
-          TopExp::MapShapes( aShape, aShapes );
-          aShape = aShapes.FindKey( anIndex );
           aName = aName + ":edge_" + QString::number( anIndex );
-          if(myEditCurrentArgument == Group2->LineEdit1)
-            myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-          else
-            myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+
+         GEOM::GEOM_IShapesOperations_var aShapesOp =
+           getGeomEngine()->GetIShapesOperations( getStudyId() );
+         if(myEditCurrentArgument == Group2->LineEdit1)
+           myVectX = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         else
+           myVectZ = aShapesOp->GetSubShape(aSelectedObject, anIndex);
         }
         else {
           if (myEditCurrentArgument == Group2->LineEdit1)
@@ -581,3 +579,4 @@ bool BasicGUI_WorkingPlaneDlg::updateWPlane( const bool showPreview )
 
   return true;
 }
+
index 7fdc7a14c042749644f669ea6dd7a38cd9afe72d..95ff8f0ec06fca07cac5848950a7bc97519ce146 100755 (executable)
@@ -770,6 +770,7 @@ bool GEOMBase_Helper::onAccept( const bool publish, const bool useTransaction )
        showError();
       }
       else {
+       addSubshapesToStudy(); // add Subshapes if local selection
        const int nbObjs = objects.size();
         int aNumber = 1;
        for ( ObjectList::iterator it = objects.begin(); it != objects.end(); ++it ) {
@@ -1025,8 +1026,74 @@ bool GEOMBase_Helper::selectObjects( ObjectList& objects )
   return true;
 }
   
-
-  
+//================================================================
+// 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, const char* theName)
+{
+  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();
+  string IOR = GEOMBase::GetIORFromObject( theFather );
+  _PTR(SObject) SObj ( aDStudy->FindObjectIOR( IOR ) );
+
+  bool inStudy = false;
+  GEOM::GEOM_Object_var aReturnObject;
+  for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator( SObj )); iit->More(); iit->Next()) {
+    _PTR(SObject) child (iit->Value());
+    QString aChildName = child->GetName();
+    if (aChildName == theName) {
+      inStudy = true;
+      CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value());
+      aReturnObject = GEOM::GEOM_Object::_narrow( corbaObj );
+    }
+  }
+  if (!inStudy)
+    return GEOM::GEOM_Object::_nil();
+  else
+    return aReturnObject._retn();
+}
   
+//================================================================
+// Function : addSubshapesToStudy
+// Purpose  : Virtual method to add subshapes if needs
+//================================================================  
+void GEOMBase_Helper::addSubshapesToStudy()
+{
+  //Impemented in Dialogs, called from Accept method
+}
+
+//================================================================
+// Function : addSubshapesToFather
+// Purpose  : Method to add Father Subshapes to Study if it`s not exist
+//================================================================  
+void GEOMBase_Helper::addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap )
+{
+  //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();
+
+  GEOM::GEOM_IGroupOperations_var anOp = getGeomEngine()->GetIGroupOperations( getStudyId() );
+  for( QMap<QString, GEOM::GEOM_Object_var>::Iterator it = theMap.begin(); it != theMap.end(); it++ )
+    {
+      if ( !anOp->_is_nil() ) {
+       GEOM::GEOM_Object_var aFatherObj = anOp->GetMainShape( it.data() );
+       GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aFatherObj, it.key() );
+      
+       //Add Object to study if its not exist
+       if ( aFindedObject == GEOM::GEOM_Object::_nil() )
+         GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
+                                             it.data(), it.key(), aFatherObj );
+      }
+      else {
+       //cout << " anOperations is NULL! " << endl;
+      }
+    }
+}  
   
-  
\ No newline at end of file
index f55088e97a7d52af0e22920032fc2c3fc6fcfa7d..211a0070fe1ebb1e1759bdf80ebe5aac8cdf0fed 100755 (executable)
@@ -36,6 +36,7 @@
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
 
 #include <qstring.h>
+#include <qmap.h>
 
 #include <list>
 //#if defined WNT 
@@ -182,6 +183,12 @@ protected:
   // as a top-level object.
 
   virtual const char* getNewObjectName() const; 
+  virtual void addSubshapesToStudy();
+
+  GEOM::GEOM_Object_ptr GEOMBase_Helper::findObjectInFather( GEOM::GEOM_Object_ptr theFather, const char* theName );
+  //This Metod to find SubObject in theFather Object by Name (theName)
+
+  void addSubshapesToFather( QMap<QString, GEOM::GEOM_Object_var>& theMap );
 
   void SetIsPreview(const bool thePreview) {isPreview = thePreview;}
   bool IsPreview() {return isPreview;}
index 356be1f82eabf76047d112637bff32e384222db5..4b315e519cf53cac98f2590a8ee3cc20060c147f 100644 (file)
@@ -218,13 +218,22 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
        aSelMgr->GetIndexes( firstIObject(), aMap );
        if ( aMap.Extent() == 1 )
          {
-           GEOM::GEOM_IShapesOperations_var aShapesOp =
-             getGeomEngine()->GetIShapesOperations( getStudyId() );
            int anIndex = aMap( 1 );
-           myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
            aName.append( ":edge_" + QString::number( anIndex ) );
-           myOkPath = true;
-           aSelMgr->clearSelected();
+
+           //Find SubShape Object in Father
+           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+           
+           if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+             GEOM::GEOM_IShapesOperations_var aShapesOp =
+               getGeomEngine()->GetIShapesOperations( getStudyId() );
+             myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             myOkPath = true;
+           }
+           else {  // get Object from study
+             myPath = aFindedObject;
+             myOkPath = true;
+           }
          }
        else {
          myOkPath = true;
@@ -343,5 +352,16 @@ bool GenerationGUI_PipeDlg::execute( ObjectList& objects )
   return true;
 }
 
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_PipeDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+  objMap[GroupPoints->LineEdit2->text()] = myPath;
 
+  addSubshapesToFather( objMap );
+}
 
index 6921b376011da78c268080ede713f0e4a4348e7a..7272ddae462389e17f62d63edd8d2aed7eb1159a 100644 (file)
@@ -49,6 +49,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& msg );
     virtual bool execute( ObjectList& objects );    
+    virtual void addSubshapesToStudy();
 
 private:
     void Init();
index 82479fa7931876ef209c0bda57f3711d26613b53..0a8419a99d29d20185100303d12343d0494a288f 100644 (file)
@@ -299,12 +299,19 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
        aSelMgr->GetIndexes( firstIObject(), aMap );
        if ( aMap.Extent() == 1 )
          {
-           GEOM::GEOM_IShapesOperations_var aShapesOp =
-             getGeomEngine()->GetIShapesOperations( getStudyId() );
            int anIndex = aMap( 1 );
-           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
            aName.append( ":edge_" + QString::number( anIndex ) );
-           aSelMgr->clearSelected();
+
+           //Find SubShape Object in Father
+           GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+           if ( aFindedObject == GEOM::GEOM_Object::_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 {
          if (aShape.ShapeType() != TopAbs_EDGE && myEditCurrentArgument == GroupPoints->LineEdit2) {
@@ -359,11 +366,18 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
        aSelMgr->GetIndexes( firstIObject(), aMap );
        if (aMap.Extent() == 1)
         {
-          GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
           int anIndex = aMap(1);
-          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
           aName.append(":vertex_" + QString::number(anIndex));
-          aSelMgr->clearSelected();
+
+         //Find SubShape Object in Father
+         GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+           
+         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+           GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations(getStudyId());
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         }
+         else
+           aSelectedObject = aFindedObject;
         }
        else
         {
@@ -585,3 +599,24 @@ void GenerationGUI_PrismDlg::onBothway2()
   myBothway2 = !anOldValue;
   displayPreview();
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_PrismDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+  {
+  case 0:
+    objMap[GroupPoints->LineEdit2->text()] = myVec;
+    break;
+  case 1:
+    objMap[GroupPoints2->LineEdit2->text()] = myPoint1;
+    objMap[GroupPoints2->LineEdit3->text()] = myPoint2;
+    break;
+  }
+ addSubshapesToFather( objMap );
+}
index a8b81837ab745b19806939efeea10dedaf27df4b..81ddfb0bdd88cb4cac1d4c612235859bc094db39 100644 (file)
@@ -50,6 +50,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& msg );
     virtual bool execute( ObjectList& objects );    
+    virtual void addSubshapesToStudy();
 
 private:
     void Init();
index 604423f5613e886739a2d8d6f479d68e9e500f32..716ab67f6d073680cb011b160e5254d1a06d41b5 100644 (file)
@@ -248,12 +248,23 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
              aSelMgr->GetIndexes( firstIObject(), aMap );
              if ( aMap.Extent() == 1 )
                {
-                 GEOM::GEOM_IShapesOperations_var aShapesOp =
-                   getGeomEngine()->GetIShapesOperations( getStudyId() );
+
                  int anIndex = aMap( 1 );
                  aName.append( ":edge_" + QString::number( anIndex ) );
-                 myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-                 myOkAxis = true;
+
+                 //Find SubShape Object in Father
+                 GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+                 
+                 if ( aFindedObject == GEOM::GEOM_Object::_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;
@@ -417,3 +428,16 @@ void GenerationGUI_RevolDlg::onBothway()
   GroupPoints->CheckButton2->setEnabled(!myBothway);  
   displayPreview();
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void GenerationGUI_RevolDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+  objMap[GroupPoints->LineEdit2->text()] = myAxis;
+
+  addSubshapesToFather( objMap );
+}
index 0c7d8e5bbdf0d91953f936b15c5134ca15e392c3..a8a49d56c4540dd0ef23a2dff9e1e278fba28c7a 100644 (file)
@@ -51,6 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& msg );
     virtual bool execute( ObjectList& objects );    
+    virtual void addSubshapesToStudy();
 
 private :
     void Init();
index 69f2bdcaf99f436df3e08d41198a97ce98f6c07c..3c9a62fb7dd29680677ad4112b00c8c0028ef925 100644 (file)
@@ -725,7 +725,7 @@ void OperationGUI_ChamferDlg::activateSelection()
                 myEditCurrentArgument == mySelName[ Faces ] ) )
     localSelection( myShape, TopAbs_FACE );
   else if (!myShape->_is_nil() && myEditCurrentArgument == mySelName[ Edges ] )
-       localSelection( myShape, TopAbs_EDGE );
+    localSelection( myShape, TopAbs_EDGE );
   else
   {
     TColStd_MapOfInteger aMap;
index 7e45cc653b3c51a6ce8d08cc4e8902f00db50d7b..9adcb3b9c56a25bd57457b26731f3873f7b90549 100644 (file)
@@ -260,12 +260,19 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
     aSelMgr->GetIndexes(firstIObject(), aMap);
     if (aMap.Extent() == 1) // Local Selection
     {
-      GEOM::GEOM_IShapesOperations_var aShapesOp =
-        getGeomEngine()->GetIShapesOperations( getStudyId() );
       int anIndex = aMap( 1 );
       aName.append( ":vertex_" + QString::number( anIndex ) );   
-      aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      aSelMgr->clearSelected(); // ???
+
+      //Find SubShape Object in Father
+      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+      
+      if ( aFindedObject == GEOM::GEOM_Object::_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
     {
@@ -424,3 +431,18 @@ void  PrimitiveGUI_BoxDlg::closeEvent( QCloseEvent* e )
 {
   GEOMBase_Skeleton::closeEvent( e );
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_BoxDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+  if ( getConstructorId() == 0 ) 
+  {
+    objMap[GroupPoints->LineEdit1->text()] = myPoint1;
+    objMap[GroupPoints->LineEdit2->text()] = myPoint2;
+    addSubshapesToFather( objMap );
+  }
+}
index 9e7139889f4e270f8fc46af575fc57c93d690a88..5ff6bf50cac8e9f95202b44466e99f6cc2b0bb09 100644 (file)
@@ -52,7 +52,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-    
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private :
index 1c726635d96fc804396a3315b5e4368b73b87745..51bbf5494e741f04e9dd630664465216f8cfa3fa 100644 (file)
@@ -290,17 +290,22 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
     aSelMgr->GetIndexes( firstIObject(), aMap );
     if (aMap.Extent() == 1)
     {
-      GEOM::GEOM_IShapesOperations_var aShapesOp =
-        getGeomEngine()->GetIShapesOperations(getStudyId());
       int anIndex = aMap(1);
-
-      aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      aSelMgr->clearSelected(); // ???
-
       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 == GEOM::GEOM_Object::_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
     {
@@ -516,3 +521,23 @@ double PrimitiveGUI_ConeDlg::getHeight() const
     return GroupDimensions->SpinBox_DZ->GetValue();
   return 0;
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+  }
+ addSubshapesToFather( objMap );
+}
index 6ac583460d5a72e4aadf496e49875081fac36e2a..f6b3f94cf6bc93a386f2e449affeee0f89c1dd92 100644 (file)
@@ -50,7 +50,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private:
index 48bdcf3b69fe4c9548d6779415ac1a773ff880d4..eef00b55a743716346f6619e336a4bb81c9a1ad3 100644 (file)
@@ -284,16 +284,22 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
     aSelMgr->GetIndexes(firstIObject(), aMap);
     if (aMap.Extent() == 1) // Local Selection
     {
-      GEOM::GEOM_IShapesOperations_var aShapesOp =
-        getGeomEngine()->GetIShapesOperations(getStudyId());
       int anIndex = aMap(1);
-      aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      aSelMgr->clearSelected(); // ???
-
       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 == GEOM::GEOM_Object::_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
     {
@@ -487,3 +493,23 @@ double PrimitiveGUI_CylinderDlg::getHeight() const
     return GroupDimensions->SpinBox_DY->GetValue();
   return 0;
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+  }
+ addSubshapesToFather( objMap );
+}
index d6f8391be606dd7be33c83d859955e38a964b64e..1980db249877208c5ae2d70710c8a776efb18a43 100644 (file)
@@ -51,7 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private:
index 2d92816fa5a2b412106466f7412cb6694e95b9ac..168bc650c08128a40039f0b251d193dd4c26f25d 100644 (file)
@@ -248,13 +248,19 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
     aSelMgr->GetIndexes(firstIObject(), aMap);
     if (aMap.Extent() == 1) // Local Selection
     {
-      GEOM::GEOM_IShapesOperations_var aShapesOp =
-        getGeomEngine()->GetIShapesOperations( getStudyId() );
       int anIndex = aMap( 1 );
-      aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      aSelMgr->clearSelected();
-
       aName.append( ":vertex_" + QString::number( anIndex ) );
+
+      //Find SubShape Object in Father
+      GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather(aSelectedObject, aName);
+
+      if ( aFindedObject == GEOM::GEOM_Object::_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
     {
@@ -419,3 +425,22 @@ double PrimitiveGUI_SphereDlg::getRadius() const
     return GroupDimensions->SpinBox_DX->GetValue();
   return 0;
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void PrimitiveGUI_SphereDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+switch (getConstructorId())
+  {
+  case 0:
+    objMap[GroupPoints->LineEdit1->text()] = myPoint;
+    break;
+  case 1:
+    return;
+  }
+ addSubshapesToFather( objMap );
+}
index 7885126b27cb1c38bb91fe0bb57db6e812122c42..8e1297ffabe926fd2b7ce0af09e8c320510cbdcd 100644 (file)
@@ -51,7 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private:
index c81455344d9e6b4b82b34f9d82b69820505eadb0..157e0eb0e967cbaaf88cf41c390f374a4ee13a7b 100644 (file)
@@ -275,17 +275,22 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
     aSelMgr->GetIndexes(firstIObject(), aMap);
     if (aMap.Extent() == 1) // Local Selection
     {
-      GEOM::GEOM_IShapesOperations_var aShapesOp =
-        getGeomEngine()->GetIShapesOperations( getStudyId() );
       int anIndex = aMap(1);
-
-      aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-      aSelMgr->clearSelected();
-
       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 == GEOM::GEOM_Object::_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
     {
@@ -464,3 +469,23 @@ double PrimitiveGUI_TorusDlg::getRadius2() const
     return GroupDimensions->SpinBox_DY->GetValue();
   return 0;
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+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;
+  }
+ addSubshapesToFather( objMap );
+}
index 08e86ced14fe4680c5871a1e5a558859d7d3989f..1703b6a43fa573bada4cf3568c326f2046dbab8e 100644 (file)
@@ -51,6 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
+    virtual void addSubshapesToStudy();
 
 private:
     void Init();
index ce2b0a94fc2d6a8b6240c23ded150cb81138031e..75b1c04b0e51910c6f677ab4d776ac88a56a35a0 100644 (file)
@@ -259,17 +259,22 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
              aSelMgr->GetIndexes( firstIObject(), aMap );
              if ( aMap.Extent() == 1 )
                {
-                   GEOM::GEOM_IShapesOperations_var aShapesOp =
-                     getGeomEngine()->GetIShapesOperations( getStudyId() );
                    int anIndex = aMap( 1 );
-                   int id = getConstructorId();
                    if (aNeedType == TopAbs_VERTEX)
                      aName += QString(":vertex_%1").arg(anIndex);
                    else
                      aName += QString(":edge_%1").arg(anIndex);
-
-                   myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-                   aSelMgr->clearSelected();
+                   
+                   //Find SubShape Object in Father
+                   GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+                   
+                   if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+                     GEOM::GEOM_IShapesOperations_var aShapesOp =
+                       getGeomEngine()->GetIShapesOperations( getStudyId() );
+                     myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   }
+                   else
+                     myArgument = aFindedObject; // get Object from study
                }
              else {
                if (aShape.ShapeType() != aNeedType) {
@@ -478,3 +483,28 @@ void TransformationGUI_MirrorDlg::CreateCopyModeChanged(bool isCreateCopy)
 {
   this->GroupBoxName->setEnabled(isCreateCopy);
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MirrorDlg::addSubshapesToStudy()
+{
+  bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+  if (toCreateCopy) {
+    QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+    switch (getConstructorId())
+      {
+      case 0:
+       objMap[GroupPoints->LineEdit2->text()] = myArgument;
+       break;
+      case 1:
+       objMap[GroupPoints->LineEdit2->text()] = myArgument;
+       break;
+      case 2:
+       return;
+      }
+    addSubshapesToFather( objMap );
+  }
+}
index 44d8f5ddab4cb91a8a33f1ffab6ad1ee7934e43d..25f5767396879c8671581418e991a34ff0180694 100644 (file)
@@ -52,7 +52,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private:
index f01324aa80b1ebb9b36cb5da949c214835c59bbb..6a949fe009b5ec245d4990b04729946520444f23 100644 (file)
@@ -305,23 +305,30 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
              LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
              TColStd_IndexedMapOfInteger aMap;
              aSelMgr->GetIndexes( firstIObject(), aMap );
-               if ( aMap.Extent() == 1 )
-                 {
+             if ( aMap.Extent() == 1 )
+               {
+                 int anIndex = aMap( 1 );
+                 aName += QString(":edge_%1").arg(anIndex);
+                 
+                 //Find SubShape Object in Father
+                 GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+                 
+                 if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
                    GEOM::GEOM_IShapesOperations_var aShapesOp =
                      getGeomEngine()->GetIShapesOperations( getStudyId() );
-                   int anIndex = aMap( 1 );
-                   aName += QString(":edge_%1").arg(anIndex);              
                    myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-                   aSelMgr->clearSelected();
                  }
-               else {
-                 if (aShape.ShapeType() != TopAbs_EDGE) {
-                   aSelectedObject = GEOM::GEOM_Object::_nil();
-                   aName = "";
-                 }
-                 myVector = aSelectedObject;
+                 else
+                   myVector = aFindedObject; // get existing object
+               }
+             else {
+               if (aShape.ShapeType() != TopAbs_EDGE) {
+                 aSelectedObject = GEOM::GEOM_Object::_nil();
+                 aName = "";
                }
-               
+               myVector = aSelectedObject;
+             }
+             
            }
        }
   }
@@ -509,3 +516,23 @@ void  TransformationGUI_MultiRotationDlg::closeEvent( QCloseEvent* e )
   // myGeomGUI->SetState( -1 );
   GEOMBase_Skeleton::closeEvent( e );
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MultiRotationDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+  
+  switch (getConstructorId())
+    {
+    case 0:
+      objMap[GroupPoints->LineEdit2->text()] = myVector;
+      break;
+    case 1:
+      objMap[GroupDimensions->LineEdit2->text()] = myVector;
+      break;
+    }
+  addSubshapesToFather( objMap );
+}
index d82780fd211c6ef39ddcacf8dd72effdae73cb8c..44d7d517632f955909d025359638a855fcc5d3d7 100644 (file)
@@ -51,7 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-    
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private :
index f017e899f66beb66f2f50250f9da0cd5003cb9b7..a998495cef02be54da912c47e815acc1931e7c27 100644 (file)
@@ -324,14 +324,26 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
              aSelMgr->GetIndexes( firstIObject(), aMap );
                if ( aMap.Extent() == 1 )
                  {
-                   GEOM::GEOM_IShapesOperations_var aShapesOp =
-                     getGeomEngine()->GetIShapesOperations( getStudyId() );
                    int anIndex = aMap( 1 );
                    aName += QString(":edge_%1").arg(anIndex);
-                   if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
-                     myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-                   else
-                     myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+
+                   //Find SubShape Object in Father
+                   GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+                   
+                   if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+                     GEOM::GEOM_IShapesOperations_var aShapesOp =
+                       getGeomEngine()->GetIShapesOperations( getStudyId() );
+                     if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
+                       myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                     else
+                       myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   }
+                   else {
+                     if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
+                       myVectorV = aFindedObject;
+                     else
+                       myVectorU = aFindedObject;
+                   }
                  }
                else {
                  if (aShape.ShapeType() != TopAbs_EDGE) {
@@ -570,3 +582,24 @@ void  TransformationGUI_MultiTranslationDlg::closeEvent( QCloseEvent* e )
   // myGeomGUI->SetState( -1 );
   GEOMBase_Skeleton::closeEvent( e );
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_MultiTranslationDlg::addSubshapesToStudy()
+{
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+  
+  switch (getConstructorId())
+    {
+    case 0:
+      objMap[GroupPoints->LineEdit2->text()] = myVectorU;
+      break;
+    case 1:
+      objMap[GroupDimensions->LineEdit2->text()] = myVectorU;
+      objMap[GroupDimensions->LineEdit3->text()] = myVectorV;
+      break;
+    }
+  addSubshapesToFather( objMap );
+}
index c36073d8b117b4e03a36e1b97e05062665a95e8a..c5746db3ebaf39f9e82020c3221015c602926f63 100644 (file)
@@ -51,7 +51,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-    
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private :
index 0aca76c0162a1b8b80ee26b8ccc99ff6400f5bc5..bfcd16845901030032e5153c4a36111aa69e4f6c 100644 (file)
@@ -282,15 +282,22 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
          aSelMgr->GetIndexes( firstIObject(), aMap );
          if ( aMap.Extent() == 1 )
            {
-             GEOM::GEOM_IShapesOperations_var aShapesOp =
-               getGeomEngine()->GetIShapesOperations( getStudyId() );
              int anIndex = aMap( 1 );
              if (aNeedType == TopAbs_EDGE)
                aName += QString(":edge_%1").arg(anIndex);
              else
                aName += QString(":vertex_%1").arg(anIndex);
-             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-             aSelMgr->clearSelected();
+
+             //Find SubShape Object in Father
+             GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+
+             if ( aFindedObject == GEOM::GEOM_Object::_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 {
            if (aShape.ShapeType() != aNeedType) {
@@ -535,3 +542,27 @@ void TransformationGUI_RotationDlg::onReverse()
   double anOldValue = GroupPoints->SpinBox_DX->GetValue();
   GroupPoints->SpinBox_DX->SetValue( -anOldValue );
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_RotationDlg::addSubshapesToStudy()
+{
+  bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+  if (toCreateCopy) {
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+  switch (getConstructorId())
+    {
+    case 0:
+      objMap[GroupPoints->LineEdit2->text()] = myAxis;
+      break;
+    case 1:
+      objMap[GroupPoints->LineEdit2->text()] = myCentPoint;
+      objMap[GroupPoints->LineEdit4->text()] = myPoint1;
+      objMap[GroupPoints->LineEdit5->text()] = myPoint2;
+      break;
+    }
+  addSubshapesToFather( objMap );
+  }
+}
index 4a18bbc1d44b16c52a7d69c64c9a957ca2e4ae7f..4ea6ea9e5e9748c1132f74cec3e36c3fa933f7fc 100644 (file)
@@ -49,7 +49,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private:
index 5db7a9f8d312fe2e4df13d78a851466bf298fd22..455862c7337406bc4b77d5feb4d3bf794f0a3afc 100644 (file)
@@ -211,12 +211,20 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
          aSelMgr->GetIndexes( firstIObject(), aMap );
          if ( aMap.Extent() == 1 )
            {
-             GEOM::GEOM_IShapesOperations_var aShapesOp =
-                     getGeomEngine()->GetIShapesOperations( getStudyId() );
              int anIndex = aMap( 1 );
              aName += QString(":vertex_%1").arg(anIndex);
-             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-             aSelMgr->clearSelected();
+
+             //Find SubShape Object in Father
+             GEOM::GEOM_Object_var aFindedObject = findObjectInFather(aSelectedObject, aName);
+             
+             if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+               GEOM::GEOM_IShapesOperations_var aShapesOp =
+                 getGeomEngine()->GetIShapesOperations( getStudyId() );
+               aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+               aSelMgr->clearSelected();
+             }
+             else
+               aSelectedObject = aFindedObject; // get Object from study
            }
          else {
            if (aShape.ShapeType() != TopAbs_VERTEX) {
@@ -391,3 +399,19 @@ void TransformationGUI_ScaleDlg::CreateCopyModeChanged(bool isCreateCopy)
 {
   this->GroupBoxName->setEnabled(isCreateCopy);
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_ScaleDlg::addSubshapesToStudy()
+{
+  bool toCreateCopy = IsPreview() || GroupPoints->CheckButton1->isChecked();
+  if (toCreateCopy) {
+    QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+    objMap[GroupPoints->LineEdit2->text()] = myPoint;
+
+    addSubshapesToFather( objMap );
+  }
+}
index 0190f04d5a13b5664e6abe4a4cb8bf7df3145822..7f77c6b42901118ad1e147c19abb2fb53e974689 100644 (file)
@@ -50,7 +50,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
-
+    virtual void addSubshapesToStudy();
     virtual void closeEvent( QCloseEvent* e );
 
 private :
index f41b0eb7cac5174bf5cde8f7f2a3c335b222afad..41c6645e3a518e57153140abdf4442c380d67c48 100644 (file)
@@ -296,14 +296,22 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
        aSelMgr->GetIndexes( firstIObject(), aMap );
        if ( aMap.Extent() == 1 )
          {
-           GEOM::GEOM_IShapesOperations_var aShapesOp =
-             getGeomEngine()->GetIShapesOperations( getStudyId() );
            int anIndex = aMap( 1 );
-           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
            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 = findObjectInFather(aSelectedObject, aName);
+           
+           if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+             GEOM::GEOM_IShapesOperations_var aShapesOp =
+               getGeomEngine()->GetIShapesOperations( getStudyId() );
+             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           }
+           else
+             aSelectedObject = aFindedObject;
          } else // Global Selection
            {
              if (aShape.ShapeType() != aNeedType) {
@@ -539,3 +547,29 @@ void TransformationGUI_TranslationDlg::CreateCopyModeChanged(bool isCreateCopy)
 {
   GroupBoxName->setEnabled(isCreateCopy);
 }
+
+//=================================================================================
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
+//=================================================================================
+void TransformationGUI_TranslationDlg::addSubshapesToStudy()
+{
+  bool toCreateCopy = IsPreview() || GroupPoints->CheckBox1->isChecked();
+  if (toCreateCopy) {
+    QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+    switch (getConstructorId())
+      {
+      case 0:
+       return;
+      case 1:
+       objMap[GroupPoints->LineEdit2->text()] = myPoint1;
+       objMap[GroupPoints->LineEdit3->text()] = myPoint2;
+       break;
+      case 2:
+       objMap[GroupPoints->LineEdit2->text()] = myVector;
+       break;
+      }
+    addSubshapesToFather( objMap );
+  }
+}
index dac586af04be5ff612f95c32bf612985343dadce..11975c1368e619e5c55405cc2ef334176431d58c 100644 (file)
@@ -50,6 +50,7 @@ protected:
     virtual GEOM::GEOM_IOperations_ptr createOperation();
     virtual bool isValid( QString& );
     virtual bool execute( ObjectList& objects );
+    virtual void addSubshapesToStudy();
 
 private:
     void Init();