Salome HOME
IPAL52916: TC7.7.0:Triangle in "Threshold value" is missing after applying filter...
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FilterDlg.cxx
index c2f4bd6e2fa145b34f1aa53bb15398e5f9f66431..97f1df847d47671462c6830e5880de2cc680197a 100755 (executable)
@@ -1012,6 +1012,7 @@ void SMESHGUI_FilterTable::Init (const QList<int>& theTypes)
         Table* aTable = createTable(mySwitchTableGrp, *typeIt);
         myTables[ *typeIt ] = aTable;
         ((QVBoxLayout*)mySwitchTableGrp->layout())->addWidget(myTables[ *typeIt ]);
+        myEntityType = -1;
       }
     }
   }
@@ -1559,19 +1560,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 +1741,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 +2892,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 +2931,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 +3018,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  :
@@ -3323,7 +3364,7 @@ bool SMESHGUI_FilterDlg::onApply()
     insertFilterInViewer();
 
     if (!myFilter[ aCurrType ]->GetPredicate()->_is_nil()) {
-      // 
+      //
       bool toFilter = (( SMESH::FindActorByObject( myMesh )) ||
                        ( myInitSourceWgOnApply && mySourceWg ) ||
                        ( mySourceGrp->checkedId() == Dialog && mySourceWg ));
@@ -3332,6 +3373,9 @@ bool SMESHGUI_FilterDlg::onApply()
         filterSource(aCurrType, aResultIds);
         // select in viewer
         selectInViewer(aCurrType, aResultIds);
+        // set ids to the dialog
+        if ( myInitSourceWgOnApply || mySourceGrp->checkedId() == Dialog )
+          setIdsToWg(mySourceWg, aResultIds);
       }
     }
 
@@ -3507,9 +3551,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);
 }
 
 //=======================================================================