Salome HOME
22364: EDF SMESH: Create Mesh dialog box improvement: hide inapplicable algorithms...
authoreap <eap@opencascade.com>
Wed, 26 Feb 2014 09:50:42 +0000 (13:50 +0400)
committereap <eap@opencascade.com>
Wed, 26 Feb 2014 09:50:42 +0000 (13:50 +0400)
Improve code readability

src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx
src/SMESHGUI/SMESHGUI_MeshOp.cxx

index 9902e04a847eb0acc96c5cb64e0f699465f35c48..878163738503d7c11750c49d8a28003c3fb89311 100644 (file)
@@ -281,20 +281,16 @@ namespace SMESH
     // fill list of hypotheses/algorithms
     THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
     THypothesisDataMap::ConstIterator anIter;
     // fill list of hypotheses/algorithms
     THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
     THypothesisDataMap::ConstIterator anIter;
-    for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) {
+    for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ )
+    {
       HypothesisData* aData = anIter.value();
       HypothesisData* aData = anIter.value();
-      if(!aData || aData->Label.isEmpty()) continue;
-      if (( theDim < 0 || aData->Dim.contains( theDim )) &&
-          ( isAlgo || aData->IsAuxOrNeedHyp == isAux ) &&
-          ( aData->Context == "ANY" || aData->Context == context ))
+      if (( aData && !aData->Label.isEmpty() ) &&
+          ( theDim < 0              || aData->Dim.contains( theDim )) &&
+          ( isAlgo                  || aData->IsAuxOrNeedHyp == isAux ) &&
+          ( aData->Context == "ANY" || aData->Context == context ) &&
+          ( !checkGeometry          || aData->IsNeedGeometry == isNeedGeometry ))
       {
       {
-        if (checkGeometry) {
-          if (aData->IsNeedGeometry == isNeedGeometry)
-            aHypList.append(anIter.key());
-        }
-        else {
-          aHypList.append(anIter.key());
-        }
+        aHypList.append(anIter.key());
       }
     }
     return aHypList;
       }
     }
     return aHypList;
index b8b73db38494950beca98d8676fb13c3fa38e85e..6506d1e0ef64fb5f394f1bc13dfbbd4b75cff5ae 100644 (file)
@@ -1399,20 +1399,22 @@ void SMESHGUI_MeshOp::onAlgoSelected( const int theIndex,
 
   QStringList anAvailable;
 
 
   QStringList anAvailable;
 
-  // check that tab enable, if algorithm building needed algo is one less than dimension
-  if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() &&
-       ( aDim > SMESH::DIM_0D ) && !isAccessibleDim( aDim - 1 ) ){
-    myDlg->enableTab( aDim - 1 );
-  }
-  if ( (myDlg->currentMeshType() != MT_ANY) &&
-       (( !algoData && ( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 )) ||
-        ( algoData && myIsOnGeometry && algoData->InputTypes.isEmpty() &&
-          ( aDim > SMESH::DIM_0D ) && isAccessibleDim( aDim - 1 ) ) ) ){
-    for (int i = aDim - 1; i >= SMESH::DIM_0D; i--){
-      if ( isAccessibleDim( i ) ) {
-        myDlg->disableTab( i );
-        setCurrentHyp(i, Algo, -1);
-      }
+  // check that tab enabled of one less dimension
+  if ( aDim > SMESH::DIM_0D )
+  {
+    if ( isAccessibleDim( aDim - 1 ) )
+    {
+      if (( myDlg->currentMeshType() != MT_ANY ) &&
+          ( !algoData || ( myIsOnGeometry && algoData->InputTypes.isEmpty() )))
+        for (int i = aDim - 1; i >= SMESH::DIM_0D; i--)
+          if ( isAccessibleDim( i ) ) {
+            myDlg->disableTab( i );
+            setCurrentHyp(i, Algo, -1);
+          }
+    }
+    else if ( algoData && myIsOnGeometry && !algoData->InputTypes.isEmpty() )
+    {
+      myDlg->enableTab( aDim - 1 );
     }
   }
 
     }
   }