]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
IPAL 18221 correct names and selection engine on NPAL 16768
authordmv <dmv@opencascade.com>
Wed, 19 Dec 2007 10:06:25 +0000 (10:06 +0000)
committerdmv <dmv@opencascade.com>
Wed, 19 Dec 2007 10:06:25 +0000 (10:06 +0000)
16 files changed:
src/BasicGUI/BasicGUI_ArcDlg.cxx
src/BasicGUI/BasicGUI_CurveDlg.cxx
src/BasicGUI/BasicGUI_EllipseDlg.cxx
src/BasicGUI/BasicGUI_LineDlg.cxx
src/BasicGUI/BasicGUI_PlaneDlg.cxx
src/BasicGUI/BasicGUI_PointDlg.cxx
src/BasicGUI/BasicGUI_VectorDlg.cxx
src/GEOMGUI/GEOM_msg_en.po
src/GenerationGUI/GenerationGUI_PipeDlg.cxx
src/GenerationGUI/GenerationGUI_PrismDlg.cxx
src/GenerationGUI/GenerationGUI_RevolDlg.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

index 7c1b8741f211e75a0e7ce26eb283452214d0f359..636d9efb6e5d5a14593f9cded9ef76b2b8664ddd 100644 (file)
@@ -287,9 +287,9 @@ 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;
+    QString aName = GEOMBase::GetName( aSelectedObject );
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -300,13 +300,14 @@ void BasicGUI_ArcDlg::SelectionIntoArgument()
            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();
+           aName.append( ":vertex_" + QString::number( anIndex ) );
          }
       }
+
+    myEditCurrentArgument->setText( aName );
+
     switch (getConstructorId())
     {
       case 0:
index 5ad899a0a30801e8200e8a2ef06197b35446d554..b310190a315b683f29129e979832b6b035d41a9e 100644 (file)
@@ -30,6 +30,7 @@
 #include "SUIT_Desktop.h"
 #include "SUIT_Session.h"
 #include "SalomeApp_Application.h"
+#include "SalomeApp_Study.h"
 #include "LightApp_SelectionMgr.h"
 
 #include <qlabel.h>
@@ -270,61 +271,97 @@ void BasicGUI_CurveDlg::SelectionIntoArgument()
   myEditCurrentArgument->setText("");
 
   Standard_Boolean aRes = Standard_False;
-  int i = 0;
   int IOC = IObjectCount();
-  bool is_append = myPoints->length() < IOC; // if true - add point, else remove
-  myPoints->length( IOC ); // this length may be greater than number of objects,
+  //  bool is_append = myPoints->length() < IOC; // if true - add point, else remove
+  //  myPoints->length( IOC ); // this length may be greater than number of objects,
                            // that will actually be put into myPoints
-  for ( SALOME_ListIteratorOfListIO anIt( selectedIO() ); anIt.More(); anIt.Next() )
+
+  LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+  SalomeApp_Application* app =
+    dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  _PTR(Study) aDStudy = appStudy->studyDS();
+  GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+
+  int anIndex;
+  TopoDS_Shape aShape;
+  TColStd_IndexedMapOfInteger aMapIndexes;
+  GEOM::GEOM_Object_var anObject;
+  std::list<GEOM::GEOM_Object_var> aList;
+  SALOME_ListIO selected;
+  aSelMgr->selectedObjects( selected, QString::null, false );
+
+  for ( SALOME_ListIteratorOfListIO anIt( selected ); anIt.More(); anIt.Next() )
     {
       GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIt.Value(), aRes );
+
       if ( !CORBA::is_nil( aSelectedObject ) && aRes )
        {
-         //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 )
+             aSelMgr->GetIndexes( anIt.Value(), aMapIndexes );
+
+             if ( aMapIndexes.Extent() > 0 )
                {
-                 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);
-
-         myPoints[i++] = aSelectedObject;
+                 for (int ii=1; ii <= aMapIndexes.Extent(); ii++) {
+                   anIndex = aMapIndexes(ii);
+                   QString aName = GEOMBase::GetName( aSelectedObject );
+                   aName = aName + ":vertex_" + QString::number( anIndex );
+                   anObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+                   //Find Object in study
+                   _PTR(SObject) obj ( aDStudy->FindObjectID( anIt.Value()->getEntry() ) );
+                   bool inStudy = false;
+                   for (_PTR(ChildIterator) iit (aDStudy->NewChildIterator(obj)); iit->More(); iit->Next()) {
+                     _PTR(SObject) child (iit->Value());
+                     QString aChildName = child->GetName();
+                     if (aChildName == aName) {
+                       inStudy = true;
+                       CORBA::Object_var corbaObj = GeometryGUI::ClientSObjectToObject(iit->Value());
+                       anObject = GEOM::GEOM_Object::_narrow( corbaObj );
+                     }
+                   }
+
+                   if (!inStudy)
+                     GeometryGUI::GetGeomGen()->AddInStudy(GeometryGUI::ClientStudyToStudy(aDStudy),
+                                                           anObject, aName, aSelectedObject);
+                   
+                   int pos = isPointInList(myOrderedSel, anObject);
+                   if (pos==-1) {
+                     myOrderedSel.push_back(anObject);
+                   }
+                   //              if (!inStudy)
+                   aList.push_back(anObject);
+                 }
+               } else { // aMap.Extent() == 0
+                 int pos = isPointInList(myOrderedSel,aSelectedObject);
+                 if(pos==-1)
+                   myOrderedSel.push_back(aSelectedObject);
+                 aList.push_back(aSelectedObject);
+               } 
+           }
        }
     }
 
