]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
PAL14047 Problem to select merged face with Create group window
authoreap <eap@opencascade.com>
Wed, 7 May 2008 17:31:32 +0000 (17:31 +0000)
committereap <eap@opencascade.com>
Wed, 7 May 2008 17:31:32 +0000 (17:31 +0000)
      redesign GroupDlg

doc/salome/gui/GEOM/images/editgroup.png
doc/salome/gui/GEOM/images/geomcreategroup.png
doc/salome/gui/GEOM/input/working_with_groups.doc
src/GEOMGUI/GEOM_msg_en.po
src/GroupGUI/GroupGUI_GroupDlg.cxx
src/GroupGUI/GroupGUI_GroupDlg.h

index e92fe5ab22d142b0674c13aeae253b13761d988e..404877267cecbaca9d9c863f70d31e11035ab37e 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/editgroup.png and b/doc/salome/gui/GEOM/images/editgroup.png differ
index a9b310d941e54ab07b16974ed059d9e827eefb0e..17aafd2215c48328df3ba1526f118499bad7ff5d 100755 (executable)
Binary files a/doc/salome/gui/GEOM/images/geomcreategroup.png and b/doc/salome/gui/GEOM/images/geomcreategroup.png differ
index 19d8f45bbcab637f91826f26d30c32928109c02f..420c68153b6e942583a7f06d2f177a1130f62ecc 100644 (file)
@@ -25,26 +25,32 @@ group (points, wires, faces, shells or solids).</li>
 default, it is Group_n.</li>
 <li>Then, using the "Select" button, select the <b>Main Shape</b> (a
 geometrical object on which the group will be created). </li>
+<li> <b>Select Sub-Shapes</b> button group lets you restrict range
+of group elements you operate with.
+<ul><li>\b All button enables work with all sub-shapes of the Main
+Shape.</li>
+<li><b>In Place of Second Shape</b> restricts range of accesible
+elements to those sub-shapes of the Main Shape that geometrically
+coincide with the <b>Second Shape</b>.</li>
+<li><b>Sub-Shapes of Second Shape</b> restricts range of elements to 
+those sub-shapes of the Main Shape that are sub-shapes of <b>Second
+Shape</b>.</li>
+</ul>
 <li> You can select the elements of your group in two ways:
 <ul>
-<li>You can select them
-manually in the 3D Viewer, and add to the group by clicking the \b Add
-button (keep down the Shift button on the keyboard to select several
-elements and add all them together). The indexes of the selected
-elements will be displayed in the list. To delete elements from the
-list, select them and click \b Remove button.\n
-    Checking in <b>Select in Place of Second Shape</b> box allows you
-to specify <b>Second Shape</b> which will restrict selection to those
-subshapes of the main shape that geometrically coincide with the
-Second Shape.
-</li>
+<li>You can select them manually in the 3D Viewer, and add to the
+group by clicking the \b Add button (keep down the Shift button on the
+keyboard to select several elements and add all them together). The
+indexes of the selected elements will be displayed in the list. To
+delete elements from the list, select them and click \b Remove
+button.</li>
 <li>Clicking <b>Select All</b> button you can add all object's
 elements of a certain type in the list of the elements of the
 group. To delete elements from the list, select them and click \b
-Remove button. If you set <b>Second shape</b>, action of <b>Select
-All</b> is limited to subshapes geometrically coincident with the
-Second Shape</li>
-</ul></li>
+Remove button. If you set <b>Second Shape</b>, action of <b>Select
+All</b> is limited according to you choice in <b>Select Sub-Shapes</b>
+button group.</li></ul>
+</li>
 <li>Finally, confirm your selection by clicking \b OK (also closes the
 Menu) or \b Apply (leaves the Menu open for creation of other groups),
 or skip it by clicking \b Close button.</li>
index bfbed147b4ac6bdbd00ada369dcb0b3899df5e00..b82b694b619a660cd519aafbd4b8aeaec2ae4924 100644 (file)
@@ -1941,8 +1941,14 @@ msgstr "Main Shape"
 msgid "GroupGUI_GroupDlg::SELECT_SUB_SHAPES"
 msgstr "Select Sub-Shapes"
 
