X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_HypothesesUtils.cxx;h=71b8125667e593efec3c64ffebb7b0ac51bd6c9d;hp=fc1f8c5e2b84acaffaf20d423ed597131efadbb3;hb=dd0d39d752a4d5ba58ed2e417651093764bb8d09;hpb=d498ff64b27604a9941f629eec4499ca92541880 diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index fc1f8c5e2..71b812566 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -49,9 +49,7 @@ #include // Qt includes -#include #include -//#include // Other includes @@ -180,7 +178,8 @@ namespace SMESH void InitAvailableHypotheses() { SUIT_OverrideCursor wc; - if (myHypothesesMap.empty() && myAlgorithmsMap.empty()) { + if ( myHypothesesMap.empty() && myAlgorithmsMap.empty() ) + { // Resource manager SUIT_ResourceMgr* resMgr = SMESHGUI::resourceMgr(); if (!resMgr) return; @@ -369,6 +368,90 @@ namespace SMESH return aHypData; } + //================================================================================ + /*! + * \brief Return the HypothesisData holding a name of a group of hypotheses + * a given hypothesis belongs to + */ + //================================================================================ + + HypothesisData* GetGroupTitle( const HypothesisData* hyp, const bool isAlgo ) + { + static std::vector< std::vector< HypothesisData > > theGroups; + if ( theGroups.empty() ) + { + theGroups.resize(14); // 14: isAlgo * 10 + dim + + QString dummyS("GROUP"); + QList dummyIL; dummyIL << 1; + QStringList dummySL; + HypothesisData group( dummyS,dummyS,dummyS,dummyS,dummyS,dummyS,dummyS,-1,-1, + dummyIL, 0, dummySL,dummySL,dummySL,dummySL ); + // no group + int key = 0; + theGroups[ key ].push_back( group ); + + // 1D algo + key = 11; + // 0: Basic + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_ALGO_GROUP_BASIC" ); + theGroups[ key ].push_back( group ); + // 1: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_ALGO_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + + // 1D hypotheses + key = 01; + // 0: Basic + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_HYP_GROUP_BASIC" ); + theGroups[ key ].push_back( group ); + // 1: Progression + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_HYP_GROUP_PROGRESSION" ); + theGroups[ key ].push_back( group ); + // 2: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_1D_HYP_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + + // 2D algo + key = 12; + // 0: Regular + group.Label = "GROUP:" + QObject::tr( "SMESH_2D_ALGO_GROUP_REGULAR" ); + theGroups[ key ].push_back( group ); + // 1: Free + group.Label = "GROUP:" + QObject::tr( "SMESH_2D_ALGO_GROUP_FREE" ); + theGroups[ key ].push_back( group ); + // 2: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_2D_ALGO_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + + // 3D algo + key = 13; + // 0: Regular + group.Label = "GROUP:" + QObject::tr( "SMESH_3D_ALGO_GROUP_REGULAR" ); + theGroups[ key ].push_back( group ); + // 1: Free + group.Label = "GROUP:" + QObject::tr( "SMESH_3D_ALGO_GROUP_FREE" ); + theGroups[ key ].push_back( group ); + // 2: Advanced + group.Label = "GROUP:" + QObject::tr( "SMESH_3D_ALGO_GROUP_ADVANCED" ); + theGroups[ key ].push_back( group ); + } + + size_t key = 0, groupID = 0; + if ( hyp && !hyp->Dim.isEmpty() ) + { + key = hyp->Dim[0] + isAlgo * 10; + groupID = hyp->GroupID; + } + + if ( key < theGroups.size() && !theGroups[ key ].empty() ) + { + std::vector< HypothesisData > & group = theGroups[ key ]; + return & ( groupID < group.size() ? group[ groupID ] : group.back() ); + } + return & theGroups[ 0 ][ 0 ]; + } + bool IsAvailableHypothesis(const HypothesisData* algoData, const QString& hypType, bool& isAuxiliary)