-  myPoints->length( i ); // this is the right length, smaller of equal to the previously set
+  myPoints->length( aList.size()  );  
+
+  int k=0;
+  for (list<GEOM::GEOM_Object_var>::iterator j=aList.begin();j!=aList.end();j++)
+      myPoints[k++] = *j;
+
   if(IOC == 0)
     myOrderedSel.clear();
   else
-    removeUnnecessaryPnt(myOrderedSel,myPoints);
+    removeUnnecessaryPnt(myOrderedSel, myPoints);
 
-  if(myOrderedSel.size() == myPoints->length()){
-    int k=0;
-    for (list<GEOM::GEOM_Object_var>::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++)
-      myPoints[k++] = *j;
-  } else {
-    //cout << "ERROR: Ordered sequence size != selection sequence size! ("<<myOrderedSel.size()<<"!="<<myPoints->length()<<")"<<endl;
-  }
-  if ( i )
-    GroupPoints->LineEdit1->setText( QString::number( i ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
+  // if ( myOrderedSel.size() == myPoints->length() ) {
+  myPoints->length( myOrderedSel.size()  );  
+  k=0;
+  for (list<GEOM::GEOM_Object_var>::iterator j=myOrderedSel.begin();j!=myOrderedSel.end();j++)
+    myPoints[k++] = *j;
+  //  }
+
+  if ( myPoints->length() > 0  )
+    GroupPoints->LineEdit1->setText( QString::number( myPoints->length() ) + "_" + tr( "GEOM_POINT" ) + tr( "_S_" ) );
   
   displayPreview(); 
 }
index e361991558670f92c7c773bd02babf470384a0eb..007c1990d6b547d004792d34c33347f370c88df2 100644 (file)
@@ -108,8 +108,7 @@ void BasicGUI_EllipseDlg::Init()
 {
   /* init variables */
   myEditCurrentArgument = GroupPoints->LineEdit1;
-  //  globalSelection( GEOM_POINT );
-  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); //Select Vertex on All Shapes
+  localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX);
 
   myPoint = myDir = GEOM::GEOM_Object::_nil();
 
@@ -214,9 +213,10 @@ void BasicGUI_EllipseDlg::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;
+    QString aName = GEOMBase::GetName( aSelectedObject );
+
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -227,13 +227,17 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
            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);
+           if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+             aName.append( ":edge_" + QString::number( anIndex ) );
+           else
+             aName.append( ":vertex_" + QString::number( anIndex ) );
            aSelMgr->clearSelected();
          }
       }
+
+    myEditCurrentArgument->setText( aName );
+
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myDir   = aSelectedObject;
   }
@@ -249,6 +253,7 @@ void BasicGUI_EllipseDlg::SelectionIntoArgument()
 void BasicGUI_EllipseDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_POINT );
 
   if      ( send == GroupPoints->PushButton1 ) myEditCurrentArgument = GroupPoints->LineEdit1;
   else if ( send == GroupPoints->PushButton2 ) myEditCurrentArgument = GroupPoints->LineEdit2;
