]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
NPAL 16768 Select Vertex from Vertex on Shape V3_2_9rc2
authordmv <dmv@opencascade.com>
Tue, 4 Dec 2007 16:03:11 +0000 (16:03 +0000)
committerdmv <dmv@opencascade.com>
Tue, 4 Dec 2007 16:03:11 +0000 (16:03 +0000)
21 files changed:
src/BasicGUI/BasicGUI_ArcDlg.cxx
src/BasicGUI/BasicGUI_CircleDlg.cxx
src/BasicGUI/BasicGUI_CurveDlg.cxx
src/BasicGUI/BasicGUI_EllipseDlg.cxx
src/BasicGUI/BasicGUI_LineDlg.cxx
src/BasicGUI/BasicGUI_MarkerDlg.cxx
src/BasicGUI/BasicGUI_PlaneDlg.cxx
src/BasicGUI/BasicGUI_PointDlg.cxx
src/BasicGUI/BasicGUI_VectorDlg.cxx
src/BasicGUI/BasicGUI_WorkingPlaneDlg.cxx
src/GEOMImpl/GEOMImpl_ILocalOperations.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_BoxDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_ConeDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_CylinderDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_SphereDlg.cxx
src/PrimitiveGUI/PrimitiveGUI_TorusDlg.cxx
src/TransformationGUI/TransformationGUI_MirrorDlg.cxx
src/TransformationGUI/TransformationGUI_RotationDlg.cxx
src/TransformationGUI/TransformationGUI_ScaleDlg.cxx
src/TransformationGUI/TransformationGUI_TranslationDlg.cxx

index 11052a67de3c45524e3ad5c4c35c1a41bbcda01f..7c1b8741f211e75a0e7ce26eb283452214d0f359 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+
 #include <qlabel.h>
 #include <qcheckbox.h>
 
@@ -174,7 +181,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId)
   {
   case 0:
     {
-      globalSelection( GEOM_POINT );
+      localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
 
       Group3Pnts->show();
       resize(0, 0);
@@ -190,7 +197,7 @@ void BasicGUI_ArcDlg::ConstructorsClicked (int constructorId)
     }
   case 1:
     {
-      globalSelection( GEOM_POINT );
+      localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
 
       Group3Pnts->hide();
       resize(0, 0);
@@ -280,11 +287,30 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
+    myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+    // Get Selected object if selected subshape
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
     switch (getConstructorId())
     {
       case 0:
       {
-        myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
         if      ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1 = aSelectedObject;
         else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2 = aSelectedObject;
         else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3 = aSelectedObject;
@@ -292,7 +318,6 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
       }
       case 1:
       {
-        myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
         if      ( myEditCurrentArgument == Group3Pnts2->LineEdit1 )   myPoint1 = aSelectedObject;
         else if ( myEditCurrentArgument == Group3Pnts2->LineEdit2 )   myPoint2 = aSelectedObject;
         else if ( myEditCurrentArgument == Group3Pnts2->LineEdit3 )   myPoint3 = aSelectedObject;
index 602e0d22385d26cb58924704fe9152b87fb8d043..fe5ba5a809269273b0554718b6230072ccd9da67 100644 (file)
@@ -241,7 +241,9 @@ void BasicGUI_CircleDlg::ConstructorsClicked( int constructorId )
   }
   
   myEditCurrentArgument->setFocus();
-  globalSelection( GEOM_POINT );
+  //  globalSelection( GEOM_POINT );
+  GEOM::GEOM_Object_var anObj;
+  localSelection( anObj, TopAbs_VERTEX );
   connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 }
@@ -307,34 +309,27 @@ void BasicGUI_CircleDlg::SelectionIntoArgument()
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   { 
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
-    if      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint  = aSelectedObject;
-    else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
+    // If selected Vertex or Edge on the some Shape Get selection Subshape
+    TopoDS_Shape aShape;
+    if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
-       if ( aRes && !aSelectedObject->_is_nil() )
+       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+       TColStd_IndexedMapOfInteger aMap;
+       aSelMgr->GetIndexes( anIO, aMap );
+       if ( aMap.Extent() == 1 )
          {
-           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;
-             }
+           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      ( myEditCurrentArgument == GroupPntVecR->LineEdit1 ) myPoint  = aSelectedObject;
+    else if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 ) myDir = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )   myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )   myPoint2 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )   myPoint3 = aSelectedObject;
@@ -367,12 +362,13 @@ void BasicGUI_CircleDlg::SetEditCurrentArgument()
   
   if ( myEditCurrentArgument == GroupPntVecR->LineEdit2 )
     {
-      //globalSelection( GEOM_LINE );
       GEOM::GEOM_Object_var anObj;
       localSelection( anObj, TopAbs_EDGE );
     }
