Salome HOME
0021197: EDF 1772 SMESH: Automatic meshing hypothesis
authoreap <eap@opencascade.com>
Fri, 11 Mar 2011 13:14:52 +0000 (13:14 +0000)
committereap <eap@opencascade.com>
Fri, 11 Mar 2011 13:14:52 +0000 (13:14 +0000)
class HypothesesSet
{
+  void setIsCustom( bool );
+  bool getIsCustom() const;
+  int maxDim() const;

src/SMESHGUI/SMESHGUI_Hypotheses.cxx
src/SMESHGUI/SMESHGUI_Hypotheses.h

index e39b9cd0bd29647ca068e083cfe009c7d319a826..6fd08d29b3cff49ecd4bf709503ba2b07293eb70 100644 (file)
@@ -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;
+}
index 34b875fa3814b0e37c345d46928035b698228af9..a6f0a70a8f220792cc2f7d0ef0a292d9284d0b6a 100644 (file)
@@ -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;
 };