Salome HOME
INT PAL 0052873: IDs are not updated
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FilterDlg.cxx
index c1b80e0d0c439c753f010e64f849f781f381d688..76f50ada4af8fe02c24d93084e3cb862297ba097 100755 (executable)
@@ -1559,19 +1559,29 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
 
   ComboItem* anItem = ((ComboItem*)aTable->item(aRow, 0));
   int aCriterion = GetCriterionType(aRow);
-  bool toEnable = ((((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo &&
-                   aCriterion != SMESH::FT_RangeOfIds &&
-                   aCriterion != SMESH::FT_FreeEdges &&
-                   aCriterion != SMESH::FT_FreeFaces &&
-                   aCriterion != SMESH::FT_BadOrientedVolume &&
-                   aCriterion != SMESH::FT_BareBorderFace &&
-                   aCriterion != SMESH::FT_BareBorderVolume &&
-                   aCriterion != SMESH::FT_OverConstrainedFace &&
-                   aCriterion != SMESH::FT_OverConstrainedVolume)
-                   ||
-                   aCriterion == SMESH::FT_CoplanarFaces ||
+  bool isDbl = ( aCriterion == SMESH::FT_AspectRatio        ||
+                 aCriterion == SMESH::FT_AspectRatio3D      ||
+                 aCriterion == SMESH::FT_Warping            ||
+                 aCriterion == SMESH::FT_MinimumAngle       ||
+                 aCriterion == SMESH::FT_Taper              ||
+                 aCriterion == SMESH::FT_Skew               ||
+                 aCriterion == SMESH::FT_Area               ||
+                 aCriterion == SMESH::FT_Volume3D           ||
+                 aCriterion == SMESH::FT_MaxElementLength2D ||
+                 aCriterion == SMESH::FT_MaxElementLength3D ||
+                 aCriterion == SMESH::FT_Length             ||
+                 aCriterion == SMESH::FT_Length2D           ||
+                 aCriterion == SMESH::FT_BallDiameter );
+
+  bool toEnable = (( isDbl && ((ComboItem*)aTable->item(aRow, 1))->value() == SMESH::FT_EqualTo) ||
+                   aCriterion == SMESH::FT_BelongToPlane                                         ||
+                   aCriterion == SMESH::FT_BelongToCylinder                                      ||
+                   aCriterion == SMESH::FT_BelongToGenSurface                                    ||
+                   aCriterion == SMESH::FT_BelongToGeom                                          ||
+                   aCriterion == SMESH::FT_LyingOnGeom                                           ||
+                   aCriterion == SMESH::FT_CoplanarFaces                                         ||
                    aCriterion == SMESH::FT_EqualNodes);
-  
+
   if (!myAddWidgets.contains(anItem))
   {
     myAddWidgets[ anItem ] = new AdditionalWidget(myWgStack);
@@ -1730,7 +1740,7 @@ static QList<int> entityTypes( const int theType )
     typeIds.append( SMDSEntity_Quad_Quadrangle );
     typeIds.append( SMDSEntity_BiQuad_Quadrangle );
     typeIds.append( SMDSEntity_Polygon );
-    //typeIds.append( SMDSEntity_Quad_Polygon );
+    typeIds.append( SMDSEntity_Quad_Polygon );
     break;
   case SMESH::VOLUME:
     typeIds.append( SMDSEntity_Tetra );
@@ -2881,6 +2891,11 @@ void SMESHGUI_FilterDlg::Init (const int type, const bool setInViewer)
 //=======================================================================
 void SMESHGUI_FilterDlg::Init (const QList<int>& theTypes, const bool setInViewer)
 {
+  if ( theTypes.empty() )
+  {
+    Init( SMESH::ALL, setInViewer );
+    return;
+  }
   mySourceWg  = 0;
   myTypes     = theTypes;
   myMesh      = SMESH::SMESH_Mesh::_nil();
@@ -2915,6 +2930,8 @@ void SMESHGUI_FilterDlg::Init (const QList<int>& theTypes, const bool setInViewe
 
   connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate()));
   connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject()));
+  connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), SLOT(onOpenView()));
+  connect(mySMESHGUI, SIGNAL(SignalCloseView()), SLOT(onCloseView()));
   
   updateMainButtons();
   updateSelection();
@@ -3000,6 +3017,29 @@ void SMESHGUI_FilterDlg::reject()
   QDialog::reject();
 }
 
+//=================================================================================
+// function : onOpenView()
+// purpose  :
+//=================================================================================
+void SMESHGUI_FilterDlg::onOpenView()
+{
+  if ( mySelector ) {
+    SMESH::SetPointRepresentation(false);
+  }
+  else {
+    mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector();
+  }
+}
+
+//=================================================================================
+// function : onCloseView()
+// purpose  :
+//=================================================================================
+void SMESHGUI_FilterDlg::onCloseView()
+{
+  mySelector = 0;
+}
+
 //=================================================================================
 // function : onHelp()
 // purpose  :
@@ -3507,9 +3547,6 @@ void SMESHGUI_FilterDlg::filterSource (const int theType,
       if (aPred->IsSatisfy(*anIter))
         theResIds.append(*anIter);
   }
-  // set ids to the dialog
-  if (myInitSourceWgOnApply || aSourceId == Dialog)
-    setIdsToWg(mySourceWg, theResIds);
 }
 
 //=======================================================================
@@ -3638,6 +3675,10 @@ void SMESHGUI_FilterDlg::selectInViewer (const int theType, const QList<int>& th
   // insert previously stored filter in viewer if necessary
   if (!aFilter.IsNull())
     SMESH::SetFilter(aFilter);
+
+  // set ids to the dialog
+  if (myInitSourceWgOnApply || mySourceGrp->checkedId() == Dialog)
+    setIdsToWg(mySourceWg, theIds);
 }
 
 //=======================================================================
@@ -3718,7 +3759,7 @@ void SMESHGUI_FilterDlg::onSelectionDone()
       }
       break;
     }
-  case SMESH::FT_BelongToMeshGroup: // get a group name and IOR
+  case SMESH::FT_BelongToMeshGroup: // get a group Name and Entry
     {
       SMESH::SMESH_GroupBase_var grp = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(anIO);
       if ( !grp->_is_nil() )
@@ -3732,13 +3773,8 @@ void SMESHGUI_FilterDlg::onSelectionDone()
         if ( !myGroup->_is_nil() && myGroup->IsInDependency( grp ))
           return; // avoid cyclic dependencies between Groups on Filter
 
-        SalomeApp_Application* app = dynamic_cast<SalomeApp_Application*>
-          ( SUIT_Session::session()->activeApplication() );
-        if( !app ) return;
-        CORBA::String_var IOR = app->orb()->object_to_string( grp );
-
         myTable->SetThreshold(aRow, SMESH::toQStr( grp->GetName() ));
-        myTable->SetID       (aRow, IOR.in() );
+        myTable->SetID       (aRow, anIO->getEntry() );
       }
     }
   default: // get a GEOM object
@@ -3747,7 +3783,7 @@ void SMESHGUI_FilterDlg::onSelectionDone()
       if (!anObj->_is_nil())
       {
         myTable->SetThreshold(aRow, GEOMBase::GetName(anObj));
-        myTable->SetID(aRow, anIO->getEntry());
+        myTable->SetID       (aRow, anIO->getEntry());
       }
     }
   }