-  else
-    globalSelection( GEOM_POINT );
+  else {
+    GEOM::GEOM_Object_var anObj;
+    localSelection( anObj, TopAbs_EDGE );
+  }
   SelectionIntoArgument();
 }
 
index 69a25e85765ea0305b347c21b85f45e9e395f699..5ad899a0a30801e8200e8a2ef06197b35446d554 100644 (file)
 #include "SALOME_ListIteratorOfListIO.hxx"
 #include "SALOME_ListIO.hxx"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include "GEOMImpl_Types.hxx"
 
 using namespace std;
@@ -106,7 +112,8 @@ void BasicGUI_CurveDlg::Init()
   myPoints = new GEOM::ListOfGO();
   myPoints->length( 0 );
 
-  globalSelection( GEOM_POINT );
+  //  globalSelection( GEOM_POINT );
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
   /* signals and slots connections */
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@@ -275,9 +282,30 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
        {
          //TopoDS_Shape aPointShape;
          //if ( myGeomBase->GetShape( aSelectedObject, aPointShape, TopAbs_VERTEX ) )
+
+         TopoDS_Shape aShape;
+         if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
+           {
+             LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+             TColStd_IndexedMapOfInteger aMap;
+             aSelMgr->GetIndexes( anIt.Value(), 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 );
+                 aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                 aSelMgr->clearSelected();
+               }
+         }
+
          int pos = isPointInList(myOrderedSel,aSelectedObject);
          if(is_append && pos==-1)
-           myOrderedSel.push_back(aSelectedObject);
+         myOrderedSel.push_back(aSelectedObject);
+
          myPoints[i++] = aSelectedObject;
        }
     }
@@ -314,7 +342,8 @@ void BasicGUI_CurveDlg::ActivateThisDialog()
 
   // myGeomGUI->SetState( 0 );
 
-  globalSelection( GEOM_POINT );
+  //  globalSelection( GEOM_POINT );
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   ConstructorsClicked( getConstructorId() );
 }
 
index 7103838b5b697905512be41984b6887af3035649..e361991558670f92c7c773bd02babf470384a0eb 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+#include <TopoDS_Shape.hxx>
+#include <TopoDS_Edge.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -101,7 +108,8 @@ void BasicGUI_EllipseDlg::Init()
 {
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
-  globalSelection( GEOM_POINT );
+  //  globalSelection( GEOM_POINT );
+  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
 
   myPoint = myDir = GEOM::GEOM_Object::_nil();
 
@@ -207,6 +215,25 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {  
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+    // Get Selected object if selected subshape
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir   = aSelectedObject;
   }
@@ -228,9 +255,9 @@ void BasicGUI_EllipseDlg::SetEditCurrentArgument()
   
   myEditCurrentArgument->setFocus();
   if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
-    globalSelection( GEOM_LINE );
+    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   else
-    globalSelection( GEOM_POINT );
+    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
   SelectionIntoArgument();
 }
 
