]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL 16768 (Definition of Vector form Edge)
authordmv <dmv@opencascade.com>
Wed, 28 Nov 2007 08:18:23 +0000 (08:18 +0000)
committerdmv <dmv@opencascade.com>
Wed, 28 Nov 2007 08:18:23 +0000 (08:18 +0000)
15 files changed:
src/BasicGUI/BasicGUI_CircleDlg.cxx
src/BasicGUI/BasicGUI_PlaneDlg.cxx
src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/GenerationGUI/GenerationGUI_RevolDlg.cxx
src/GroupGUI/GroupGUI_GroupDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx
src/TransformationGUI/TransformationGUI_MirrorDlg.cxx
src/TransformationGUI/TransformationGUI_MultiRotationDlg.cxx
src/TransformationGUI/TransformationGUI_MultiTranslationDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.cxx
src/TransformationGUI/TransformationGUI_TranslationDlg.cxx

index 0fcbcb236d461725e13a22f1fde3ba1a7b563b6c..602e0d22385d26cb58924704fe9152b87fb8d043 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
 #include <qlabel.h>
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+
+#include <GEOMImpl_ILocalOperations.hxx>
+
 #include "GEOMImpl_Types.hxx"
 #include "GEOM_Object.hxx"
 #include "GEOM_Engine.hxx"
@@ -293,13 +302,39 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
 
   // nbSel == 1
   Standard_Boolean aRes = Standard_False;
-  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
+  Handle(SALOME_InteractiveObject) anIO = firstIObject();
+  GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   { 
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint  = aSelectedObject;
-    else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir    = aSelectedObject;
+    else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
+      {
+       if ( aRes && !aSelectedObject->_is_nil() )
+         {
+           TopoDS_Shape aShape;
+
+           if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+             {
+               LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+               TColStd_IndexedMapOfInteger aMap;
+               aSelMgr->GetIndexes( anIO, 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 );
+                   myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+               else
+                 myDir = aSelectedObject;
+             }
+         }
+      }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3 = aSelectedObject;
@@ -330,8 +365,12 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument()
   
   myEditCurrentArgument->setFocus();
   
-  if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) 
-    globalSelection( GEOM_LINE );
+  if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
+    {
+      //globalSelection( GEOM_LINE );
+      GEOM::GEOM_Object_var anObj;
+      localSelection( anObj, TopAbs_EDGE );
+    }
   else
     globalSelection( GEOM_POINT );
   SelectionIntoArgument();
index 62711faa6598a45fba4570c187c380c4eb11db41..c3a3ddd4fd56f473d337f45ff3b9f5956b49d632 100644 (file)
 
 #include <TColStd_MapOfInteger.hxx>
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -314,7 +321,32 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
   {
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     if      ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint  = aSelectedObject;
-    else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir    = aSelectedObject;
+    else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
+      if ( aRes && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                   myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+               else
+                 myDir = aSelectedObject;
+           }
+       }
+    }
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )  myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )  myPoint2 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )  myPoint3 = aSelectedObject;
@@ -342,8 +374,11 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
 
   myEditCurrentArgument->setFocus();
 
-  if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
-    globalSelection( GEOM_LINE );
+  if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
+    //globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
+  }
   else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
     //globalSelection( GEOM_PLANE );
     TColStd_MapOfInteger aMap;
index 97a7421c27820464c1965c5628998f83271ed981..7cfa245d0de24971963e336614c98644d4622dd8 100644 (file)
@@ -43,6 +43,9 @@
 #include <gp_Pnt.hxx>
 #include <gp_Dir.hxx>
 #include <TColStd_MapOfInteger.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
 
 // QT Includes
 #include <qcheckbox.h>
