From 92675bafdfeba644959aaab1964d93e4a27d823f Mon Sep 17 00:00:00 2001 From: rnv Date: Thu, 22 Sep 2011 11:56:53 +0000 Subject: [PATCH] Implementation of the issue 21276: EDF 1857 SMESH: Order of algorithms in the combobox --- bin/smesh_setenv.py | 8 +++++--- src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx | 24 ++++++++++++++++------- src/SMESHGUI/SMESHGUI_XmlHandler.cxx | 4 ++-- src/SMESHGUI/SMESHGUI_XmlHandler.h | 7 +++++-- 4 files changed, 29 insertions(+), 14 deletions(-) diff --git a/bin/smesh_setenv.py b/bin/smesh_setenv.py index 18b1dcc50..c0b3f3dc8 100644 --- a/bin/smesh_setenv.py +++ b/bin/smesh_setenv.py @@ -29,12 +29,13 @@ def set_env(args): python_version="python%d.%d" % sys.version_info[0:2] - os.environ["SMESH_MeshersList"]="StdMeshers" + if not os.environ.has_key("SALOME_StdMeshersResources"): os.environ["SALOME_StdMeshersResources"] \ = os.environ["SMESH_ROOT_DIR"]+"/share/"+salome_subdir+"/resources/smesh" pass if args.has_key("SMESH_plugins"): + plugin_list = [] for plugin in args["SMESH_plugins"]: plugin_root = "" if os.environ.has_key(plugin+"_ROOT_DIR"): @@ -46,8 +47,7 @@ def set_env(args): pass pass if plugin_root != "": - os.environ["SMESH_MeshersList"] \ - = os.environ["SMESH_MeshersList"]+":"+plugin + plugin_list.append(plugin) if not os.environ.has_key("SALOME_"+plugin+"Resources"): os.environ["SALOME_"+plugin+"Resources"] \ = plugin_root+"/share/"+salome_subdir+"/resources/"+plugin.lower() @@ -65,3 +65,5 @@ def set_env(args): pass pass pass + plugin_list.append("StdMeshers") + os.environ["SMESH_MeshersList"] = ":".join(plugin_list) \ No newline at end of file diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 87cdf60eb..c1411fa2c 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -53,6 +53,7 @@ #include //#include + // Other includes #ifdef WNT #include @@ -80,10 +81,10 @@ static int MYDEBUG = 0; namespace SMESH { - typedef QMap THypothesisDataMap; + typedef IMap THypothesisDataMap; THypothesisDataMap myHypothesesMap; THypothesisDataMap myAlgorithmsMap; - + // BUG 0020378 //typedef QMap THypCreatorMap; //THypCreatorMap myHypCreatorMap; @@ -217,8 +218,17 @@ namespace SMESH bool ok = reader.parse(source); file.close(); if (ok) { - myHypothesesMap.unite( aXmlHandler->myHypothesesMap ); - myAlgorithmsMap.unite( aXmlHandler->myAlgorithmsMap ); + + THypothesisDataMap::ConstIterator it1 = aXmlHandler->myHypothesesMap.begin(); + + 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::iterator it, pos = myListOfHypothesesSets.begin(); for ( it = aXmlHandler->myListOfHypothesesSets.begin(); it != aXmlHandler->myListOfHypothesesSets.end(); @@ -269,7 +279,7 @@ namespace SMESH bool checkGeometry = ( !isNeedGeometry && isAlgo ); // fill list of hypotheses/algorithms THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap; - THypothesisDataMap::iterator anIter; + THypothesisDataMap::ConstIterator anIter; for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) { HypothesisData* aData = anIter.value(); if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) { @@ -336,10 +346,10 @@ namespace SMESH // Init list of available hypotheses, if needed InitAvailableHypotheses(); - if (myHypothesesMap.find(aHypType) != myHypothesesMap.end()) { + if (myHypothesesMap.contains(aHypType)) { aHypData = myHypothesesMap[aHypType]; } - else if (myAlgorithmsMap.find(aHypType) != myAlgorithmsMap.end()) { + else if (myAlgorithmsMap.contains(aHypType)) { aHypData = myAlgorithmsMap[aHypType]; } return aHypData; diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx index b4cff1e93..6c8481433 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.cxx +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.cxx @@ -165,11 +165,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&, if (qName == "algorithm") { - myAlgorithmsMap[aHypAlType] = aHypData; + myAlgorithmsMap.insert(aHypAlType,aHypData); } else { - myHypothesesMap[aHypAlType] = aHypData; + myHypothesesMap.insert(aHypAlType,aHypData); } } } diff --git a/src/SMESHGUI/SMESHGUI_XmlHandler.h b/src/SMESHGUI/SMESHGUI_XmlHandler.h index fce170460..8adc03d3d 100644 --- a/src/SMESHGUI/SMESHGUI_XmlHandler.h +++ b/src/SMESHGUI/SMESHGUI_XmlHandler.h @@ -35,6 +35,9 @@ #include #include +//GUI includes +#include + class HypothesisData; class HypothesesSet; @@ -55,8 +58,8 @@ public: bool fatalError( const QXmlParseException& ); public: - QMap myHypothesesMap; - QMap myAlgorithmsMap; + IMap myHypothesesMap; + IMap myAlgorithmsMap; QList myListOfHypothesesSets;