index 117c519f00df2e400d56ce9cfb743a42fb2d7c7b..ea8eea98e74d86ba61e239ee1805ae2acdedccca 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -117,7 +123,7 @@ void BasicGUI_LineDlg::Init()
   myPoint1 = myPoint2 = GEOM::GEOM_Object::_nil();
 
   // myGeomGUI->SetState( 0 );
-  globalSelection( GEOM_POINT );
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
        
   /* signals and slots connections */
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(ClickOnCancel()));
@@ -173,7 +179,13 @@ bool BasicGUI_LineDlg::ClickOnApply()
 {
   if ( !onAccept() )
     return false;
-  
+  GroupPoints->LineEdit1->setText( "" );
+  GroupPoints->LineEdit2->setText( "" );
+  GroupFaces->LineEdit1->setText( "" );
+  GroupFaces->LineEdit2->setText( "" );
+  myPoint1 = myPoint2 = myFace1 = myFace2 = GEOM::GEOM_Object::_nil();
+  myEditCurrentArgument = GroupPoints->LineEdit1;
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX ); //Select vertex on all shapes
   initName();
   return true;
 }
@@ -193,7 +205,6 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument->setText("");
       myPoint1 = GEOM::GEOM_Object::_nil();
       myPoint2 = GEOM::GEOM_Object::_nil();
-      globalSelection( GEOM_POINT );
       GroupPoints->show();
       GroupFaces->hide();
       break;
@@ -205,7 +216,6 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument->setText("");
       myFace1 = GEOM::GEOM_Object::_nil();
       myFace2 = GEOM::GEOM_Object::_nil();
-      globalSelection( GEOM_FACE );
       GroupPoints->hide();
       GroupFaces->show();
       break;
@@ -240,6 +250,24 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupFaces->LineEdit1 )  myFace1 = aSelectedObject;
@@ -293,7 +321,8 @@ void BasicGUI_LineDlg::ActivateThisDialog()
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   // myGeomGUI->SetState( 0 );
-  globalSelection( GEOM_POINT );
+  //  globalSelection( GEOM_POINT );
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
   myEditCurrentArgument = GroupPoints->LineEdit1;
   myEditCurrentArgument->setFocus();
index 17f6d25b49bb34bad6ec7ce13580b78300547c7a..00a843430952671cf6eec04c5975d6871e7f4bd1 100644 (file)
@@ -258,7 +258,7 @@ void BasicGUI_MarkerDlg::ConstructorsClicked( int constructorId )
        //PAL6669: resize(0, 0);
        Group2->show();
 
-       globalSelection( GEOM_POINT );
+       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
        myEditCurrentArgument = Group2->LineEdit1;
        Group2->LineEdit1->setText("");
        Group2->LineEdit2->setText("");
@@ -558,14 +558,16 @@ void BasicGUI_MarkerDlg::SetEditCurrentArgument()
   else if(send == Group2->PushButton1) {
     myEditCurrentArgument = Group2->LineEdit1;
     globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if(send == Group2->PushButton2) {
     myEditCurrentArgument = Group2->LineEdit2;
       globalSelection( GEOM_LINE );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if(send == Group2->PushButton3) {
     myEditCurrentArgument = Group2->LineEdit3;
-    globalSelection( GEOM_LINE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
 
   myEditCurrentArgument->setFocus();
index c3a3ddd4fd56f473d337f45ff3b9f5956b49d632..a6f6c796545cfb54056b320e5f914f4ee17a213e 100644 (file)
@@ -216,7 +216,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
                                GroupPntDir->LineEdit2->setText(tr(""));
 
                                /* for the first argument */
-                               globalSelection( GEOM_POINT );
+                               localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
                                break;
       }
     case 1: /* plane from 3 points */
@@ -232,7 +232,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
                                Group3Pnts->LineEdit3->setText("");
 
                                /* for the first argument */
-                               globalSelection( GEOM_POINT );
+                               localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
                                break;
       }
     case 2: /* plane from a planar face selection */
@@ -320,39 +320,31 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
     if      ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint  = 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 == GroupPntDir->LineEdit2 ) myDir    = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )  myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit2 )  myPoint2 = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit3 )  myPoint3 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupFace->LineEdit1 )   myFace   = aSelectedObject;
   }
