1 // Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License, or (at your option) any later version.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // SMESH SMESHGUI : GUI for SMESH component
24 // File : SMESHGUI_HypothesesUtils.cxx
25 // Author : Julia DOROVSKIKH, Open CASCADE S.A.S.
28 #include "SMESHGUI_HypothesesUtils.h"
31 #include "SMESHGUI_Hypotheses.h"
32 #include "SMESHGUI_XmlHandler.h"
33 #include "SMESHGUI_Utils.h"
34 #include "SMESHGUI_GEOMGenUtils.h"
36 // SALOME GUI includes
37 #include <SUIT_Desktop.h>
38 #include <SUIT_MessageBox.h>
39 #include <SUIT_OverrideCursor.h>
40 #include <SUIT_ResourceMgr.h>
42 #include <SalomeApp_Study.h>
43 #include <SalomeApp_Tools.h>
45 // SALOME KERNEL includes
46 #include <utilities.h>
65 #define LibHandle HMODULE
66 #define LoadLib( name ) LoadLibrary( name )
67 #define GetProc GetProcAddress
68 #define UnLoadLib( handle ) FreeLibrary( handle );
70 #define LibHandle void*
71 #define LoadLib( name ) dlopen( name, RTLD_LAZY )
73 #define UnLoadLib( handle ) dlclose( handle );
77 static int MYDEBUG = 1;
79 static int MYDEBUG = 0;
84 typedef IMap<QString,HypothesisData*> THypothesisDataMap;
85 THypothesisDataMap myHypothesesMap;
86 THypothesisDataMap myAlgorithmsMap;
89 //typedef QMap<QString,SMESHGUI_GenericHypothesisCreator*> THypCreatorMap;
90 //THypCreatorMap myHypCreatorMap;
92 QList<HypothesesSet*> myListOfHypothesesSets;
94 void processHypothesisStatus(const int theHypStatus,
95 SMESH::SMESH_Hypothesis_ptr theHyp,
96 const bool theIsAddition)
98 if (theHypStatus > SMESH::HYP_OK) {
100 QString aHypName ("NULL Hypothesis");
101 if (!CORBA::is_nil(theHyp)) {
102 _PTR(SObject) Shyp = SMESH::FindSObject(theHyp);
105 aHypName = Shyp->GetName().c_str();
108 aHypName = GetHypothesisData(theHyp->GetName())->Label;
112 bool isFatal = (theHypStatus >= SMESH::HYP_UNKNOWN_FATAL);
115 aMsg = (isFatal ? "SMESH_CANT_ADD_HYP" : "SMESH_ADD_HYP_WRN");
117 aMsg = (isFatal ? "SMESH_CANT_RM_HYP" : "SMESH_RM_HYP_WRN");
119 aMsg = QObject::tr(aMsg.toLatin1().data()).arg(aHypName) +
120 QObject::tr(QString("SMESH_HYP_%1").arg(theHypStatus).toLatin1().data());
122 if ( theHypStatus == SMESH::HYP_HIDDEN_ALGO ) // PAL18501
123 aMsg = aMsg.arg( GetHypothesisData(theHyp->GetName())->Dim[0] );
125 SUIT_MessageBox::warning(SMESHGUI::desktop(),
126 QObject::tr("SMESH_WRN_WARNING"),
131 //================================================================================
133 * \brief Prepends dimension and appends '[custom]' to the name of hypothesis set
135 //================================================================================
137 static QString mangledHypoSetName(HypothesesSet* hypSet)
139 QString name = hypSet->name();
142 int dim = hypSet->maxDim();
144 name = QString("%1D: %2").arg(dim).arg(name);
147 if ( hypSet->getIsCustom() )
148 name = QString("%1 [custom]").arg(name);
153 //================================================================================
155 * \brief Removes dimension and '[custom]' from the name of hypothesis set
157 //================================================================================
159 static QString demangledHypoSetName(QString name)
161 name.remove(QRegExp("[0-3]D: "));
162 name.remove(" [custom]");
166 void InitAvailableHypotheses()
168 SUIT_OverrideCursor wc;
169 if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) {
171 SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr();
174 // Find name of a resource XML file ("SMESH_Meshers.xml");
176 char* cenv = getenv("SMESH_MeshersList");
178 HypsXml.sprintf("%s", cenv);
180 QStringList HypsXmlList = HypsXml.split(":", QString::SkipEmptyParts);
181 if (HypsXmlList.count() == 0) {
182 SUIT_MessageBox::critical(SMESHGUI::desktop(),
183 QObject::tr("SMESH_WRN_WARNING"),
184 QObject::tr("MESHERS_FILE_NO_VARIABLE"));
187 // get full names of xml files from HypsXmlList
188 QStringList xmlFiles;
189 xmlFiles.append( QDir::home().filePath("CustomMeshers.xml")); // may be inexistent
190 for (int i = 0; i < HypsXmlList.count(); i++) {
191 QString HypsXml = HypsXmlList[ i ];
193 // Find full path to the resource XML file
194 QString xmlFile = resMgr->path("resources", "SMESH", HypsXml + ".xml");
195 if ( xmlFile.isEmpty() ) // try PLUGIN resources
196 xmlFile = resMgr->path("resources", HypsXml, HypsXml + ".xml");
197 if ( !xmlFile.isEmpty() )
198 xmlFiles.append( xmlFile );
202 QString aNoAccessFiles;
203 for (int i = 0; i < xmlFiles.count(); i++)
205 QString xmlFile = xmlFiles[ i ];
206 QFile file (xmlFile);
207 if (file.exists() && file.open(QIODevice::ReadOnly))
211 SMESHGUI_XmlHandler* aXmlHandler = new SMESHGUI_XmlHandler();
214 QXmlInputSource source (&file);
215 QXmlSimpleReader reader;
216 reader.setContentHandler(aXmlHandler);
217 reader.setErrorHandler(aXmlHandler);
218 bool ok = reader.parse(source);
222 THypothesisDataMap::ConstIterator it1 = aXmlHandler->myHypothesesMap.begin();
224 for( ;it1 != aXmlHandler->myHypothesesMap.end(); it1++)
225 myHypothesesMap.insert( it1.key(), it1.value() );
227 it1 = aXmlHandler->myAlgorithmsMap.begin();
228 for( ;it1 != aXmlHandler->myAlgorithmsMap.end(); it1++)
229 myAlgorithmsMap.insert( it1.key(), it1.value() );
231 QList<HypothesesSet*>::iterator it;
232 for ( it = aXmlHandler->myListOfHypothesesSets.begin();
233 it != aXmlHandler->myListOfHypothesesSets.end();
236 (*it)->setIsCustom( i == 0 );
237 myListOfHypothesesSets.append( *it );
241 SUIT_MessageBox::critical(SMESHGUI::desktop(),
242 QObject::tr("INF_PARSE_ERROR"),
243 QObject::tr(aXmlHandler->errorProtocol().toLatin1().data()));
247 else if ( i > 0 ) { // 1st is ~/CustomMeshers.xml
248 if (aNoAccessFiles.isEmpty())
249 aNoAccessFiles = xmlFile;
251 aNoAccessFiles += ", " + xmlFile;
253 } // end loop on xmlFiles
256 if (!aNoAccessFiles.isEmpty()) {
257 QString aMess = QObject::tr("MESHERS_FILE_CANT_OPEN") + " " + aNoAccessFiles + "\n";
258 aMess += QObject::tr("MESHERS_FILE_CHECK_VARIABLE");
260 SUIT_MessageBox::warning(SMESHGUI::desktop(),
261 QObject::tr("SMESH_WRN_WARNING"),
269 QStringList GetAvailableHypotheses( const bool isAlgo,
272 const bool isNeedGeometry,
273 const bool isSubMesh)
275 QStringList aHypList;
277 // Init list of available hypotheses, if needed
278 InitAvailableHypotheses();
279 bool checkGeometry = ( !isNeedGeometry && isAlgo );
280 const char* context = isSubMesh ? "LOCAL" : "GLOBAL";
281 // fill list of hypotheses/algorithms
282 THypothesisDataMap& pMap = isAlgo ? myAlgorithmsMap : myHypothesesMap;
283 THypothesisDataMap::ConstIterator anIter;
284 for ( anIter = pMap.begin(); anIter != pMap.end(); anIter++ ) {
285 HypothesisData* aData = anIter.value();
286 if(!aData || aData->Label.isEmpty()) continue;
287 if (( theDim < 0 || aData->Dim.contains( theDim )) &&
288 ( isAlgo || aData->IsAuxOrNeedHyp == isAux ) &&
289 ( aData->Context == "ANY" || aData->Context == context ))
292 if (aData->IsNeedGeometry == isNeedGeometry)
293 aHypList.append(anIter.key());
296 aHypList.append(anIter.key());
304 QStringList GetHypothesesSets(int maxDim)
306 QStringList aSetNameList;
308 // Init list of available hypotheses, if needed
309 InitAvailableHypotheses();
310 QList<HypothesesSet*>::iterator hypoSet;
311 for ( hypoSet = myListOfHypothesesSets.begin();
312 hypoSet != myListOfHypothesesSets.end();
314 HypothesesSet* aSet = *hypoSet;
315 if ( aSet && ( aSet->count( true ) || aSet->count( false )) &&
316 aSet->maxDim() <= maxDim)
318 aSetNameList.append( mangledHypoSetName( aSet ));
321 aSetNameList.removeDuplicates();
324 // reverse order of aSetNameList
325 QStringList reversedNames;
326 for ( int i = 0; i < aSetNameList.count(); ++i )
327 reversedNames.prepend( aSetNameList[i] );
329 return reversedNames;
332 HypothesesSet* GetHypothesesSet(const QString& theSetName)
334 QString name = demangledHypoSetName( theSetName );
335 QList<HypothesesSet*>::iterator hypoSet;
336 for ( hypoSet = myListOfHypothesesSets.begin();
337 hypoSet != myListOfHypothesesSets.end();
339 HypothesesSet* aSet = *hypoSet;
340 if ( aSet && aSet->name() == name )
346 HypothesisData* GetHypothesisData (const QString& aHypType)
348 HypothesisData* aHypData = 0;
350 // Init list of available hypotheses, if needed
351 InitAvailableHypotheses();
353 if (myHypothesesMap.contains(aHypType)) {
354 aHypData = myHypothesesMap[aHypType];
356 else if (myAlgorithmsMap.contains(aHypType)) {
357 aHypData = myAlgorithmsMap[aHypType];
362 bool IsAvailableHypothesis(const HypothesisData* algoData,
363 const QString& hypType,
369 if ( algoData->BasicHypos.contains( hypType ))
371 if ( algoData->OptionalHypos.contains( hypType)) {
378 bool IsCompatibleAlgorithm(const HypothesisData* algo1Data,
379 const HypothesisData* algo2Data)
381 if ( !algo1Data || !algo2Data )
383 const HypothesisData* algoIn = algo1Data, *algoMain = algo2Data;
384 if ( algoIn->Dim.first() > algoMain->Dim.first() ) {
385 algoIn = algo2Data; algoMain = algo1Data;
387 // look for any output type of algoIn between input types of algoMain
388 QStringList::const_iterator inElemType = algoIn->OutputTypes.begin();
389 for ( ; inElemType != algoIn->OutputTypes.end(); ++inElemType )
390 if ( algoMain->InputTypes.contains( *inElemType ))
395 SMESHGUI_GenericHypothesisCreator* GetHypothesisCreator(const QString& aHypType)
397 if(MYDEBUG) MESSAGE("Get HypothesisCreator for " << aHypType.toLatin1().data());
399 SMESHGUI_GenericHypothesisCreator* aCreator = 0;
401 // check, if creator for this hypothesis type already exists
403 //if (myHypCreatorMap.find(aHypType) != myHypCreatorMap.end()) {
404 // aCreator = myHypCreatorMap[aHypType];
408 // 1. Init list of available hypotheses, if needed
409 InitAvailableHypotheses();
411 // 2. Get names of plugin libraries
412 HypothesisData* aHypData = GetHypothesisData(aHypType);
416 QString aClientLibName = aHypData->ClientLibName;
417 QString aServerLibName = aHypData->ServerLibName;
419 // 3. Load Client Plugin Library
421 // load plugin library
422 if(MYDEBUG) MESSAGE("Loading client meshers plugin library ...");
423 LibHandle libHandle = LoadLib( aClientLibName.toLatin1().data() );
425 // report any error, if occured
428 const char* anError = "Can't load client meshers plugin library";
430 const char* anError = dlerror();
432 INFOS(anError); // always display this kind of error !
436 // get method, returning hypothesis creator
437 if(MYDEBUG) MESSAGE("Find GetHypothesisCreator() method ...");
438 typedef SMESHGUI_GenericHypothesisCreator* (*GetHypothesisCreator) \
440 GetHypothesisCreator procHandle =
441 (GetHypothesisCreator)GetProc(libHandle, "GetHypothesisCreator");
443 if(MYDEBUG) MESSAGE("bad hypothesis client plugin library");
444 UnLoadLib(libHandle);
447 // get hypothesis creator
448 if(MYDEBUG) MESSAGE("Get Hypothesis Creator for " << aHypType.toLatin1().data());
449 aCreator = procHandle( aHypType );
451 if(MYDEBUG) MESSAGE("no such a hypothesis in this plugin");
454 // map hypothesis creator to a hypothesis name
456 //myHypCreatorMap[aHypType] = aCreator;
458 //rnv : This dynamic property of the QObject stores the name of the plugin.
459 // It is used to obtain plugin root dir environment variable
460 // in the SMESHGUI_HypothesisDlg class. Plugin root dir environment
461 // variable is used to display documentation.
462 aCreator->setProperty(PLUGIN_NAME,aHypData->PluginName);
467 catch (const SALOME::SALOME_Exception& S_ex) {
468 SalomeApp_Tools::QtCatchCorbaException(S_ex);
476 SMESH::SMESH_Hypothesis_ptr CreateHypothesis(const QString& aHypType,
477 const QString& aHypName,
480 if(MYDEBUG) MESSAGE("Create " << aHypType.toLatin1().data() <<
481 " with name " << aHypName.toLatin1().data());
482 HypothesisData* aHypData = GetHypothesisData(aHypType);
483 QString aServLib = aHypData->ServerLibName;
485 SMESH::SMESH_Hypothesis_var aHypothesis;
486 aHypothesis = SMESHGUI::GetSMESHGen()->CreateHypothesis(aHypType.toLatin1().data(),
487 aServLib.toLatin1().data());
488 if (!aHypothesis->_is_nil()) {
489 _PTR(SObject) aHypSObject = SMESH::FindSObject(aHypothesis.in());
491 if (!aHypName.isEmpty())
492 SMESH::SetName(aHypSObject, aHypName);
493 SMESHGUI::Modified();
494 SMESHGUI::GetSMESHGUI()->updateObjBrowser();
495 return aHypothesis._retn();
498 } catch (const SALOME::SALOME_Exception & S_ex) {
499 SalomeApp_Tools::QtCatchCorbaException(S_ex);
502 return SMESH::SMESH_Hypothesis::_nil();
504 bool IsApplicable(const QString& aHypType,
505 GEOM::GEOM_Object_ptr theGeomObject,
506 const bool toCheckAll)
508 HypothesisData* aHypData = GetHypothesisData(aHypType);
509 QString aServLib = aHypData->ServerLibName;
510 return SMESHGUI::GetSMESHGen()->IsApplicable( aHypType.toLatin1().data(),
511 aServLib.toLatin1().data(),
517 bool AddHypothesisOnMesh (SMESH::SMESH_Mesh_ptr aMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
519 if(MYDEBUG) MESSAGE ("SMESHGUI::AddHypothesisOnMesh");
520 int res = SMESH::HYP_UNKNOWN_FATAL;
521 SUIT_OverrideCursor wc;
523 if (!aMesh->_is_nil()) {
524 _PTR(SObject) SM = SMESH::FindSObject(aMesh);
525 GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SM);
527 res = aMesh->AddHypothesis(aShapeObject, aHyp);
528 if (res < SMESH::HYP_UNKNOWN_FATAL) {
529 _PTR(SObject) aSH = SMESH::FindSObject(aHyp);
531 SMESH::ModifiedMesh(SM, false, aMesh->NbNodes()==0);
534 if (res > SMESH::HYP_OK) {
536 processHypothesisStatus(res, aHyp, true);
540 catch(const SALOME::SALOME_Exception& S_ex) {
542 SalomeApp_Tools::QtCatchCorbaException(S_ex);
543 res = SMESH::HYP_UNKNOWN_FATAL;
546 return res < SMESH::HYP_UNKNOWN_FATAL;
550 bool AddHypothesisOnSubMesh (SMESH::SMESH_subMesh_ptr aSubMesh, SMESH::SMESH_Hypothesis_ptr aHyp)
552 if(MYDEBUG) MESSAGE("SMESHGUI::AddHypothesisOnSubMesh() ");
553 int res = SMESH::HYP_UNKNOWN_FATAL;
554 SUIT_OverrideCursor wc;
556 if (!aSubMesh->_is_nil() && ! aHyp->_is_nil()) {
558 SMESH::SMESH_Mesh_var aMesh = aSubMesh->GetFather();
559 _PTR(SObject) SsubM = SMESH::FindSObject(aSubMesh);
560 GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(SsubM);
561 if (!aMesh->_is_nil() && SsubM && !aShapeObject->_is_nil()) {
562 res = aMesh->AddHypothesis(aShapeObject, aHyp);
563 if (res < SMESH::HYP_UNKNOWN_FATAL) {
564 _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
566 SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
568 if (res > SMESH::HYP_OK) {
570 processHypothesisStatus(res, aHyp, true);
575 SCRUTE(aHyp->_is_nil());
576 SCRUTE(aMesh->_is_nil());
578 SCRUTE(aShapeObject->_is_nil());
581 catch(const SALOME::SALOME_Exception& S_ex) {
583 SalomeApp_Tools::QtCatchCorbaException(S_ex);
584 res = SMESH::HYP_UNKNOWN_FATAL;
588 SCRUTE(aSubMesh->_is_nil());
589 SCRUTE(aHyp->_is_nil());
591 return res < SMESH::HYP_UNKNOWN_FATAL;
594 bool RemoveHypothesisOrAlgorithmOnMesh (const Handle(SALOME_InteractiveObject)& IObject)
596 int res = SMESH::HYP_UNKNOWN_FATAL;
597 SUIT_OverrideCursor wc;
600 _PTR(Study) aStudy = GetActiveStudyDocument();
601 _PTR(SObject) aHypObj = aStudy->FindObjectID( IObject->getEntry() );
604 _PTR(SObject) MorSM = SMESH::GetMeshOrSubmesh( aHypObj );
605 _PTR(SObject) aRealHypo;
606 if( aHypObj->ReferencedObject( aRealHypo ) )
608 SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aRealHypo ) );
609 RemoveHypothesisOrAlgorithmOnMesh( MorSM, hypo );
613 SMESH_Hypothesis_var hypo = SMESH_Hypothesis::_narrow( SObjectToObject( aHypObj ) );
614 SObjectList meshList = GetMeshesUsingAlgoOrHypothesis( hypo );
615 for( int i = 0; i < meshList.size(); i++ )
616 RemoveHypothesisOrAlgorithmOnMesh( meshList[ i ], hypo );
620 catch(const SALOME::SALOME_Exception& S_ex)
623 SalomeApp_Tools::QtCatchCorbaException(S_ex);
624 res = SMESH::HYP_UNKNOWN_FATAL;
626 return res < SMESH::HYP_UNKNOWN_FATAL;
629 bool RemoveHypothesisOrAlgorithmOnMesh (_PTR(SObject) MorSM,
630 SMESH::SMESH_Hypothesis_ptr anHyp)
632 int res = SMESH::HYP_UNKNOWN_FATAL;
633 SUIT_OverrideCursor wc;
637 GEOM::GEOM_Object_var aShapeObject = SMESH::GetShapeOnMeshOrSubMesh(MorSM);
638 SMESH::SMESH_Mesh_var aMesh = SMESH::SObjectToInterface<SMESH::SMESH_Mesh>(MorSM);
639 SMESH::SMESH_subMesh_var aSubMesh = SMESH::SObjectToInterface<SMESH::SMESH_subMesh>(MorSM);
641 if (!aSubMesh->_is_nil())
642 aMesh = aSubMesh->GetFather();
644 if (!aMesh->_is_nil()) {
645 if (aMesh->HasShapeToMesh() && !aShapeObject->_is_nil()) {
646 res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
647 if (res < SMESH::HYP_UNKNOWN_FATAL) {
648 _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
650 SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
654 else if(!aMesh->HasShapeToMesh()){
655 res = aMesh->RemoveHypothesis(aShapeObject, anHyp);
656 if (res < SMESH::HYP_UNKNOWN_FATAL) {
657 _PTR(SObject) meshSO = SMESH::FindSObject(aMesh);
659 SMESH::ModifiedMesh(meshSO, false, aMesh->NbNodes()==0);
662 if (res > SMESH::HYP_OK) {
664 processHypothesisStatus(res, anHyp, false);
668 } catch(const SALOME::SALOME_Exception& S_ex) {
670 SalomeApp_Tools::QtCatchCorbaException(S_ex);
671 res = SMESH::HYP_UNKNOWN_FATAL;
674 return res < SMESH::HYP_UNKNOWN_FATAL;
677 SObjectList GetMeshesUsingAlgoOrHypothesis(SMESH::SMESH_Hypothesis_ptr AlgoOrHyp)
679 SObjectList listSOmesh;
680 listSOmesh.resize(0);
682 unsigned int index = 0;
683 if (!AlgoOrHyp->_is_nil()) {
684 _PTR(SObject) SO_Hypothesis = SMESH::FindSObject(AlgoOrHyp);
687 SMESHGUI::activeStudy()->studyDS()->FindDependances(SO_Hypothesis);
689 if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency number ="<<listSO.size());
690 for (unsigned int i = 0; i < listSO.size(); i++) {
691 _PTR(SObject) SO = listSO[i];
693 _PTR(SObject) aFather = SO->GetFather();
695 _PTR(SObject) SOfatherFather = aFather->GetFather();
696 if (SOfatherFather) {
697 if(MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): dependency added to list");
699 listSOmesh.resize(index);
700 listSOmesh[index - 1] = SOfatherFather;
707 if (MYDEBUG) MESSAGE("SMESHGUI::GetMeshesUsingAlgoOrHypothesis(): completed");
711 #define CASE2MESSAGE(enum) case SMESH::enum: msg = QObject::tr( "STATE_" #enum ); break;
712 QString GetMessageOnAlgoStateErrors(const algo_error_array& errors)
714 QString resMsg; // PAL14861 = QObject::tr("SMESH_WRN_MISSING_PARAMETERS") + ":\n";
715 for ( int i = 0; i < errors.length(); ++i ) {
716 const SMESH::AlgoStateError & error = errors[ i ];
717 const bool hasAlgo = ( strlen( error.algoName ) != 0 );
720 msg = QObject::tr( "STATE_ALGO_MISSING" );
722 switch( error.state ) {
723 CASE2MESSAGE( HYP_MISSING );
724 CASE2MESSAGE( HYP_NOTCONFORM );
725 CASE2MESSAGE( HYP_BAD_PARAMETER );
726 CASE2MESSAGE( HYP_BAD_GEOMETRY );
729 // apply args to message:
732 msg = msg.arg( error.algoName.in() );
734 msg = msg.arg( error.algoDim );
736 msg = msg.arg( QObject::tr( error.isGlobalAlgo ? "GLOBAL_ALGO" : "LOCAL_ALGO" ));
737 // %4 - hypothesis dim == algoDim
738 msg = msg.arg( error.algoDim );
740 if ( i ) resMsg += ";\n";
745 } // end of namespace SMESH