From f4cb697fcc605c3b9cdb517f9b4eef6b8532dc1a Mon Sep 17 00:00:00 2001 From: sln Date: Tue, 23 Aug 2005 08:52:20 +0000 Subject: [PATCH] Mesh redesine. New fields added to specify whether hypothesis is main or additional one and for storing information about dimensions supported by hypothesis --- src/SMESHGUI/SMESHGUI_Hypotheses.h | 51 +++++++++++++---------- src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx | 27 +++++------- src/SMESHGUI/SMESHGUI_HypothesesUtils.h | 6 ++- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 85a621791..c9ceee8ef 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -34,11 +34,11 @@ // QT Includes #include #include +#include -//================================================================================= -// class : SMESHGUI_GenericHypothesisCreator -// purpose : -//================================================================================= +/*! + * \brief Auxiliary class for creation of hypotheses +*/ class SMESHGUI_GenericHypothesisCreator { public: @@ -46,30 +46,35 @@ class SMESHGUI_GenericHypothesisCreator virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp) = 0; }; -//================================================================================= -// class : HypothesisData -// purpose : -//================================================================================= +/*! + * \brief Class containing information about hypothesis +*/ class HypothesisData { public: - HypothesisData (const QString& aPluginName, - const QString& aServerLibName, - const QString& aClientLibName, - const QString& aLabel, - const QString& anIconId) : - PluginName(aPluginName), - ServerLibName(aServerLibName), - ClientLibName(aClientLibName), - Label(aLabel), - IconId(anIconId) + HypothesisData( const QString& thePluginName, + const QString& theServerLibName, + const QString& theClientLibName, + const QString& theLabel, + const QString& theIconId, + const QValueList& theDim, + const bool theIsAux ) +: PluginName( thePluginName ), + ServerLibName( theServerLibName ), + ClientLibName( theClientLibName ), + Label( theLabel ), + IconId( theIconId ), + Dim( theDim ), + IsAux( theIsAux ) {}; - QString PluginName; - QString ServerLibName; - QString ClientLibName; - QString Label; - QString IconId; + QString PluginName; //!< plugin name + QString ServerLibName; //!< server library name + QString ClientLibName; //!< client library name + QString Label; //!< label + QString IconId; //!< icon identifier + QValueList Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration) + bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise }; #endif diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx index 75fde54b1..96f59ae8a 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.cxx @@ -193,7 +193,9 @@ namespace SMESH{ } - QStringList GetAvailableHypotheses(const bool isAlgo) + QStringList GetAvailableHypotheses( const bool isAlgo, + const int theDim, + const bool isAux ) { QStringList aHypList; @@ -201,20 +203,14 @@ namespace SMESH{ InitAvailableHypotheses(); // fill list of hypotheses/algorithms + THypothesisDataMap* pMap = isAlgo ? &myAlgorithmsMap : &myHypothesesMap; THypothesisDataMap::iterator anIter; - if (isAlgo) { - anIter = myAlgorithmsMap.begin(); - for (; anIter != myAlgorithmsMap.end(); anIter++) { - aHypList.append(((*anIter).first).c_str()); - } - } - else { - anIter = myHypothesesMap.begin(); - for (; anIter != myHypothesesMap.end(); anIter++) { - aHypList.append(((*anIter).first).c_str()); - } + for ( anIter = pMap->begin(); anIter != pMap->end(); anIter++ ) + { + HypothesisData* aData = (*anIter).second; + if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux ) + aHypList.append(((*anIter).first).c_str()); } - return aHypList; } @@ -254,9 +250,8 @@ namespace SMESH{ // 2. Get names of plugin libraries HypothesisData* aHypData = GetHypothesisData(aHypType); - if (!aHypData) { - return aCreator; - } + if (!aHypData) + return aCreator; QString aClientLibName = aHypData->ClientLibName; QString aServerLibName = aHypData->ServerLibName; diff --git a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h index 16d935b1e..0edd7793b 100644 --- a/src/SMESHGUI/SMESHGUI_HypothesesUtils.h +++ b/src/SMESHGUI/SMESHGUI_HypothesesUtils.h @@ -20,7 +20,7 @@ // // // -// File : SMESHGUI_Hypotheses.h +// File : SMESHGUI_HypothesesUtils.h // Author : Julia DOROVSKIKH // Module : SMESH // $Header$ @@ -49,7 +49,9 @@ namespace SMESH{ void InitAvailableHypotheses(); - QStringList GetAvailableHypotheses(const bool isAlgo); + QStringList GetAvailableHypotheses( const bool isAlgo, + const int theDim = -1, + const bool isAux = false); HypothesisData* GetHypothesisData(const char* aHypType); -- 2.30.2