Salome HOME
fix indentation
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_HypothesesUtils.cxx
index 8dd81441a6b23d4e1aac0fd3016263970f530946..58003954a6ff4cf0d17aa303fed10166e9a85bbe 100644 (file)
 
 
 // Other includes
-#ifdef WNT
+#ifdef WIN32
 #include <windows.h>
 #else
 #include <dlfcn.h>
 #endif
 
-#ifdef WNT
+#ifdef WIN32
 #define LibHandle HMODULE
 #define LoadLib( name ) LoadLibrary( name )
 #define GetProc GetProcAddress
@@ -224,18 +224,17 @@ namespace SMESH
             for( ;it1 != aXmlHandler->myHypothesesMap.end(); it1++)
               myHypothesesMap.insert( it1.key(), it1.value() );
             
-            
             it1 = aXmlHandler->myAlgorithmsMap.begin();
             for( ;it1 != aXmlHandler->myAlgorithmsMap.end(); it1++)
               myAlgorithmsMap.insert( it1.key(), it1.value() );
             
-            QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
+            QList<HypothesesSet*>::iterator it;
             for ( it = aXmlHandler->myListOfHypothesesSets.begin(); 
                   it != aXmlHandler->myListOfHypothesesSets.end();
                   ++it )
             {
               (*it)->setIsCustom( i == 0 );
-              myListOfHypothesesSets.insert( pos, *it );
+              myListOfHypothesesSets.append( *it );
             }
           }
           else {
@@ -297,25 +296,47 @@ namespace SMESH
   }
 
 
-  QStringList GetHypothesesSets(int maxDim)
+  QStringList GetHypothesesSets(int maxDim, const QString& MeshType)
   {
     QStringList aSetNameList;
 
     // Init list of available hypotheses, if needed
     InitAvailableHypotheses();
-
     QList<HypothesesSet*>::iterator hypoSet;
-    for ( hypoSet  = myListOfHypothesesSets.begin(); 
+    for ( hypoSet  = myListOfHypothesesSets.begin();
           hypoSet != myListOfHypothesesSets.end();
           ++hypoSet ) {
       HypothesesSet* aSet = *hypoSet;
-      if ( aSet &&
-           ( aSet->count( true ) || aSet->count( false )) &&
-           aSet->maxDim() <= maxDim)
+      bool isAvailable = false;
+      if ( !MeshType.isEmpty() )
+      {
+        if ( aSet->maxDim() != maxDim)
+          continue;
+        aSet->init( true );
+        while ( aSet->next(), aSet->more() )
+        {
+          if ( HypothesisData* hypData = SMESH::GetHypothesisData( aSet->current() ) )
+          {
+            QStringList::const_iterator inElemType = hypData->OutputTypes.begin();
+            for ( ; inElemType != hypData->OutputTypes.end(); inElemType++ )
+            {
+              if ( *inElemType == MeshType ){
+                isAvailable = true;
+                break;
+              }
+            }
+          }
+          if ( isAvailable ) break;
+        }
+      }
+      else if ( aSet && ( aSet->count( true ) || aSet->count( false )) &&
+                aSet->maxDim() <= maxDim)
       {
-        aSetNameList.append( mangledHypoSetName( aSet ));
+        isAvailable = true;
       }
+      if ( isAvailable ) aSetNameList.append( mangledHypoSetName( aSet ));
     }
+    aSetNameList.removeDuplicates();
     aSetNameList.sort();
 
     //  reverse order of aSetNameList