index ea8eea98e74d86ba61e239ee1805ae2acdedccca..11132227f9d6b94ef8826da8370f3c287c0703df 100644 (file)
@@ -200,6 +200,7 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
   {
   case 0:
     {
+      globalSelection(GEOM_POINT); // to break previous local selection
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
       myEditCurrentArgument = GroupPoints->LineEdit1;
       myEditCurrentArgument->setText("");
@@ -211,6 +212,7 @@ void BasicGUI_LineDlg::ConstructorsClicked(int constructorId)
     }
   case 1:
     {
+      globalSelection(GEOM_PLANE);  // to break previous local selection
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
       myEditCurrentArgument = GroupFaces->LineEdit1;
       myEditCurrentArgument->setText("");
@@ -249,8 +251,9 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
-    myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     TopoDS_Shape aShape;
+    QString aName = GEOMBase::GetName( aSelectedObject );
+
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -261,13 +264,17 @@ void BasicGUI_LineDlg::SelectionIntoArgument()
            GEOM::GEOM_IShapesOperations_var aShapesOp =
                      getGeomEngine()->GetIShapesOperations( getStudyId() );
            int anIndex = aMap( 1 );
-           TopTools_IndexedMapOfShape aShapes;
-           TopExp::MapShapes( aShape, aShapes );
-           aShape = aShapes.FindKey( anIndex );
+           if ( myEditCurrentArgument == GroupFaces->LineEdit1 ||
+                myEditCurrentArgument == GroupFaces->LineEdit2 )
+             aName.append( ":face_" + QString::number( anIndex ) );
+           else
+             aName.append( ":vertex_" + QString::number( anIndex ) );
            aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
            aSelMgr->clearSelected();
          }
       }
+    myEditCurrentArgument->setText( aName );
+
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupFaces->LineEdit1 )  myFace1 = aSelectedObject;
@@ -321,7 +328,6 @@ void BasicGUI_LineDlg::ActivateThisDialog()
          SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
 
   // myGeomGUI->SetState( 0 );
-  //  globalSelection( GEOM_POINT );
   localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
   myEditCurrentArgument = GroupPoints->LineEdit1;
index a6f6c796545cfb54056b320e5f914f4ee17a213e..0bc6784e822789e248140f2fd15d174066fb2f85 100644 (file)
@@ -216,6 +216,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
                                GroupPntDir->LineEdit2->setText(tr(""));
 
                                /* for the first argument */
+                               globalSelection( GEOM_POINT ); // to break previous local selection
                                localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
                                break;
       }
@@ -232,6 +233,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
                                Group3Pnts->LineEdit3->setText("");
 
                                /* for the first argument */
+                               globalSelection( GEOM_POINT ); // to break previous local selection
                                localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
                                break;
       }
@@ -246,7 +248,7 @@ void BasicGUI_PlaneDlg::ConstructorsClicked(int constructorId)
                                GroupFace->LineEdit1->setText(tr(""));
 
                                /* for the first argument */
-                               //globalSelection( GEOM_PLANE );
+                               globalSelection( GEOM_PLANE );
                                 TColStd_MapOfInteger aMap;
                                 aMap.Add( GEOM_PLANE );
                                 aMap.Add( GEOM_MARKER );
@@ -319,8 +321,9 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
-    myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     TopoDS_Shape aShape;
+    QString aName = GEOMBase::GetName( aSelectedObject );
+
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -331,13 +334,17 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
            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);
+           if ( myEditCurrentArgument == GroupPntDir->LineEdit2 )
+             aName.append( ":edge_" + QString::number( anIndex ) );
+           else
+             aName.append( ":vertex_" + QString::number( anIndex ) );
+
            aSelMgr->clearSelected();
          }
       }
+    myEditCurrentArgument->setText( aName );
+
     if      ( myEditCurrentArgument == GroupPntDir->LineEdit1 ) myPoint  = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) myDir    = aSelectedObject;
     else if ( myEditCurrentArgument == Group3Pnts->LineEdit1 )  myPoint1 = aSelectedObject;
@@ -356,6 +363,7 @@ void BasicGUI_PlaneDlg::SelectionIntoArgument()
 void BasicGUI_PlaneDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_POINT );
 
   if      ( send == GroupPntDir->PushButton1 ) myEditCurrentArgument = GroupPntDir->LineEdit1;
   else if ( send == GroupPntDir->PushButton2 ) myEditCurrentArgument = GroupPntDir->LineEdit2;
