Implementation of the issue 21276: EDF 1857 SMESH: Order of algorithms in the combobox

This commit is contained in:
rnv 2011-09-22 11:56:53 +00:00
parent 4a818e20d5
commit 92675bafdf
4 changed files with 29 additions and 14 deletions

View File

@ -29,12 +29,13 @@ def set_env(args):
python_version="python%d.%d" % sys.version_info[0:2] python_version="python%d.%d" % sys.version_info[0:2]
os.environ["SMESH_MeshersList"]="StdMeshers"
if not os.environ.has_key("SALOME_StdMeshersResources"): if not os.environ.has_key("SALOME_StdMeshersResources"):
os.environ["SALOME_StdMeshersResources"] \ os.environ["SALOME_StdMeshersResources"] \
= os.environ["SMESH_ROOT_DIR"]+"/share/"+salome_subdir+"/resources/smesh" = os.environ["SMESH_ROOT_DIR"]+"/share/"+salome_subdir+"/resources/smesh"
pass pass
if args.has_key("SMESH_plugins"): if args.has_key("SMESH_plugins"):
plugin_list = []
for plugin in args["SMESH_plugins"]: for plugin in args["SMESH_plugins"]:
plugin_root = "" plugin_root = ""
if os.environ.has_key(plugin+"_ROOT_DIR"): if os.environ.has_key(plugin+"_ROOT_DIR"):
@ -46,8 +47,7 @@ def set_env(args):
pass pass
pass pass
if plugin_root != "": if plugin_root != "":
os.environ["SMESH_MeshersList"] \ plugin_list.append(plugin)
= os.environ["SMESH_MeshersList"]+":"+plugin
if not os.environ.has_key("SALOME_"+plugin+"Resources"): if not os.environ.has_key("SALOME_"+plugin+"Resources"):
os.environ["SALOME_"+plugin+"Resources"] \ os.environ["SALOME_"+plugin+"Resources"] \
= plugin_root+"/share/"+salome_subdir+"/resources/"+plugin.lower() = plugin_root+"/share/"+salome_subdir+"/resources/"+plugin.lower()
@ -65,3 +65,5 @@ def set_env(args):
pass pass
pass pass
pass pass
plugin_list.append("StdMeshers")
os.environ["SMESH_MeshersList"] = ":".join(plugin_list)

View File

@ -53,6 +53,7 @@
#include <QDir> #include <QDir>
//#include <QList> //#include <QList>
// Other includes // Other includes
#ifdef WNT #ifdef WNT
#include <windows.h> #include <windows.h>
@ -80,7 +81,7 @@ static int MYDEBUG = 0;
namespace SMESH namespace SMESH
{ {
typedef QMap<QString,HypothesisData*> THypothesisDataMap; typedef IMap<QString,HypothesisData*> THypothesisDataMap;
THypothesisDataMap myHypothesesMap; THypothesisDataMap myHypothesesMap;
THypothesisDataMap myAlgorithmsMap; THypothesisDataMap myAlgorithmsMap;
@ -217,8 +218,17 @@ namespace SMESH
bool ok = reader.parse(source); bool ok = reader.parse(source);
file.close(); file.close();
if (ok) { 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<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin(); QList<HypothesesSet*>::iterator it, pos = myListOfHypothesesSets.begin();
for ( it = aXmlHandler->myListOfHypothesesSets.begin(); for ( it = aXmlHandler->myListOfHypothesesSets.begin();
it != aXmlHandler->myListOfHypothesesSets.end(); it != aXmlHandler->myListOfHypothesesSets.end();
@ -269,7 +279,7 @@ namespace SMESH
bool checkGeometry = ( !isNeedGeometry && isAlgo ); bool checkGeometry = ( !isNeedGeometry && isAlgo );
// fill list of hypotheses/algorithms // fill list of hypotheses/algorithms
THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap; THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
THypothesisDataMap::iterator anIter; 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 ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) { if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux) {
@ -336,10 +346,10 @@ namespace SMESH
// Init list of available hypotheses, if needed // Init list of available hypotheses, if needed
InitAvailableHypotheses(); InitAvailableHypotheses();
if (myHypothesesMap.find(aHypType) != myHypothesesMap.end()) { if (myHypothesesMap.contains(aHypType)) {
aHypData = myHypothesesMap[aHypType]; aHypData = myHypothesesMap[aHypType];
} }
else if (myAlgorithmsMap.find(aHypType) != myAlgorithmsMap.end()) { else if (myAlgorithmsMap.contains(aHypType)) {
aHypData = myAlgorithmsMap[aHypType]; aHypData = myAlgorithmsMap[aHypType];
} }
return aHypData; return aHypData;

View File

@ -165,11 +165,11 @@ bool SMESHGUI_XmlHandler::startElement (const QString&, const QString&,
if (qName == "algorithm") if (qName == "algorithm")
{ {
myAlgorithmsMap[aHypAlType] = aHypData; myAlgorithmsMap.insert(aHypAlType,aHypData);
} }
else else
{ {
myHypothesesMap[aHypAlType] = aHypData; myHypothesesMap.insert(aHypAlType,aHypData);
} }
} }
} }

View File

@ -35,6 +35,9 @@
#include <QMap> #include <QMap>
#include <QList> #include <QList>
//GUI includes
#include <QtxMap.h>
class HypothesisData; class HypothesisData;
class HypothesesSet; class HypothesesSet;
@ -55,8 +58,8 @@ public:
bool fatalError( const QXmlParseException& ); bool fatalError( const QXmlParseException& );
public: public:
QMap<QString, HypothesisData*> myHypothesesMap; IMap<QString, HypothesisData*> myHypothesesMap;
QMap<QString, HypothesisData*> myAlgorithmsMap; IMap<QString, HypothesisData*> myAlgorithmsMap;
QList<HypothesesSet*> myListOfHypothesesSets; QList<HypothesesSet*> myListOfHypothesesSets;