@@ -209,7 +212,9 @@ void BasicGUI_WorkingPlaneDlg::ConstructorsClicked(int constructorId)
       }
     case 1:
       {
-        globalSelection( GEOM_LINE );
+       //globalSelection( GEOM_LINE );
+       GEOM::GEOM_Object_var anObj;
+       localSelection( anObj, TopAbs_EDGE );
 
         Group1->hide();
         Group3->hide();
@@ -285,6 +290,7 @@ bool BasicGUI_WorkingPlaneDlg::ClickOnApply()
 void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
 {
   myEditCurrentArgument->setText("");
+  QString aName;
 
   const int id = getConstructorId();
   if ( IObjectCount() != 1 ) {
@@ -306,14 +312,45 @@ void BasicGUI_WorkingPlaneDlg::SelectionIntoArgument()
   if(!aRes || CORBA::is_nil( aSelectedObject ))
     return;
 
+  aName = GEOMBase::GetName( aSelectedObject );
+
   if(myEditCurrentArgument == Group1->LineEdit1)
     myFace = aSelectedObject;
-  else if(myEditCurrentArgument == Group2->LineEdit1)
-    myVectX = aSelectedObject;
-  else if(myEditCurrentArgument == Group2->LineEdit2)
-    myVectZ = aSelectedObject;
+  else if(myEditCurrentArgument == Group2->LineEdit1 || myEditCurrentArgument == Group2->LineEdit2)  {
+      if ( aRes && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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);
+                 }
+               else {
+                 if(myEditCurrentArgument == Group2->LineEdit1)
+                   myVectX = aSelectedObject;
+                 else
+                   myVectZ = aSelectedObject;
+               }
+               aSelMgr->clearSelected();
+           }
+       }
+    }
 
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  myEditCurrentArgument->setText( aName );
   
   updateWPlane();
 }
@@ -333,11 +370,15 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
   }
   else if(send == Group2->PushButton1) {
     myEditCurrentArgument = Group2->LineEdit1;
-    globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
+    //globalSelection( GEOM_LINE );
   }
   else if(send == Group2->PushButton2) {
     myEditCurrentArgument = Group2->LineEdit2;
-    globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
+    //globalSelection( GEOM_LINE );
   }
 
   myEditCurrentArgument->setFocus();
index 242408d4fee117cb59110149bdb88d7e819c779a..01ca3094e46ae8ebfba64f1cdbc283914dff2364 100644 (file)
 #include <qlabel.h>
 
 #include <TopoDS_Edge.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
 #include <BRepBuilderAPI_MakeWire.hxx>
 #include <BRepOffsetAPI_MakePipe.hxx>
 #if OCC_VERSION_MAJOR >= 5
@@ -128,7 +133,7 @@ void GenerationGUI_PipeDlg::Init()
 
   initName(tr("GEOM_PIPE"));
 
-  globalSelection( GEOM_ALLSHAPES );
+  //  globalSelection( GEOM_ALLSHAPES );
 }
 
 
@@ -199,12 +204,33 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
   else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
     myOkPath = false;
     
-    if(!GEOMBase::GetShape(aSelectedObject, S) ||
-       !(S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE) ) 
+    if( !GEOMBase::GetShape(aSelectedObject, S) ) 
       return;
     
-    myPath = aSelectedObject;
-    myOkPath = true;
+    if ( testResult && !aSelectedObject->_is_nil() && aSelectedObject != myBase)
+      {
+       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+       TColStd_IndexedMapOfInteger aMap;
+       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( S, aShapes );
+           S = aShapes.FindKey( anIndex );
+           if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) {
+             myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             myOkPath = true;
+             aSelMgr->clearSelected();
+           }
+         }
+       else if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) {
+           myPath = aSelectedObject;
+           myOkPath = true;
+         }
+      }
   }
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
   
@@ -223,10 +249,13 @@ void GenerationGUI_PipeDlg::SetEditCurrentArgument()
   if(send == GroupPoints->PushButton1) {
     GroupPoints->LineEdit1->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit1;
+    globalSelection( GEOM_ALLSHAPES );
   }
   else if(send == GroupPoints->PushButton2) {
     GroupPoints->LineEdit2->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit2;
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   SelectionIntoArgument();
 }
index 61072b77a709b497a9d37b21c519f75ccf1c04b4..8d42bda6f89441ae062995c7dc2dbbbbcbfd9518 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 #include <qcheckbox.h>
 