-
   displayPreview();
 }
 
@@ -375,7 +367,6 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
   myEditCurrentArgument->setFocus();
 
   if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
-    //globalSelection( GEOM_LINE );
     GEOM::GEOM_Object_var anObj;
     localSelection( anObj, TopAbs_EDGE );
   }
@@ -387,7 +378,7 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
     globalSelection( aMap );
   }
   else
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
   SelectionIntoArgument();
 }
index 93d2fb47037b0e044d8189972ae8b1c46396cb76..213577ce04099b8ec0ced76b76a688b3ffa33c7b 100644 (file)
@@ -253,7 +253,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument->setText("");
       myRefPoint = GEOM::GEOM_Object::_nil();
 
-      globalSelection( GEOM_POINT );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
       GroupXYZ->hide();
       GroupOnCurve->hide();
@@ -268,7 +268,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument->setText("");
       myEdge = GEOM::GEOM_Object::_nil();
 
-      globalSelection( GEOM_EDGE );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
       GroupXYZ->hide();
       GroupRefPoint->hide();
@@ -285,7 +285,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myLine1 = GEOM::GEOM_Object::_nil();
       myLine2 = GEOM::GEOM_Object::_nil();
 
-      globalSelection( GEOM_EDGE );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
       GroupXYZ->hide();
       GroupRefPoint->hide();
@@ -366,36 +366,32 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
     Standard_Boolean aRes = Standard_False;
     Handle(SALOME_InteractiveObject) anIO = firstIObject();
     GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