@@ -366,12 +374,10 @@ void BasicGUI_PlaneDlg::SetEditCurrentArgument()
 
   myEditCurrentArgument->setFocus();
 
-  if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) {
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
-  }
+  if ( myEditCurrentArgument == GroupPntDir->LineEdit2 ) 
+    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   else if ( myEditCurrentArgument == GroupFace->LineEdit1 ) {
-    //globalSelection( GEOM_PLANE );
+    globalSelection( GEOM_PLANE );
     TColStd_MapOfInteger aMap;
     aMap.Add( GEOM_PLANE );
     aMap.Add( GEOM_MARKER );
index 9756daf06fe7118f251277c143f4d06a3a7887d2..dc932e2a4ab732d659a51e2ed971ca281ac037d3 100644 (file)
@@ -240,6 +240,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
   {
   case 0:
     {
+      globalSelection( GEOM_POINT); // to break previous local selection
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
       GroupRefPoint->hide();
@@ -254,7 +255,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument = GroupRefPoint->LineEdit1;
       myEditCurrentArgument->setText("");
       myRefPoint = GEOM::GEOM_Object::_nil();
-
+      globalSelection( GEOM_POINT); // to break previous local selection
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
 
       GroupXYZ->hide();
@@ -269,7 +270,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument = GroupOnCurve->LineEdit1;
       myEditCurrentArgument->setText("");
       myEdge = GEOM::GEOM_Object::_nil();
-
+      globalSelection( GEOM_LINE); // to break previous local selection
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
       GroupXYZ->hide();
@@ -286,7 +287,7 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       GroupLineIntersection->LineEdit2->setText("");
       myLine1 = GEOM::GEOM_Object::_nil();
       myLine2 = GEOM::GEOM_Object::_nil();
-
+      globalSelection( GEOM_EDGE); // to break previous local selection
       localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
       GroupXYZ->hide();
@@ -373,25 +374,30 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
     {
       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);
-        }
-      }
+       {
+         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 );
+             aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+             if ( id == 2 || id == 3 )
+               aName.append( ":edge_" + QString::number( anIndex ) );
+             else
+               aName.append( ":vertex_" + QString::number( anIndex ) );
+             aSelMgr->clearSelected();
+           }
+       }
+
       if ( id == 0 )
       {
-        if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
-          return;
+       GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE );
+
+       if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX )
+         return;
 
         gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
         GroupXYZ->SpinBox_DX->SetValue( aPnt.X() );
@@ -449,6 +455,7 @@ void BasicGUI_PointDlg::LineEditReturnPressed()
 void BasicGUI_PointDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_POINT); // to break previous local selection
 
   if ( send == GroupRefPoint->PushButton1 )
   {
index e045fb66af04d68a5fef07cc64e60defdd939b14..534e025914775d9308efe2f94484b8419279c126 100644 (file)
@@ -276,8 +276,9 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
   GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes );
   if ( !CORBA::is_nil( aSelectedObject ) && aRes )
   {
-    myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     TopoDS_Shape aShape;
+    QString aName = GEOMBase::GetName( aSelectedObject );
+
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -288,13 +289,13 @@ void BasicGUI_VectorDlg::SelectionIntoArgument()
            GEOM::GEOM_IShapesOperations_var aShapesOp =
              getGeomEngine()->GetIShapesOperations( getStudyId() );
            int anIndex = aMap( 1 );
-           TopTools_IndexedMapOfShape aShapes;
-           TopExp::MapShapes( aShape, aShapes );
-           aShape = aShapes.FindKey( anIndex );
+           aName.append( ":vertex_" + QString::number( anIndex ) );
            aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
            aSelMgr->clearSelected();
          }
       }
+    myEditCurrentArgument->setText( aName );
+
     if      ( myEditCurrentArgument == GroupPoints->LineEdit1 ) myPoint1 = aSelectedObject;
     else if ( myEditCurrentArgument == GroupPoints->LineEdit2 ) myPoint2 = aSelectedObject;
   }
index 36e0dbd4ba79afbf97f14ecb5aabd5c836029907..680043394a777cb3a33cea09fe89300bfc1adb1d 100644 (file)
@@ -239,7 +239,7 @@ msgstr "Warning"
 
 #: GeometryGUI.cxx:3854
 msgid "GEOM_REALLY_DELETE"