+msgid "GroupGUI_GroupDlg::ALL_SUBSHAPES"
+msgstr "All"
+
 msgid "GroupGUI_GroupDlg::GET_IN_PLACE"
-msgstr "Select In Place of Second Shape"
+msgstr "In Place of Second Shape"
+
+msgid "GroupGUI_GroupDlg::SUBSHAPES_OF_SHAPE2"
+msgstr "Sub-Shapes of Second Shape"
 
 msgid "GroupGUI_GroupDlg::SECOND_SHAPE"
 msgstr "Second Shape"
index 615743dc8806519cf451fb4530a790a4d16db793..39ecac7357d0cecc13186586c4ffb0b2235533fc 100644 (file)
@@ -47,6 +47,7 @@
 #include <TColStd_MapOfInteger.hxx>
 #include <TColStd_DataMapIteratorOfDataMapOfIntegerInteger.hxx>
 
+enum { ALL_SUBSHAPES = 0, GET_IN_PLACE, SUBSHAPES_OF_SHAPE2 };
 
 GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, GeometryGUI* theGeometryGUI, QWidget* parent)
   :GEOMBase_Skeleton( theGeometryGUI, parent, "GroupGUI_GroupDlg", false,
@@ -82,7 +83,7 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, GeometryGUI* theGeometryGUI, QWi
   Layout1->addWidget( GroupMedium, 2, 0 );
 
   QWidget* aFrame = new QWidget( GroupMedium );
-  QGridLayout* aMedLayout = new QGridLayout( aFrame, 5, 4, 0, 6 );
+  QGridLayout* aMedLayout = new QGridLayout( aFrame, 6, 4, 0, 6 );
 
   QLabel* aMainLabel = new QLabel( tr( "MAIN_SHAPE" ), aFrame );
 
@@ -105,7 +106,17 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, GeometryGUI* theGeometryGUI, QWi
   myShape2Name->setEnabled( false );
 
   //mySelSubBtn = new QRadioButton ( tr( "SELECT_SUB_SHAPES" ), aFrame );
-  myPlaceCheckBox  = new QCheckBox ( tr( "GET_IN_PLACE" ), aFrame );
+  //myPlaceCheckBox  = new QCheckBox ( tr( "GET_IN_PLACE" ), aFrame );
+  mySelectionWayGroup = new QButtonGroup(1, Qt::Horizontal, tr("SELECT_SUB_SHAPES"),aFrame);
+  mySelectionWayGroup->setExclusive(true);
+  QRadioButton* allSubs     = new QRadioButton(tr("ALL_SUBSHAPES")      ,mySelectionWayGroup);
+  QRadioButton* inPlaceSubs = new QRadioButton(tr("GET_IN_PLACE")       ,mySelectionWayGroup);
+  QRadioButton* shape2Subs  = new QRadioButton(tr("SUBSHAPES_OF_SHAPE2"),mySelectionWayGroup);
+  mySelectionWayGroup->insert(allSubs    , ALL_SUBSHAPES);
+  mySelectionWayGroup->insert(inPlaceSubs, GET_IN_PLACE);
+  mySelectionWayGroup->insert(shape2Subs , SUBSHAPES_OF_SHAPE2);
+  mySelectionWayGroup->setButton( ALL_SUBSHAPES );
+
   mySelAllBtn = new QPushButton( tr( "SELECT_ALL" ), aFrame );
   myAddBtn    = new QPushButton( tr( "ADD" ), aFrame );
   myRemBtn    = new QPushButton( tr( "REMOVE" ), aFrame );
@@ -125,11 +136,14 @@ GroupGUI_GroupDlg::GroupGUI_GroupDlg(Mode mode, GeometryGUI* theGeometryGUI, QWi
 
   //aMedLayout->addMultiCellWidget( mySelSubBtn, 2, 2, 0, 1 );
   //aMedLayout->addWidget( myPlaceCheckBox, 2, 2 );
-  aMedLayout->addMultiCellWidget( myPlaceCheckBox, 2, 2, 0, 2 );
+  //aMedLayout->addMultiCellWidget( myPlaceCheckBox, 2, 2, 0, 2 );
+  aMedLayout->addMultiCellWidget( mySelectionWayGroup, 2, 4, 0, 2 );
   aMedLayout->addWidget( mySelAllBtn, 2, 3 );
-  aMedLayout->addMultiCellWidget( myIdList, 3, 4, 0, 2 );
   aMedLayout->addWidget( myAddBtn, 3, 3 );
   aMedLayout->addWidget( myRemBtn, 4, 3 );
+  aMedLayout->addMultiCellWidget( myIdList, 5, 5, 0, 3 );
+  aMedLayout->setRowStretch( 5, 1 );
+  
 
   setHelpFileName("work_with_groups_page.html");
 
@@ -197,7 +211,8 @@ void GroupGUI_GroupDlg::Init()
   connect( buttonApply, SIGNAL( clicked() ), this, SLOT( ClickOnApply() ) );
 
   //connect( mySelSubBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
-  connect( myPlaceCheckBox, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+  //connect( myPlaceCheckBox, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
+  connect( mySelectionWayGroup,SIGNAL(clicked(int)),this,SLOT(SetEditCurrentArgument()));
   connect( mySelAllBtn, SIGNAL( clicked() ), this, SLOT( SetEditCurrentArgument() ) );
   connect( myAddBtn,    SIGNAL( clicked() ), this, SLOT( add() ) );
   connect( myRemBtn,    SIGNAL( clicked() ), this, SLOT( remove() ) );
@@ -313,18 +328,17 @@ void GroupGUI_GroupDlg::SetEditCurrentArgument()
   }
   else if ( /*(QRadioButton*)sender() == mySelSubBtn ||*/ send == mySelAllBtn )
     myEditCurrentArgument = 0;
-  else if ( send == mySelBtn2 || (QCheckBox*)sender() == myPlaceCheckBox ) {
+  else if ( send == mySelBtn2 || sender() == mySelectionWayGroup ) {
     setInPlaceObj( GEOM::GEOM_Object::_nil() );
-    if ( myPlaceCheckBox->isChecked() ) {
+    //if ( myPlaceCheckBox->isChecked() )
+    myShape2Name->setText( "" );
+    if ( subSelectionWay() != ALL_SUBSHAPES )
+    {
       myEditCurrentArgument = myShape2Name;
-      //myIdList->clear();
-      myShape2Name->setText( "" );
     }
     else {
       //myEditCurrentArgument = myMainName;
       myEditCurrentArgument = 0;
-      myShape2Name->setText( "" );
-      //myIdList->clear();
     }
   }
 
@@ -365,9 +379,15 @@ void GroupGUI_GroupDlg::onGetInPlace()
     if ( !anObj->_is_equivalent(myMainObj) && !anObj->_is_equivalent( myGroup )) {
       SUIT_OverrideCursor wc;
       myEditCurrentArgument->setText( GEOMBase::GetName( anObj ) );
-      GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
-      GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
-      setInPlaceObj( aGetInPlaceObj );
+      GEOM::GEOM_IShapesOperations_var aShapesOp =
+        getGeomEngine()->GetIShapesOperations( getStudyId() );
+      if ( subSelectionWay() == GET_IN_PLACE ) {
+        GEOM::GEOM_Object_var aGetInPlaceObj = aShapesOp->GetInPlace(myMainObj, anObj);
+        setInPlaceObj( aGetInPlaceObj );
+      }
+      else {
+        setInPlaceObj( anObj );
+      }
       myEditCurrentArgument = 0;
       //myBusy = true; // just activate but do not select in the list
       activateSelection();
@@ -385,15 +405,16 @@ void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj )
 {
   if ( ! myInPlaceObj->_is_equivalent( theObj ) )
   {
-    const char* tmpName = "InPlaceObj";
+    const char* tmpName = "__InPlaceObj__";
     // remove old InPlaceObj
     if ( !myInPlaceObj->_is_nil() ) {
-      if (_PTR(SObject) SO = getStudy()->studyDS()->FindObject( tmpName ))
+      if (_PTR(SObject) SO = getStudy()->studyDS()->FindObject( tmpName )) {
         getStudy()->studyDS()->NewBuilder()->RemoveObjectWithChildren( SO );
-      getGeomEngine()->RemoveObject(myInPlaceObj);
+        getGeomEngine()->RemoveObject(myInPlaceObj);
+      }
     }
     // publish InPlaceObj to enable localSelection(InPlaceObj)
-    if ( !theObj->_is_nil() ) {
+    if ( !theObj->_is_nil() && subSelectionWay() == GET_IN_PLACE ) {
       SALOMEDS::Study_var aStudyDS = GeometryGUI::ClientStudyToStudy(getStudy()->studyDS());
       SALOMEDS::SObject_var aSO =
         getGeomEngine()->AddInStudy(aStudyDS, theObj, tmpName, myMainObj);
@@ -423,7 +444,8 @@ void GroupGUI_GroupDlg::setInPlaceObj( GEOM::GEOM_Object_var theObj )
 //=================================================================================
 void GroupGUI_GroupDlg::SelectionIntoArgument()
 {
-  if (myPlaceCheckBox->isChecked() && myEditCurrentArgument == myShape2Name ) {
+//   if (myPlaceCheckBox->isChecked() && myEditCurrentArgument == myShape2Name )
+  if (subSelectionWay() != ALL_SUBSHAPES && myEditCurrentArgument == myShape2Name ) {
     onGetInPlace();
     return;
   }
@@ -475,7 +497,8 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
     bool subselected = aMapIndex.Extent();
 
     // convert inPlace indices to main indices
-    if ( subselected && myPlaceCheckBox->isChecked() )
+    //if ( subselected && myPlaceCheckBox->isChecked() )
+    if ( subselected && subSelectionWay() != ALL_SUBSHAPES )
     {
       TColStd_IndexedMapOfInteger aMapIndex2;
       
@@ -522,7 +545,9 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
            CORBA::Long anIndex;
            anIndex = aLocOp->GetSubShapeIndex( myMainObj, aSubObjects[i] );
             if ( anIndex >= 0 ) {
-              if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex ))
+              //if ( myPlaceCheckBox->isChecked() && ! myMain2InPlaceIndices.IsBound( anIndex ))
+              if ( subSelectionWay() != ALL_SUBSHAPES &&
+                   ! myMain2InPlaceIndices.IsBound( anIndex ))
                 continue;
               aMapIndex.Add( anIndex );
             }
@@ -530,10 +555,10 @@ void GroupGUI_GroupDlg::SelectionIntoArgument()
         }
       }
       if ( !myMainObj->_is_nil() /*&& mySelSubBtn->isChecked()*/)
-        if ( !myInPlaceObj->_is_nil() )
-          localSelection( myInPlaceObj, getShapeType() );
-        else
+        if ( subSelectionWay() == ALL_SUBSHAPES )
           localSelection( myMainObj, getShapeType() );
+        else if ( !myInPlaceObj->_is_nil() )
+          localSelection( myInPlaceObj, getShapeType() );
     }
 
     if (aMapIndex.Extent() >= 1) {
@@ -574,7 +599,8 @@ void GroupGUI_GroupDlg::selectAllSubShapes()
     return;
 
   GEOM::ListOfLong_var aSubShapes;
-  if ( !myPlaceCheckBox->isChecked() )
+//   if ( !myPlaceCheckBox->isChecked() )
+  if ( subSelectionWay() == ALL_SUBSHAPES )
   {
     myIdList->clear();
     GEOM::GEOM_IShapesOperations_var aShOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
@@ -737,6 +763,16 @@ int GroupGUI_GroupDlg::getConstructorId() const
   return GroupConstructors->id( GroupConstructors->selected() );
 }
 
+//=======================================================================
+//function : subSelectionWay
+//purpose  : 
+//=======================================================================
+
+int GroupGUI_GroupDlg::subSelectionWay() const
+{
+  return mySelectionWayGroup->id( mySelectionWayGroup->selected() );
+}
+
 //=================================================================================
 // function : getShapeType()
 // purpose  :
@@ -779,7 +815,8 @@ void GroupGUI_GroupDlg::activateSelection()
 
   // local selection
   if ( !myMainObj->_is_nil() && !myEditCurrentArgument/* && mySelSubBtn->isChecked()*/) {
-    if ( !myPlaceCheckBox->isChecked() )
+//     if ( !myPlaceCheckBox->isChecked() )
+    if ( subSelectionWay() == ALL_SUBSHAPES )
       localSelection( myMainObj, getShapeType() );
     else if ( !myInPlaceObj->_is_nil() )
       localSelection( myInPlaceObj, getShapeType() );
@@ -874,11 +911,15 @@ void GroupGUI_GroupDlg::updateState()
     hasSel =  myIdList->isSelected( ii );
   myRemBtn->setEnabled( hasSel );
   //mySelSubBtn->setEnabled( !CORBA::is_nil( myMainObj ) );
-  myPlaceCheckBox->setEnabled( !CORBA::is_nil( myMainObj ) );
+  //myPlaceCheckBox->setEnabled( !CORBA::is_nil( myMainObj ) );
+  mySelectionWayGroup->setEnabled( !CORBA::is_nil( myMainObj ) );
   mySelAllBtn->setEnabled( !CORBA::is_nil( myMainObj ) );
-  mySelBtn2->setEnabled( myPlaceCheckBox->isChecked() );
-  myShape2Name->setEnabled( myPlaceCheckBox->isChecked() );
-  if ( !myPlaceCheckBox->isChecked() )
+//   mySelBtn2->setEnabled( myPlaceCheckBox->isChecked() );
+//   myShape2Name->setEnabled( myPlaceCheckBox->isChecked() );
+  mySelBtn2->setEnabled(    subSelectionWay() != ALL_SUBSHAPES );
+  myShape2Name->setEnabled( subSelectionWay() != ALL_SUBSHAPES );
+//   if ( !myPlaceCheckBox->isChecked() )
+  if ( subSelectionWay() == ALL_SUBSHAPES )
     setInPlaceObj( GEOM::GEOM_Object::_nil() );
 }
 
@@ -921,7 +962,8 @@ void GroupGUI_GroupDlg::highlightSubShapes()
   for ( ; ii < nn; ii++ )
     if ( myIdList->isSelected( ii ) ) {
       int id = myIdList->item( ii )->text().toInt();
-      if ( myPlaceCheckBox->isChecked() )
+//       if ( myPlaceCheckBox->isChecked() )
+      if ( subSelectionWay() != ALL_SUBSHAPES )
       {
         if (myMain2InPlaceIndices.IsBound( id ))
           id = myMain2InPlaceIndices( id );
index 08f2138232a31c438e154153811d574664ebf1b2..312048d8cbcec9551b29fa5552bf812ab5d5e716 100644 (file)
@@ -37,7 +37,8 @@ class QGroupBox;
 class QLineEdit;
 class QListBox;
 
-class QRadioButton;
+//class QRadioButton;
+class QButtonGroup;
 
 //=================================================================================
 // class    : GroupGUI_GroupDlg
@@ -83,6 +84,7 @@ private:
     void                                Init();
     void                                enterEvent( QEvent* e );
     int                                 getConstructorId() const;    
+    int                                 subSelectionWay() const;    
     TopAbs_ShapeEnum                    getShapeType() const;
     void                                setShapeType( const TopAbs_ShapeEnum );
     void                                activateSelection();
@@ -103,8 +105,9 @@ private:
   QLineEdit*                      myMainName;
   QPushButton*                    mySelBtn2;
   QLineEdit*                      myShape2Name;
-  QRadioButton*                   mySelSubBtn;
-  QCheckBox*                      myPlaceCheckBox;
+  QButtonGroup*                   mySelectionWayGroup;
+  //QRadioButton*                   mySelSubBtn;
+  //QCheckBox*                      myPlaceCheckBox;
   QPushButton*                    mySelAllBtn;
   QPushButton*                    myAddBtn;
   QPushButton*                    myRemBtn;