+    QString aName = GEOMBase::GetName( aSelectedObject );
     if ( !CORBA::is_nil( aSelectedObject ) && aRes )
     {
+      myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+      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 );
+             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             aSelMgr->clearSelected();
+           }
+       }
       if ( id == 0 )
       {
-        // get CORBA reference to data object
-        TopoDS_Shape aShape = myGeomGUI->GetShapeReader().GetShape
-          ( myGeomGUI->GetGeomGen(), aSelectedObject );
-        if ( aShape.IsNull() )
-          return;
-
-        if ( aShape.ShapeType() != TopAbs_VERTEX )
-        {
-          TColStd_IndexedMapOfInteger aMap;
-          LightApp_Application* anApp =
-            (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-          anApp->selectionMgr()->GetIndexes( anIO, aMap );
-
-          if ( aMap.Extent() == 1 )
-          {
-            int anIndex = aMap( 1 );
-            TopTools_IndexedMapOfShape aShapes;
-            TopExp::MapShapes( aShape, aShapes );
-            aShape = aShapes.FindKey( anIndex );
-
-            if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
-              return;
-          }
-          else
-            return;
-        }
+       if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
+         return;
 
         gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
         GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
@@ -405,22 +401,22 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
       else if ( id == 1 )
       {
         myRefPoint = aSelectedObject;
-        GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+        GroupRefPoint->LineEdit1->setText( aName );
       }
       else if ( id == 2 )
       {
         myEdge = aSelectedObject;
-        GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+        GroupOnCurve->LineEdit1->setText( aName );
       }
       else if ( id == 3 )
       {
        if (myEditCurrentArgument == GroupLineIntersection->LineEdit1) {
         myLine1 = aSelectedObject;
-        GroupLineIntersection->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+        GroupLineIntersection->LineEdit1->setText( aName );
        }
        else if (myEditCurrentArgument == GroupLineIntersection->LineEdit2) {
         myLine2 = aSelectedObject;
-        GroupLineIntersection->LineEdit2->setText( GEOMBase::GetName( aSelectedObject ) );
+        GroupLineIntersection->LineEdit2->setText( aName );
        }
       }
     }
@@ -459,28 +455,28 @@ void BasicGUI_PointDlg::SetEditCurrentArgument()
     GroupRefPoint->LineEdit1->setFocus();
     myEditCurrentArgument = GroupRefPoint->LineEdit1;
     
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if ( send == GroupOnCurve->PushButton1 )
   {
     GroupOnCurve->LineEdit1->setFocus();
     myEditCurrentArgument = GroupOnCurve->LineEdit1;
     
-    globalSelection( GEOM_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if ( send == GroupLineIntersection->PushButton1 )
   {
     GroupLineIntersection->LineEdit1->setFocus();
     myEditCurrentArgument = GroupLineIntersection->LineEdit1;
     
-    globalSelection( GEOM_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if ( send == GroupLineIntersection->PushButton2 )
   {
     GroupLineIntersection->LineEdit2->setFocus();
     myEditCurrentArgument = GroupLineIntersection->LineEdit2;
     
-    globalSelection( GEOM_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
 }
 
index 79a4f90c259246c7ad6466967220cd924be5f76e..e045fb66af04d68a5fef07cc64e60defdd939b14 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -186,7 +192,7 @@ void BasicGUI_VectorDlg::ConstructorsClicked( int constructorId )
        GroupPoints->LineEdit1->setText("");
        GroupPoints->LineEdit2->setText("");
 
-       globalSelection( GEOM_POINT );
+       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
        connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(), 
                SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
        break;
@@ -271,6 +277,24 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
     myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
   }
index 7cfa245d0de24971963e336614c98644d4622dd8..4b3c6191739605b416c304489d71ab64c47979d4 100644 (file)
@@ -372,13 +372,11 @@ void BasicGUI_WorkingPlaneDlg::SetEditCurrentArgument()
     myEditCurrentArgument = Group2->LineEdit1;
     GEOM::GEOM_Object_var anObj;
     localSelection( anObj, TopAbs_EDGE );
-    //globalSelection( GEOM_LINE );
   }
   else if(send == Group2->PushButton2) {
     myEditCurrentArgument = Group2->LineEdit2;
     GEOM::GEOM_Object_var anObj;
     localSelection( anObj, TopAbs_EDGE );
-    //globalSelection( GEOM_LINE );
   }
 
   myEditCurrentArgument->setFocus();
index 14ef164437d948b829f35c4b8fe9c73c75e7da4d..77dc109a007a93fa38cae99e0b7f61049b9c2030 100644 (file)
@@ -768,8 +768,8 @@ Handle(GEOM_Object) GEOMImpl_ILocalOperations::MakeChamferEdges
     }
   }
   catch (Standard_Failure) {
-    Handle(Standard_Failure) aFail = Standard_Failure::Caught();
-    SetErrorCode(aFail->GetMessageString());
+     Handle(Standard_Failure) aFail = Standard_Failure::Caught();
+     SetErrorCode(aFail->GetMessageString());
     return NULL;
   }
 
index a677f3a46dd90870e3a10263fd51b4d59e09da42..c6141aa2be17df2497cb0ac45f9b65480c614303 100644 (file)
@@ -284,42 +284,38 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
     // nbSel == 1
     Standard_Boolean testResult = Standard_False;
     GEOM::GEOM_Object_ptr aSelectedObject =
-      GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
+    GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
 
     if (!testResult)
       return;
 
+    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
+
     if (myEditCurrentArgument == GroupPoints->LineEdit1) {
       myBase = aSelectedObject;
       myOkBase = true;
     }
     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 );
-                 myVec = aShapesOp->GetSubShape(aSelectedObject, anIndex);
-                 aSelMgr->clearSelected();
-               }
-             else
-               myVec = aSelectedObject;
-
-             myOkVec = true;
-           }
-       }
+      myVec = aSelectedObject;
+      myOkVec = true;
     }
     myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
   }
@@ -347,6 +343,26 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
     if (!testResult || CORBA::is_nil( aSelectedObject ))
       return;
 
