From b997c40f598ab557a58502d4609fa64559baa9f0 Mon Sep 17 00:00:00 2001 From: vsr Date: Tue, 7 May 2019 16:17:43 +0300 Subject: [PATCH] Issue #16922 [CEA 16749] SALOME_MODULES_ORDER not set in SALOME 9.3.0 Windows archive - Put SHAPER always to first place --- src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx index 62a2ea30d..579bf2348 100644 --- a/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx +++ b/src/SALOMEDSImpl/SALOMEDSImpl_Study.cxx @@ -2075,19 +2075,24 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath, } std::vector aSeq; - std::string aCompType, aFactoryType; + std::string aFactoryType; //Build a list of all components in the Study SALOMEDSImpl_SComponentIterator itcomponent = NewComponentIterator(); - for (; itcomponent.More(); itcomponent.Next()) { - SALOMEDSImpl_SComponent sco = itcomponent.Value(); - aCompType = sco.ComponentDataType(); - if (aCompType == "GEOM") - aSeq.insert(aSeq.begin(), aCompType); - else - aSeq.push_back(aCompType); + for (; itcomponent.More(); itcomponent.Next()) + aSeq.push_back(itcomponent.Value().ComponentDataType()); + + std::vector::iterator it; + if ( (it = std::find( aSeq.begin(), aSeq.end(), "GEOM" )) != aSeq.end() ) { + aSeq.erase( it ); + aSeq.insert(aSeq.begin(), "GEOM" ); + } + if ( (it = std::find( aSeq.begin(), aSeq.end(), "SHAPER" )) != aSeq.end() ) { + aSeq.erase( it ); + aSeq.insert(aSeq.begin(), "SHAPER" ); } + // re-arrange modules in the sequence, if specific order is given via SALOME_MODULES_ORDER environment variable. if ( getenv("SALOME_MODULES_ORDER") != 0 ) { std::string order = getenv("SALOME_MODULES_ORDER"); @@ -2180,7 +2185,7 @@ bool SALOMEDSImpl_Study::DumpStudy(const std::string& thePath, int aLength = aSeq.size(); for(int i = 1; i <= aLength; i++) { - aCompType = aSeq[i-1]; + std::string aCompType = aSeq[i-1]; SALOMEDSImpl_SComponent sco = FindComponent(aCompType); SALOMEDSImpl_Driver* aDriver = NULL; // if there is an associated Engine call its method for saving -- 2.39.2