Salome HOME
PAL8378: update script ex00_all.py to run also tests, which now do not fail
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_FilterDlg.cxx
index 7aeb763d3f6655cdd93c1f08f7159fe6168df0bf..62a04bb7424aad3b706bf6de6f0d12296dea87fd 100755 (executable)
 #include <qobjectlist.h>
 #include <qvalidator.h>
 
+// IDL Headers
+#include "SALOMEconfig.h"
+#include CORBA_SERVER_HEADER(SMESH_Group)
+
 #define SPACING 5                  
 #define MARGIN  10
 
@@ -654,7 +658,8 @@ bool SMESHGUI_FilterTable::IsValid( const bool theMess, const int theEntityType
     if ( aCriterion == FT_RangeOfIds ||
          aCriterion == FT_BelongToGeom ||
          aCriterion == FT_BelongToPlane ||
-         aCriterion == FT_BelongToCylinder )
+         aCriterion == FT_BelongToCylinder ||
+        aCriterion == FT_LyingOnGeom)
     {
       if ( aTable->text( i, 2 ).isEmpty() )
       {
@@ -768,7 +773,8 @@ void SMESHGUI_FilterTable::GetCriterion( const int                 theRow,
   if ( aCriterionType != FT_RangeOfIds &&
        aCriterionType != FT_BelongToGeom &&
        aCriterionType != FT_BelongToPlane &&
-       aCriterionType != FT_BelongToCylinder )
+       aCriterionType != FT_BelongToCylinder &&
+       aCriterionType != FT_LyingOnGeom)
   {
     theCriterion.Compare = ( (ComboItem*)aTable->item( theRow, 1 ) )->GetValue();
     theCriterion.Threshold = aTable->item( theRow, 2 )->text().toDouble();
@@ -813,7 +819,8 @@ void SMESHGUI_FilterTable::SetCriterion( const int                       theRow,
   if ( theCriterion.Type != FT_RangeOfIds &&
        theCriterion.Type != FT_BelongToGeom &&
        theCriterion.Type != FT_BelongToPlane &&
-       theCriterion.Type != FT_BelongToCylinder )
+       theCriterion.Type != FT_BelongToCylinder &&
+       theCriterion.Type != FT_LyingOnGeom)
     aTable->setText( theRow, 2, QString( "%1" ).arg( theCriterion.Threshold, 0, 'g', 15 ) );
   else
     aTable->setText( theRow, 2, QString( theCriterion.ThresholdStr ) );
@@ -902,7 +909,6 @@ void SMESHGUI_FilterTable::onAddBtn()
   int aType = GetType();
   addRow( myTables[ aType ], aType );
 
-  Table* aTable = myTables[ aType ];
   Update();
 }
 
@@ -965,8 +971,10 @@ void SMESHGUI_FilterTable::updateAdditionalWidget()
   ComboItem* anItem = ( (ComboItem*)aTable->item( aRow, 0 ) );
   bool toEnable = ( (ComboItem*)aTable->item( aRow, 1 ) )->GetValue() == FT_EqualTo &&
                   GetCriterionType( aRow ) != FT_BelongToGeom &&
+                  GetCriterionType( aRow ) != FT_LyingOnGeom &&
                   GetCriterionType( aRow ) != FT_RangeOfIds &&
-                  GetCriterionType( aRow ) != FT_FreeEdges;
+                  GetCriterionType( aRow ) != FT_FreeEdges && 
+                 GetCriterionType( aRow ) != FT_BadOrientedVolume;
   if ( !myAddWidgets.contains( anItem ) )
   {
     myAddWidgets[ anItem ] = new AdditionalWidget( myWgStack );
@@ -1038,7 +1046,8 @@ void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, con
   int aCriterionType = GetCriterionType( row );
 
   if ( aType == SMESH::EDGE && aCriterionType == SMESH::FT_FreeBorders ||
-       aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges )
+       aType == SMESH::FACE && aCriterionType == SMESH::FT_FreeEdges || 
+       aType == SMESH::VOLUME && aCriterionType == SMESH::FT_BadOrientedVolume )
   {
     if ( aCompareItem->count() > 0 )
       aCompareItem->setStringList( QStringList() );
@@ -1047,7 +1056,8 @@ void SMESHGUI_FilterTable::onCriterionChanged( const int row, const int col, con
   else if ( aCriterionType == SMESH::FT_RangeOfIds ||
             aCriterionType == SMESH::FT_BelongToGeom ||
             aCriterionType == SMESH::FT_BelongToPlane ||
-            aCriterionType == SMESH::FT_BelongToCylinder )
+            aCriterionType == SMESH::FT_BelongToCylinder ||
+           aCriterionType == SMESH::FT_LyingOnGeom)
   {
     QMap<int, QString> aMap;
     aMap[ FT_EqualTo ] = tr( "EQUAL_TO" );
@@ -1239,6 +1249,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
     }
     return aCriteria;
   }
@@ -1254,6 +1265,7 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
     }
     return aCriteria;
   }
@@ -1273,6 +1285,9 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
       aCriteria[ SMESH::FT_BelongToGeom     ] = tr( "BELONG_TO_GEOM" );
       aCriteria[ SMESH::FT_BelongToPlane    ] = tr( "BELONG_TO_PLANE" );
       aCriteria[ SMESH::FT_BelongToCylinder ] = tr( "BELONG_TO_CYLINDER" );