@@ -287,10 +294,33 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
       myOkBase = true;
     }
     else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
-      myVec = aSelectedObject;
-      myOkVec = true;
+      if ( testResult && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                 myVec = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                 aSelMgr->clearSelected();
+               }
+             else
+               myVec = aSelectedObject;
+
+             myOkVec = true;
+           }
+       }
     }
-
     myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
   }
   else // getConstructorId()==1 - extrusion using 2 points
@@ -372,7 +402,9 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
   else if (send == GroupPoints->PushButton2) {
     GroupPoints->LineEdit2->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE );
+    //    globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   else if (send == GroupPoints2->PushButton1) {
     GroupPoints2->LineEdit1->setFocus();
index 7d8a7dc0827d02c4833e92e281cab06c1c64bf37..2f063f1949d874b8368b18b684a04fc087b3aba3 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <gp_Lin.hxx>
 #include <BRepAdaptor_Curve.hxx>
 #include <BRepPrimAPI_MakeRevol.hxx>
@@ -229,8 +236,32 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
     myOkBase = true;
   }
   else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
-    myAxis = aSelectedObject;
-    myOkAxis = true;
+    if ( testResult && !aSelectedObject->_is_nil() )
+      {
+       TopoDS_Shape aShape;
+       
+       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+         {
+           LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                 myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                 aSelMgr->clearSelected();
+               }
+             else
+               myAxis = aSelectedObject;
+
+             myOkAxis = true;
+         }
+      }
   }
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
 
@@ -254,7 +285,9 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument()
   else if(send == GroupPoints->PushButton2) {
     GroupPoints->LineEdit2->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE );
+    //globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   SelectionIntoArgument();
 }
index 09f278b258f05fac7827af5d446df14a8db543a7..ef57e4f47e48f450daff35e0c3faa114acd5881c 100644 (file)
@@ -331,15 +331,6 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
         aSelMgr->selectedSubOwners(aMap);
         if (aMap.size() == 1)
           aMapIndex = aMap.begin().data();
-       if (aMap.size() == 0) {
-         Standard_Boolean aResult = Standard_False;
-         GEOM::GEOM_Object_var anObj =
-           GEOMBase::ConvertIOinGEOMObject( firstIObject(), aResult );
-         if ( aResult && !anObj->_is_nil() && GEOMBase::IsShape( anObj ) ) {
-           localSelection( anObj, getShapeType() );
-         }
-        
-       }
       }
     }
 
index fd7f05cd61c986cb873d18b9bd41adb1446561a4..92c1474fca4e29ebe1fd2ce03810081b1d579051 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -269,10 +276,32 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
 
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = aSelectedObject;
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2)
-    myDir = aSelectedObject;
-  
-  
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2)  {
+    if ( testResult && !aSelectedObject->_is_nil() )
+      {
+       TopoDS_Shape aShape;
+       
+       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+         {
+           LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+           TColStd_IndexedMapOfInteger aMap;
+             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 );
+                 myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                 aSelMgr->clearSelected();
+               }
+             else
+               myDir = aSelectedObject;
+         }
+      }
+  }
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
   displayPreview();
 }
@@ -292,7 +321,9 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE );
+    //    globalSelection( GEOM_LINE );
+        GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   
   myEditCurrentArgument->setFocus();
index 6c2b1b726b1be32fe031f18abffe2dafdc2599a0..25db439b8c820c9b4db72094e749ca764b5a4347 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -265,11 +272,32 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
   
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = aSelectedObject;
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2)
-    myDir = aSelectedObject;
-    
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2)  {
+    if ( testResult && !aSelectedObject->_is_nil() )
+      {
+       TopoDS_Shape aShape;
+       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+         {
+           LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+           TColStd_IndexedMapOfInteger aMap;
+           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 );
+                   myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+             }
+           else
+             myDir = aSelectedObject;
+         }
+      }
+  }
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
   displayPreview();
 }
 
