Mesh redesine. New fields added to specify whether hypothesis is main or additional one and for storing information about dimensions supported by hypothesis

This commit is contained in:
sln 2005-08-23 08:52:20 +00:00
parent 0d232fb704
commit f4cb697fcc
3 changed files with 43 additions and 41 deletions

View File

@ -34,11 +34,11 @@
// QT Includes // QT Includes
#include <qstring.h> #include <qstring.h>
#include <qwidget.h> #include <qwidget.h>
#include <qvaluevector.h>
//================================================================================= /*!
// class : SMESHGUI_GenericHypothesisCreator * \brief Auxiliary class for creation of hypotheses
// purpose : */
//=================================================================================
class SMESHGUI_GenericHypothesisCreator class SMESHGUI_GenericHypothesisCreator
{ {
public: public:
@ -46,30 +46,35 @@ class SMESHGUI_GenericHypothesisCreator
virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp) = 0; virtual void EditHypothesis (SMESH::SMESH_Hypothesis_ptr theHyp) = 0;
}; };
//================================================================================= /*!
// class : HypothesisData * \brief Class containing information about hypothesis
// purpose : */
//=================================================================================
class HypothesisData class HypothesisData
{ {
public: public:
HypothesisData (const QString& aPluginName, HypothesisData( const QString& thePluginName,
const QString& aServerLibName, const QString& theServerLibName,
const QString& aClientLibName, const QString& theClientLibName,
const QString& aLabel, const QString& theLabel,
const QString& anIconId) : const QString& theIconId,
PluginName(aPluginName), const QValueList<int>& theDim,
ServerLibName(aServerLibName), const bool theIsAux )
ClientLibName(aClientLibName), : PluginName( thePluginName ),
Label(aLabel), ServerLibName( theServerLibName ),
IconId(anIconId) ClientLibName( theClientLibName ),
Label( theLabel ),
IconId( theIconId ),
Dim( theDim ),
IsAux( theIsAux )
{}; {};
QString PluginName; QString PluginName; //!< plugin name
QString ServerLibName; QString ServerLibName; //!< server library name
QString ClientLibName; QString ClientLibName; //!< client library name
QString Label; QString Label; //!< label
QString IconId; QString IconId; //!< icon identifier
QValueList<int> Dim; //!< list of supported dimensions (see SMESH::Dimension enumeration)
bool IsAux; //!< TRUE if given hypothesis is auxiliary one, FALSE otherwise
}; };
#endif #endif

View File

@ -193,7 +193,9 @@ namespace SMESH{
} }
QStringList GetAvailableHypotheses(const bool isAlgo) QStringList GetAvailableHypotheses( const bool isAlgo,
const int theDim,
const bool isAux )
{ {
QStringList aHypList; QStringList aHypList;
@ -201,20 +203,14 @@ namespace SMESH{
InitAvailableHypotheses(); InitAvailableHypotheses();
// fill list of hypotheses/algorithms // fill list of hypotheses/algorithms
THypothesisDataMap* pMap = isAlgo ? &myAlgorithmsMap : &myHypothesesMap;
THypothesisDataMap::iterator anIter; THypothesisDataMap::iterator anIter;
if (isAlgo) { for ( anIter = pMap->begin(); anIter != pMap->end(); anIter++ )
anIter = myAlgorithmsMap.begin(); {
for (; anIter != myAlgorithmsMap.end(); anIter++) { HypothesisData* aData = (*anIter).second;
if ( ( theDim < 0 || aData->Dim.contains( theDim ) ) && aData->IsAux == isAux )
aHypList.append(((*anIter).first).c_str()); aHypList.append(((*anIter).first).c_str());
} }
}
else {
anIter = myHypothesesMap.begin();
for (; anIter != myHypothesesMap.end(); anIter++) {
aHypList.append(((*anIter).first).c_str());
}
}
return aHypList; return aHypList;
} }
@ -254,9 +250,8 @@ namespace SMESH{
// 2. Get names of plugin libraries // 2. Get names of plugin libraries
HypothesisData* aHypData = GetHypothesisData(aHypType); HypothesisData* aHypData = GetHypothesisData(aHypType);
if (!aHypData) { if (!aHypData)
return aCreator; return aCreator;
}
QString aClientLibName = aHypData->ClientLibName; QString aClientLibName = aHypData->ClientLibName;
QString aServerLibName = aHypData->ServerLibName; QString aServerLibName = aHypData->ServerLibName;

View File

@ -20,7 +20,7 @@
// //
// //
// //
// File : SMESHGUI_Hypotheses.h // File : SMESHGUI_HypothesesUtils.h
// Author : Julia DOROVSKIKH // Author : Julia DOROVSKIKH
// Module : SMESH // Module : SMESH
// $Header$ // $Header$
@ -49,7 +49,9 @@ namespace SMESH{
void InitAvailableHypotheses(); 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); HypothesisData* GetHypothesisData(const char* aHypType);