+    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+    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 );
+           aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aSelMgr->clearSelected();
+         }
+      }
+
     if (myEditCurrentArgument == GroupPoints2->LineEdit1) {
       myBase = aSelectedObject;
       myOkBase = true;
@@ -360,7 +376,6 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
       myOkPnt2 = true;
     }
 
-    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
   }
 
   displayPreview();
@@ -414,12 +429,12 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
   else if (send == GroupPoints2->PushButton2) {
     GroupPoints2->LineEdit2->setFocus();
     myEditCurrentArgument = GroupPoints2->LineEdit2;
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if (send == GroupPoints2->PushButton3) {
     GroupPoints2->LineEdit3->setFocus();
     myEditCurrentArgument = GroupPoints2->LineEdit3;
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
 
   myEditCurrentArgument->setFocus();
index 7230ca6a5fce48afee556989bea25103be74f34d..aa4ad1b91e34dc720020ccc22df5cfea2b12cc96 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -166,7 +172,8 @@ void PrimitiveGUI_BoxDlg::ConstructorsClicked(int constructorId)
     {
     case 0:
       {
-       globalSelection( GEOM_POINT );
+       //      globalSelection( GEOM_POINT );
+       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
        GroupDimensions->hide();
        resize(0, 0);
@@ -246,14 +253,31 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
   
   if(!testResult || CORBA::is_nil( aSelectedObject ))
     return;
-  
+
+  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  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 );
+         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         aSelMgr->clearSelected();
+       }
+    }
   if(myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint1 = aSelectedObject;
   else if(myEditCurrentArgument == GroupPoints->LineEdit2)
     myPoint2 = aSelectedObject;
   
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
-  
   displayPreview();
 }
 
@@ -271,7 +295,8 @@ void PrimitiveGUI_BoxDlg::SetEditCurrentArgument()
   else if(send == GroupPoints->PushButton2)
     myEditCurrentArgument = GroupPoints->LineEdit2;
   
-  globalSelection( GEOM_POINT );
+  //  globalSelection( GEOM_POINT );
+  localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   
   myEditCurrentArgument->setFocus();
   SelectionIntoArgument();
index 92c1474fca4e29ebe1fd2ce03810081b1d579051..8a7659e1df8ab8b33fc7eb9bf839aeded54effd3 100644 (file)
@@ -186,7 +186,8 @@ void PrimitiveGUI_ConeDlg::ConstructorsClicked(int constructorId)
     { 
     case 0 :
       {
-       globalSelection( GEOM_POINT );
+       //      globalSelection( GEOM_POINT );
+       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
        GroupDimensions->hide();
        resize(0, 0);
        GroupPoints->show();
@@ -274,35 +275,30 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
   if(!testResult || CORBA::is_nil( aSelectedObject ))
     return;
 
+  TopoDS_Shape aShape;
+  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  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 );
+         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         aSelMgr->clearSelected();
+       }
+    }
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = 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 ) );
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2) 
+    myDir = aSelectedObject;
   displayPreview();
 }
 
@@ -317,12 +313,13 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
   
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection( GEOM_POINT );
+    //    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
     //    globalSelection( GEOM_LINE );
-        GEOM::GEOM_Object_var anObj;
+    GEOM::GEOM_Object_var anObj;
     localSelection( anObj, TopAbs_EDGE );
   }
   
index 25db439b8c820c9b4db72094e749ca764b5a4347..168a251591861c55fc68b4387d74c409e306e304 100644 (file)
@@ -179,7 +179,8 @@ void PrimitiveGUI_CylinderDlg::ConstructorsClicked(int constructorId)
     { 
     case 0 :
       {
-       globalSelection( GEOM_POINT );
+       //      globalSelection( GEOM_POINT );
+       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
        GroupDimensions->hide();
        resize(0, 0);
@@ -269,35 +270,30 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
     
   if(!testResult || CORBA::is_nil( aSelectedObject ))
     return;
-  
+
+  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  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 );
+         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         aSelMgr->clearSelected();
+       }
+    }
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = 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 ) );
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+    myDir = aSelectedObject;
   displayPreview();
 }
 