@@ -288,7 +316,9 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE );
+    //    globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   
   myEditCurrentArgument->setFocus();
index 1f4279bcad914b2aee2885dd9ae9b04324615229..6f561260a67de6f8832f4c3e1b805e1175c06853 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -257,9 +264,32 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
 
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = aSelectedObject;
-  else if (myEditCurrentArgument == GroupPoints->LineEdit2)
-    myDir = aSelectedObject;
-
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2) {
+    if ( testResult && !aSelectedObject->_is_nil() )
+      {
+       TopoDS_Shape aShape;
+       
+       if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+         {
+           LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+           TColStd_IndexedMapOfInteger aMap;
+           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 );
+                   myDir = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+           else
+             myDir = aSelectedObject;
+         }
+      }
+  }
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
   displayPreview();
 }
@@ -295,7 +325,9 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
   }
   else if (send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE );
+    //    globalSelection( GEOM_LINE );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
 
   myEditCurrentArgument->setFocus();
index 5e6868836eaa8d67a391a8dc59ca36e7c164633f..4e555b021233c9b97b7885e0cfff210f2e447eee 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qcheckbox.h>
 #include <qlabel.h>
 
@@ -229,10 +236,33 @@ void TransformationGUI_MirrorDlg::SelectionIntoArgument()
          return;
        }
       Standard_Boolean testResult = Standard_False;
-      myArgument = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+      GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+      myArgument = aSelectedObject;
       if(!testResult || CORBA::is_nil( myArgument ))
        return;
-      aName = GEOMBase::GetName( myArgument );
+
+      if ( testResult && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                   myArgument = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+           }
+       }
+      aName = GEOMBase::GetName( aSelectedObject );
     }
   myEditCurrentArgument->setText( aName );
    
@@ -279,7 +309,9 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
        }
       case 1:
        {
-         globalSelection( GEOM_LINE );
+         //globalSelection( GEOM_LINE );
+         GEOM::GEOM_Object_var anObj;
+         localSelection( anObj, TopAbs_EDGE );
          break;
        }
       case 2:
index 1311eb899149f4461e32c99b22e0dfd9bf6c75dc..1b6f1c3b46c6158bac657e36079eeb52956f5eca 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qcheckbox.h>
 #include <qlabel.h>
 
@@ -285,9 +292,32 @@ void TransformationGUI_MultiRotationDlg::SelectionIntoArgument()
       myEditCurrentArgument == GroupDimensions->LineEdit1)
     myBase = aSelectedObject;
   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
-           myEditCurrentArgument == GroupDimensions->LineEdit2)
-    myVector = aSelectedObject;
-
+           myEditCurrentArgument == GroupDimensions->LineEdit2) {
+    if ( testResult && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                   myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+               else
+                 myVector = aSelectedObject;
+           }
+       }
+  }
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
 
   displayPreview();
@@ -308,7 +338,9 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE  );
+    //    globalSelection( GEOM_LINE  );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   else if(send == GroupDimensions->PushButton1) {
     myEditCurrentArgument = GroupDimensions->LineEdit1;
@@ -316,7 +348,9 @@ void TransformationGUI_MultiRotationDlg::SetEditCurrentArgument()
   }
   else if(send == GroupDimensions->PushButton2) {
     myEditCurrentArgument = GroupDimensions->LineEdit2;
-    globalSelection( GEOM_LINE  );
+    //    globalSelection( GEOM_LINE  );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
 
   myEditCurrentArgument->setFocus();
index 7f5e33c1584577c3e6907ac9157eca870a88fc08..3b5e094bc7f8062462b2069010b30d0ff1b4903d 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -302,10 +309,39 @@ void TransformationGUI_MultiTranslationDlg::SelectionIntoArgument()
       myEditCurrentArgument == GroupDimensions->LineEdit1)
     myBase = aSelectedObject;
   else if (myEditCurrentArgument == GroupPoints->LineEdit2 ||
-           myEditCurrentArgument == GroupDimensions->LineEdit2)
-    myVectorU = aSelectedObject;
-  else if (myEditCurrentArgument == GroupDimensions->LineEdit3)
-    myVectorV = aSelectedObject;
+           myEditCurrentArgument == GroupDimensions->LineEdit2 ||
+          myEditCurrentArgument == GroupDimensions->LineEdit3 ) {
+    if ( testResult && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                   aSelMgr->clearSelected();
+                   if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
+                     myVectorV = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   else
+                     myVectorU = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                 }
+               else
+                 if ( myEditCurrentArgument == GroupDimensions->LineEdit3 )
+                   myVectorV = aSelectedObject;
+                 else
+                   myVectorU = aSelectedObject;
+           }
+       }
+    }
 
   myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
 