-msgstr "Do you really want to delete this %1 object(s): %2"
+msgstr "Do you really want to delete this %1 object(s):"
 
 #
 #==============================================================================
index 01ca3094e46ae8ebfba64f1cdbc283914dff2364..f086619532859f40eb74a8ea9848869225873f21 100644 (file)
@@ -199,6 +199,7 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
       return;
     
     myBase = aSelectedObject;
+    myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
     myOkBase = true;
   }
   else if(myEditCurrentArgument == GroupPoints->LineEdit2) {
@@ -211,28 +212,25 @@ void GenerationGUI_PipeDlg::SelectionIntoArgument()
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
        TColStd_IndexedMapOfInteger aMap;
+       QString aName = GEOMBase::GetName( aSelectedObject );
        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();
-           }
+           myPath = aShapesOp->GetSubShape(aSelectedObject, anIndex);
+           aName.append( ":edge_" + QString::number( anIndex ) );
+           myOkPath = true;
+           aSelMgr->clearSelected();
          }
-       else if ( S.ShapeType() == TopAbs_WIRE || S.ShapeType() == TopAbs_EDGE ) {
+       else {
            myPath = aSelectedObject;
            myOkPath = true;
          }
+       myEditCurrentArgument->setText( aName );
       }
   }
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
   
   displayPreview();
 }
index c6141aa2be17df2497cb0ac45f9b65480c614303..cc417d0f5ce6eb0caee4f42b72355992bedff2c2 100644 (file)
@@ -289,8 +289,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
     if (!testResult)
       return;
 
-    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
     TopoDS_Shape aShape;
+    QString aName = GEOMBase::GetName( aSelectedObject );    
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -301,10 +301,8 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
            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);
+           aName.append( ":edge_" + QString::number( anIndex ) );
            aSelMgr->clearSelected();
          }
       }
@@ -317,7 +315,7 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
       myVec = aSelectedObject;
       myOkVec = true;
     }
-    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+    myEditCurrentArgument->setText( aName );
   }
   else // getConstructorId()==1 - extrusion using 2 points
   {
@@ -343,8 +341,9 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
     if (!testResult || CORBA::is_nil( aSelectedObject ))
       return;
 
-    myEditCurrentArgument->setText(GEOMBase::GetName(aSelectedObject));
+    QString aName = GEOMBase::GetName( aSelectedObject );
     TopoDS_Shape aShape;
+
     if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
       {
        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -355,14 +354,14 @@ void GenerationGUI_PrismDlg::SelectionIntoArgument()
            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);
+           aName.append( ":vertex_" + QString::number( anIndex ) );
            aSelMgr->clearSelected();
          }
       }
 
+    myEditCurrentArgument->setText( aName );
+
     if (myEditCurrentArgument == GroupPoints2->LineEdit1) {
       myBase = aSelectedObject;
       myOkBase = true;
@@ -408,6 +407,7 @@ void GenerationGUI_PrismDlg::LineEditReturnPressed()
 void GenerationGUI_PrismDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_POINT ); // to break previous local selection
 
   if (send == GroupPoints->PushButton1) {
     GroupPoints->LineEdit1->setFocus();
@@ -417,9 +417,7 @@ void GenerationGUI_PrismDlg::SetEditCurrentArgument()
   else if (send == GroupPoints->PushButton2) {
     GroupPoints->LineEdit2->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit2;
-    //    globalSelection( GEOM_LINE );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   else if (send == GroupPoints2->PushButton1) {
     GroupPoints2->LineEdit1->setFocus();
index 2f063f1949d874b8368b18b684a04fc087b3aba3..fa1d703ff4e9eeb8ed0b3bd5ff07bbefce924fae 100644 (file)
@@ -221,6 +221,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
   // nbSel == 1
   Standard_Boolean testResult = Standard_False;
   GEOM::GEOM_Object_ptr aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
+  QString aName = GEOMBase::GetName( aSelectedObject );
   
   if (!testResult)
     return;
@@ -250,9 +251,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
                  GEOM::GEOM_IShapesOperations_var aShapesOp =
                    getGeomEngine()->GetIShapesOperations( getStudyId() );
                  int anIndex = aMap( 1 );
-                 TopTools_IndexedMapOfShape aShapes;
-                 TopExp::MapShapes( aShape, aShapes );
-                 aShape = aShapes.FindKey( anIndex );
+                 aName.append( ":edge_" + QString::number( anIndex ) );
                  myAxis = aShapesOp->GetSubShape(aSelectedObject, anIndex);
                  aSelMgr->clearSelected();
                }
@@ -263,7 +262,7 @@ void GenerationGUI_RevolDlg::SelectionIntoArgument()
          }
       }
   }
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  myEditCurrentArgument->setText( aName );
 
   displayPreview();
 }