+      aCriteria[ SMESH::FT_LyingOnGeom      ] = tr( "LYING_ON_GEOM" );
+      aCriteria[ SMESH::FT_Length2D         ] = tr( "LENGTH2D" );
+      aCriteria[ SMESH::FT_MultiConnection2D] = tr( "MULTI2D_BORDERS" );
     }
     return aCriteria;
   }
@@ -1281,8 +1296,11 @@ const QMap<int, QString>& SMESHGUI_FilterTable::getCriteria( const int theType )
     static QMap<int, QString> aCriteria;
     if ( aCriteria.isEmpty() )
     {
+      aCriteria[ SMESH::FT_AspectRatio3D] = tr( "ASPECT_RATIO_3D" );
       aCriteria[ SMESH::FT_RangeOfIds   ] = tr( "RANGE_OF_IDS" );
       aCriteria[ SMESH::FT_BelongToGeom ] = tr( "BELONG_TO_GEOM" );
+      aCriteria[ SMESH::FT_LyingOnGeom ] = tr( "LYING_ON_GEOM" );
+      aCriteria[ SMESH::FT_BadOrientedVolume ] = tr( "BAD_ORIENTED_VOLUME" );
     }
     return aCriteria;
   }
@@ -1341,9 +1359,6 @@ SMESHGUI_FilterTable::Table* SMESHGUI_FilterTable::createTable( QWidget*  thePar
   static int aLenCr = abs(  aMaxLenCr -
                             aMetrics.width( tr( "CRITERION" ) ) ) / aMetrics.width( ' ' ) + 5;
 
-  static int aLenCo = abs(  maxLength( getCompare(), aMetrics ) -
-                            aMetrics.width( tr( "COMPARE" ) ) ) / aMetrics.width( ' ' ) + 5;
-
   QString aCrStr;
   aCrStr.fill( ' ', aLenCr );
   QString aCoStr;
@@ -1876,6 +1891,8 @@ void SMESHGUI_FilterDlg::onDeactivate()
 void SMESHGUI_FilterDlg::enterEvent( QEvent* )
 {
 //  mySMESHGUI->EmitSignalDeactivateDialog();
+  mySMESHGUI->SetActiveDialogBox( (QDialog*)this );
+  mySMESHGUI->ResetState();
   setEnabled( true );
 }
 
@@ -1999,7 +2016,8 @@ bool SMESHGUI_FilterDlg::isValid() const
     int aType = myTable->GetCriterionType( i );
     if ( aType == FT_BelongToGeom ||
          aType == FT_BelongToPlane ||
-         aType == FT_BelongToCylinder  )
+         aType == FT_BelongToCylinder ||
+        aType == FT_LyingOnGeom)
     {
       QString aName;
       myTable->GetThreshold( i, aName );
@@ -2312,7 +2330,7 @@ void SMESHGUI_FilterDlg::filterSelectionSource( const int theType,
 
       if ( aSelMap.Extent() > 0 )
       {
-        if(SMESH_Actor *anActor = SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
+        if( SMESH::FindActorByEntry( anIter.Key()->getEntry() ) )
         {
           for ( int i = 1; i <= aSelMap.Extent(); i++ )
             aToBeFiltered.Add( aSelMap(i) );
@@ -2418,13 +2436,14 @@ void SMESHGUI_FilterDlg::onSelectionDone()
         !myTable->CurrentCell( aRow, aCol ) ||
         myTable->GetCriterionType( aRow ) != FT_BelongToGeom &&
         myTable->GetCriterionType( aRow ) != FT_BelongToPlane &&
-        myTable->GetCriterionType( aRow ) != FT_BelongToCylinder)
+        myTable->GetCriterionType( aRow ) != FT_BelongToCylinder &&
+       myTable->GetCriterionType( aRow ) != FT_LyingOnGeom )
     return;
 
   Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject() ;
   GEOM::GEOM_Object_var anObj = SMESH::IObjectToInterface<GEOM::GEOM_Object>( anIO ) ;
   if ( !anObj->_is_nil() )
-    myTable->SetThreshold( aRow, anIO->getName() );
+    myTable->SetThreshold( aRow, GEOMBase::GetName(anObj) );
 }
 
 //=======================================================================
@@ -2461,9 +2480,10 @@ void SMESHGUI_FilterDlg::updateSelection()
   if ( myTable->CurrentCell( aRow, aCol ) &&
        ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||
          myTable->GetCriterionType( aRow ) == FT_BelongToPlane ||
-         myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ) )
+         myTable->GetCriterionType( aRow ) == FT_BelongToCylinder ||
+        myTable->GetCriterionType( aRow ) == FT_LyingOnGeom) )
   {
-    if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom )
+    if ( myTable->GetCriterionType( aRow ) == FT_BelongToGeom ||  myTable->GetCriterionType( aRow ) == FT_LyingOnGeom )
       mySelection->AddFilter( new SALOME_TypeFilter( "GEOM" ) );
     else if ( myTable->GetCriterionType( aRow ) == FT_BelongToPlane )
       mySelection->AddFilter( new GEOM_FaceFilter( StdSelect_Plane ) );