@@ -327,7 +363,9 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_LINE  );
+    //    globalSelection( GEOM_LINE  );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   else if(send == GroupDimensions->PushButton1) {
     myEditCurrentArgument = GroupDimensions->LineEdit1;
@@ -335,11 +373,15 @@ void TransformationGUI_MultiTranslationDlg::SetEditCurrentArgument()
   }
   else if(send == GroupDimensions->PushButton2) {
     myEditCurrentArgument = GroupDimensions->LineEdit2;
-    globalSelection( GEOM_LINE  );
+    //    globalSelection( GEOM_LINE  );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
   else if(send == GroupDimensions->PushButton3) {
     myEditCurrentArgument = GroupDimensions->LineEdit3;
-    globalSelection( GEOM_LINE  );
+    //    globalSelection( GEOM_LINE  );
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
   }
 
   myEditCurrentArgument->setFocus();
index 51b85c60b7fd6a964a3609164bbfbd331dac32c6..30790bb595cbe0f11deaa5ec5ff265b91ff23783 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qcheckbox.h>
 #include <qlabel.h>
 
@@ -262,8 +269,31 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
       if(!testResult || CORBA::is_nil( aSelectedObject ))
        return;
 
-      if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
-       myAxis = aSelectedObject;
+      if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
+       if ( testResult && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                   myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+               else
+                 myAxis = aSelectedObject;
+           }
+       }
+      }
       else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
        myCentPoint = aSelectedObject;
       else if(myEditCurrentArgument == GroupPoints->LineEdit4)
@@ -293,8 +323,13 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    getConstructorId() == 0 ? globalSelection( GEOM_LINE ) :
-                              globalSelection( GEOM_POINT  );
+    if (getConstructorId() == 0) {
+      //globalSelection( GEOM_LINE );
+      GEOM::GEOM_Object_var anObj;
+      localSelection( anObj, TopAbs_EDGE );
+    }
+    else
+      globalSelection( GEOM_POINT  );
   }
   else if (send == GroupPoints->PushButton4)
     {
index aa29811d3589c5096f9416855844e5b953652c42..659819a7633d443d1fb92373cf7d3ab5523ce583 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 #include <qcheckbox.h>
 
@@ -278,8 +285,32 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
 
     if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
       myPoint1 = aSelectedObject;
-    else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
-      myVector = aSelectedObject;
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2) {
+            if ( testResult && !aSelectedObject->_is_nil() )
+       {
+         TopoDS_Shape aShape;
+         
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             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 );
+                   myVector = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   aSelMgr->clearSelected();
+                 }
+               else
+                 myVector = aSelectedObject;
+           }
+       }
+    }
     else if (myEditCurrentArgument == GroupPoints->LineEdit3)
       myPoint2 = aSelectedObject;
 
@@ -320,8 +351,13 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
   }
   else if (send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    getConstructorId() == 1 ? globalSelection( GEOM_POINT ) :
-                              globalSelection( GEOM_LINE  );
+    if (getConstructorId() == 1)
+      globalSelection( GEOM_POINT );
+    else {
+      //globalSelection( GEOM_LINE  );
+      GEOM::GEOM_Object_var anObj;
+      localSelection( anObj, TopAbs_EDGE );
+    }
   }
   else if (send == GroupPoints->PushButton3) {
     myEditCurrentArgument = GroupPoints->LineEdit3;