@@ -312,7 +308,8 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
   
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection( GEOM_POINT );
+    //    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
index f7a79b15293e46eaabe9642f1180435874b9787b..b1b56fea6177724d28440a3bedf927381df83178 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 
 #include "GEOMImpl_Types.hxx"
@@ -151,7 +157,7 @@ void PrimitiveGUI_SphereDlg::ConstructorsClicked(int constructorId)
     {
     case 0:
       {
-       globalSelection( GEOM_POINT );
+       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
        GroupDimensions->hide();
        resize(0, 0);
        GroupPoints->show();
@@ -237,10 +243,28 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
   
   if (!testResult || CORBA::is_nil( aSelectedObject ))
     return;
-    
+
+  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  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 );
+         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         aSelMgr->clearSelected();
+       }
+    }
   myPoint = aSelectedObject;
-  myEditCurrentArgument->setText( GEOMBase::GetName( myPoint ) );
-  
   displayPreview();
 }
 
@@ -271,7 +295,7 @@ void PrimitiveGUI_SphereDlg::SetEditCurrentArgument()
   if(send == GroupPoints->PushButton1) {
     GroupPoints->LineEdit1->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
     SelectionIntoArgument();
   }
 }
index 6f561260a67de6f8832f4c3e1b805e1175c06853..dad4b531f8ef1c836bf302c41b3a923a4c88e503 100644 (file)
@@ -179,7 +179,7 @@ void PrimitiveGUI_TorusDlg::ConstructorsClicked(int constructorId)
   {
   case 0:
     {
-      globalSelection( GEOM_POINT );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
       GroupDimensions->hide();
       resize(0, 0);
@@ -262,35 +262,30 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
   if (!testResult || CORBA::is_nil( aSelectedObject ))
     return;
 
+  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  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 );
+         aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+         aSelMgr->clearSelected();
+       }
+    }
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = 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 ) );
+  else if (myEditCurrentArgument == GroupPoints->LineEdit2)
+    myDir = aSelectedObject;
+
   displayPreview();
 }
 
