From 9296d2af7b52251cf6b60db83431e6a99b0148e8 Mon Sep 17 00:00:00 2001 From: eap Date: Fri, 11 Mar 2011 13:14:52 +0000 Subject: [PATCH] 0021197: EDF 1772 SMESH: Automatic meshing hypothesis class HypothesesSet { + void setIsCustom( bool ); + bool getIsCustom() const; + int maxDim() const; --- src/SMESHGUI/SMESHGUI_Hypotheses.cxx | 31 ++++++++++++++++++++++++++-- src/SMESHGUI/SMESHGUI_Hypotheses.h | 6 +++++- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx index e39b9cd0b..6fd08d29b 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.cxx +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.cxx @@ -697,7 +697,8 @@ HypothesisData::HypothesisData( const QString& theTypeName, HypothesesSet::HypothesesSet( const QString& theSetName ) : myHypoSetName( theSetName ), - myIsAlgo( false ) + myIsAlgo( false ), + myIsCustom( false ) { } @@ -707,7 +708,8 @@ HypothesesSet::HypothesesSet( const QString& theSetName, : myHypoSetName( theSetName ), myHypoList( theHypoList ), myAlgoList( theAlgoList ), - myIsAlgo( false ) + myIsAlgo( false ), + myIsCustom( false ) { } @@ -761,3 +763,28 @@ QString HypothesesSet::current() const { return list()->at(myIndex); } + +void HypothesesSet::setIsCustom( bool isCustom ) +{ + myIsCustom = isCustom; +} + +bool HypothesesSet::getIsCustom() const +{ + return myIsCustom; +} + +int HypothesesSet::maxDim() const +{ + HypothesesSet * thisSet = (HypothesesSet*) this; + int dim = -1; + for ( int isAlgo = 0; isAlgo < 2; ++isAlgo ) + { + thisSet->init( isAlgo ); + while ( thisSet->next(), thisSet->more() ) + if ( HypothesisData* hypData = SMESH::GetHypothesisData( thisSet->current() )) + for ( int i = 0; i < hypData->Dim.count(); ++i ) + dim = qMax( dim, hypData->Dim[i] ); + } + return dim; +} diff --git a/src/SMESHGUI/SMESHGUI_Hypotheses.h b/src/SMESHGUI/SMESHGUI_Hypotheses.h index 34b875fa3..a6f0a70a8 100644 --- a/src/SMESHGUI/SMESHGUI_Hypotheses.h +++ b/src/SMESHGUI/SMESHGUI_Hypotheses.h @@ -202,6 +202,10 @@ public: void set( bool, const QStringList& ); int count( bool ) const; + void setIsCustom( bool ); + bool getIsCustom() const; + int maxDim() const; + bool isAlgo() const; //this method sets internal index to -1, thus before any data access it is necessary to call next() @@ -216,9 +220,9 @@ private: QStringList* list() const; private: - bool myIsAlgo; QString myHypoSetName; QStringList myHypoList, myAlgoList; + bool myIsAlgo, myIsCustom; int myIndex; }; -- 2.39.2