@@ -286,8 +285,7 @@ void GenerationGUI_RevolDlg::SetEditCurrentArgument()
     GroupPoints->LineEdit2->setFocus();
     myEditCurrentArgument = GroupPoints->LineEdit2;
     //globalSelection( GEOM_LINE );
-    GEOM::GEOM_Object_var anObj;
-    localSelection( anObj, TopAbs_EDGE );
+    localSelection(GEOM::GEOM_Object::_nil(), TopAbs_EDGE);
   }
   SelectionIntoArgument();
 }
index aa4ad1b91e34dc720020ccc22df5cfea2b12cc96..84f861301f97a174c0cb75f6d49bb6a0fa83e59a 100644 (file)
@@ -254,8 +254,8 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
   if(!testResult || CORBA::is_nil( aSelectedObject ))
     return;
 
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
   TopoDS_Shape aShape;
+  QString aName = GEOMBase::GetName( aSelectedObject );
   if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
     {
       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -266,13 +266,14 @@ void PrimitiveGUI_BoxDlg::SelectionIntoArgument()
          GEOM::GEOM_IShapesOperations_var aShapesOp =
            getGeomEngine()->GetIShapesOperations( getStudyId() );
          int anIndex = aMap( 1 );
-         TopTools_IndexedMapOfShape aShapes;
-         TopExp::MapShapes( aShape, aShapes );
-         aShape = aShapes.FindKey( anIndex );
+         aName.append( ":vertex_" + QString::number( anIndex ) );        
          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
          aSelMgr->clearSelected();
        }
     }
+
+  myEditCurrentArgument->setText( aName );
+
   if(myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint1 = aSelectedObject;
   else if(myEditCurrentArgument == GroupPoints->LineEdit2)
index 8a7659e1df8ab8b33fc7eb9bf839aeded54effd3..659471593558af9e036df4aa2076cf8ddaa287a7 100644 (file)
@@ -276,7 +276,8 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
     return;
 
   TopoDS_Shape aShape;
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  QString aName = GEOMBase::GetName( aSelectedObject );
+
   if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
     {
       LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
@@ -287,13 +288,16 @@ void PrimitiveGUI_ConeDlg::SelectionIntoArgument()
          GEOM::GEOM_IShapesOperations_var aShapesOp =
            getGeomEngine()->GetIShapesOperations( getStudyId() );
          int anIndex = aMap( 1 );
-         TopTools_IndexedMapOfShape aShapes;
-         TopExp::MapShapes( aShape, aShapes );
-         aShape = aShapes.FindKey( anIndex );
+         if ( myEditCurrentArgument == GroupPoints->LineEdit2  )
+           aName.append( ":edge_" + QString::number( anIndex ) );
+         else
+           aName.append( ":vertex_" + QString::number( anIndex ) );
          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
          aSelMgr->clearSelected();
        }
     }
+  myEditCurrentArgument->setText( aName );
+
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = aSelectedObject;
   else if (myEditCurrentArgument == GroupPoints->LineEdit2) 
@@ -313,14 +317,13 @@ void PrimitiveGUI_ConeDlg::SetEditCurrentArgument()
   
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    //    globalSelection( GEOM_POINT );
+    globalSelection( GEOM_POINT ); // to break prvious local selection
     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 );
+    globalSelection( GEOM_LINE );// to break prvious local selection
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   
   myEditCurrentArgument->setFocus();