@@ -321,11 +316,10 @@ void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
 
   if (send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if (send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    //    globalSelection( GEOM_LINE );
     GEOM::GEOM_Object_var anObj;
     localSelection( anObj, TopAbs_EDGE );
   }
index 4e555b021233c9b97b7885e0cfff210f2e447eee..b5d2df706207d98b55fa42db5ca98e6045a9b105 100644 (file)
@@ -304,7 +304,8 @@ void TransformationGUI_MirrorDlg::SetEditCurrentArgument()
       {
       case 0:
        {
-         globalSelection( GEOM_POINT );
+         //      globalSelection( GEOM_POINT );
+         localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
          break;
        }
       case 1:
index 30790bb595cbe0f11deaa5ec5ff265b91ff23783..5f2a52909a812f510a831670e5e8ee49e9973b88 100644 (file)
@@ -269,31 +269,28 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
       if(!testResult || CORBA::is_nil( aSelectedObject ))
        return;
 
-      if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0) {
-       if ( testResult && !aSelectedObject->_is_nil() )
+      aName = GEOMBase::GetName( aSelectedObject );
+      TopoDS_Shape aShape;
+      if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
        {
-         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 )
            {
-             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;
+             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(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 0)
+       myAxis = aSelectedObject;
       else if(myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
        myCentPoint = aSelectedObject;
       else if(myEditCurrentArgument == GroupPoints->LineEdit4)
@@ -301,7 +298,6 @@ void TransformationGUI_RotationDlg::SelectionIntoArgument()
       else if(myEditCurrentArgument == GroupPoints->LineEdit5)
        myPoint2 = aSelectedObject;
 
-      aName = GEOMBase::GetName( aSelectedObject );
     }
   myEditCurrentArgument->setText( aName );
 
@@ -329,17 +325,17 @@ void TransformationGUI_RotationDlg::SetEditCurrentArgument()
       localSelection( anObj, TopAbs_EDGE );
     }
     else
-      globalSelection( GEOM_POINT  );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if (send == GroupPoints->PushButton4)
     {
       myEditCurrentArgument = GroupPoints->LineEdit4;
-      globalSelection( GEOM_POINT );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
     }
   else if (send == GroupPoints->PushButton5)
     {
       myEditCurrentArgument = GroupPoints->LineEdit5;
-      globalSelection( GEOM_POINT );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
     }
 
   myEditCurrentArgument->setFocus();
index 44ec3615a5a343bd850d7f0d4287f7b8cd77f5f2..e24173dcfaa30a8b25cec36343ae16fbd2e01b7f 100644 (file)
 #include "SalomeApp_Application.h"
 #include "LightApp_SelectionMgr.h"
 
+#include <TopoDS_Shape.hxx>
+#include <TopoDS.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
+
 #include <qlabel.h>
 #include <qcheckbox.h>
 
@@ -194,10 +200,33 @@ void TransformationGUI_ScaleDlg::SelectionIntoArgument()
          return;
        }
       Standard_Boolean testResult = Standard_False;
-      myPoint = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+      GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject(firstIObject(), testResult );
+      aName = GEOMBase::GetName( aSelectedObject );
+      
+      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 );
+             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             aSelMgr->clearSelected();
+           }
+       }
+
+      myPoint = aSelectedObject;
+
       if(!testResult || CORBA::is_nil( myPoint ))
        return;
-      aName = GEOMBase::GetName( myPoint );
+
     }
   myEditCurrentArgument->setText( aName );
 
@@ -235,7 +264,7 @@ void TransformationGUI_ScaleDlg::SetEditCurrentArgument()
   }
   else if(send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
 
   myEditCurrentArgument->setFocus();
index 659819a7633d443d1fb92373cf7d3ab5523ce583..24dc59016a9e3433ac251c7efeb6f7ab5db37c9d 100644 (file)
@@ -283,38 +283,32 @@ void TransformationGUI_TranslationDlg::SelectionIntoArgument()
     if (!testResult || CORBA::is_nil( aSelectedObject ))
       return;
 
-    if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
-      myPoint1 = 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() );
+    TopoDS_Shape aShape;
+    aName = GEOMBase::GetName( aSelectedObject );
+    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);
+                   aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
                    aSelMgr->clearSelected();
-                 }
-               else
-                 myVector = aSelectedObject;
-           }
-       }
-    }
+         }
+      }
+    
+    if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 1)
+      myPoint1 = aSelectedObject;
+    else if (myEditCurrentArgument == GroupPoints->LineEdit2 && getConstructorId() == 2)
+      myVector = aSelectedObject;
     else if (myEditCurrentArgument == GroupPoints->LineEdit3)
       myPoint2 = aSelectedObject;
-
-    aName = GEOMBase::GetName( aSelectedObject );
   }
 
   myEditCurrentArgument->setText( aName );
@@ -352,16 +346,13 @@ void TransformationGUI_TranslationDlg::SetEditCurrentArgument()
   else if (send == GroupPoints->PushButton2) {
     myEditCurrentArgument = GroupPoints->LineEdit2;
     if (getConstructorId() == 1)
-      globalSelection( GEOM_POINT );
-    else {
-      //globalSelection( GEOM_LINE  );
-      GEOM::GEOM_Object_var anObj;
-      localSelection( anObj, TopAbs_EDGE );
-    }
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
+    else 
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if (send == GroupPoints->PushButton3) {
     myEditCurrentArgument = GroupPoints->LineEdit3;
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
 
   myEditCurrentArgument->setFocus();