index 168a251591861c55fc68b4387d74c409e306e304..e741b4f7bb565bc2bc378d3abcd26e7f594264eb 100644 (file)
@@ -271,7 +271,7 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
   if(!testResult || CORBA::is_nil( aSelectedObject ))
     return;
 
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  QString aName = GEOMBase::GetName( aSelectedObject );
   TopoDS_Shape aShape;
   if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
     {
@@ -283,13 +283,16 @@ void PrimitiveGUI_CylinderDlg::SelectionIntoArgument()
          GEOM::GEOM_IShapesOperations_var aShapesOp =
            getGeomEngine()->GetIShapesOperations( getStudyId() );
          int anIndex = aMap( 1 );
-         TopTools_IndexedMapOfShape aShapes;
-         TopExp::MapShapes( aShape, aShapes );
-         aShape = aShapes.FindKey( anIndex );
+         if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+           aName.append( ":edge_" + QString::number( anIndex ) );
+         else
+           aName.append( ":vertex_" + QString::number( anIndex ) );
          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
          aSelMgr->clearSelected();
        }
     }
+  myEditCurrentArgument->setText( aName );
+
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = aSelectedObject;
   else if (myEditCurrentArgument == GroupPoints->LineEdit2)
@@ -308,14 +311,13 @@ void PrimitiveGUI_CylinderDlg::SetEditCurrentArgument()
   
   if(send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;
-    //    globalSelection( GEOM_POINT );
+    globalSelection( GEOM_POINT ); // to break previous local selection
     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 );
+    globalSelection( GEOM_LINE );  // to break previous local selection
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
   
   myEditCurrentArgument->setFocus();
index b1b56fea6177724d28440a3bedf927381df83178..e0a7c5f33e8c52315cb50ec7b92f7086f9d23732 100644 (file)
@@ -244,7 +244,7 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
   if (!testResult || CORBA::is_nil( aSelectedObject ))
     return;
 
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  QString aName = GEOMBase::GetName( aSelectedObject );
   TopoDS_Shape aShape;
   if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
     {
@@ -256,13 +256,13 @@ void PrimitiveGUI_SphereDlg::SelectionIntoArgument()
          GEOM::GEOM_IShapesOperations_var aShapesOp =
            getGeomEngine()->GetIShapesOperations( getStudyId() );
          int anIndex = aMap( 1 );
-         TopTools_IndexedMapOfShape aShapes;
-         TopExp::MapShapes( aShape, aShapes );
-         aShape = aShapes.FindKey( anIndex );
+         aName.append( ":vertex_" + QString::number( anIndex ) );
          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
          aSelMgr->clearSelected();
        }
     }
+
+  myEditCurrentArgument->setText( aName );
   myPoint = aSelectedObject;
  
   displayPreview();
index dad4b531f8ef1c836bf302c41b3a923a4c88e503..4e245166523866ad8f8dd6ea50c8658faa7e4279 100644 (file)
@@ -262,7 +262,7 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
   if (!testResult || CORBA::is_nil( aSelectedObject ))
     return;
 
-  myEditCurrentArgument->setText( GEOMBase::GetName( aSelectedObject ) );
+  QString aName = GEOMBase::GetName( aSelectedObject );
   TopoDS_Shape aShape;
   if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() )
     {
@@ -274,13 +274,16 @@ void PrimitiveGUI_TorusDlg::SelectionIntoArgument()
          GEOM::GEOM_IShapesOperations_var aShapesOp =
            getGeomEngine()->GetIShapesOperations( getStudyId() );
          int anIndex = aMap( 1 );
-         TopTools_IndexedMapOfShape aShapes;
-         TopExp::MapShapes( aShape, aShapes );
-         aShape = aShapes.FindKey( anIndex );
+         if ( myEditCurrentArgument == GroupPoints->LineEdit2 )
+           aName.append( ":edge_" + QString::number( anIndex ) );
+         else
+           aName.append( ":vertex_" + QString::number( anIndex ) );
          aSelectedObject = aShapesOp->GetSubShape(aSelectedObject, anIndex);
          aSelMgr->clearSelected();
        }
     }
+  myEditCurrentArgument->setText( aName );
+
   if (myEditCurrentArgument == GroupPoints->LineEdit1)
     myPoint = aSelectedObject;
   else if (myEditCurrentArgument == GroupPoints->LineEdit2)
@@ -313,6 +316,7 @@ void PrimitiveGUI_TorusDlg::LineEditReturnPressed()
 void PrimitiveGUI_TorusDlg::SetEditCurrentArgument()
 {
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_POINT ); // to break previous local selection
 
   if (send == GroupPoints->PushButton1) {
     myEditCurrentArgument = GroupPoints->LineEdit1;