Salome HOME
Update copyrights
[modules/homard.git] / src / HOMARDGUI / HOMARDGUI_Utils.cxx
index 4adb4849c3c26ac140a5963348212d70c16b97e2..4c33322ef887cde9237109afa636dec84ce4835d 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2011-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2011-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -32,7 +32,6 @@
 #include "SalomeApp_Study.h"
 
 #include "SALOME_ListIO.hxx"
-#include "SALOME_ListIteratorOfListIO.hxx"
 
 #include "SALOMEconfig.h"
 #include "utilities.h"
 
 SALOME_ListIO HOMARD_UTILS::mySelected;
 
-//================================================================
-// Function : GetCStudy
-// Returne un pointeur sur l'etude courante
-//================================================================
- _PTR(Study) HOMARD_UTILS::GetCStudy(const SalomeApp_Study* theStudy)
-{
-    return theStudy->studyDS();
-}
-
 //================================================================
 // Function : GetActiveStudy
 // Returne un pointeur sur l'etude active
@@ -72,17 +62,15 @@ SUIT_Study* HOMARD_UTILS::GetActiveStudy()
 }
 
 //================================================================
-// Function : GetActiveStudyDocument
+// Function : getStudy
 // Returne un pointeur sur l'etude active
 //================================================================
-_PTR(Study) HOMARD_UTILS::GetActiveStudyDocument()
+_PTR(Study) HOMARD_UTILS::getStudy()
 {
-    SalomeApp_Study* aStudy = dynamic_cast<SalomeApp_Study*>(GetActiveStudy());
-    if (aStudy){
-      return aStudy->studyDS();
-    }
-    else
-      return _PTR(Study)();
+  static _PTR(Study) _study;
+  if(!_study)
+    _study = SalomeApp_Application::getStudy();
+  return _study;
 }
 
 //================================================================
@@ -198,6 +186,13 @@ bool HOMARD_UTILS::isObject(_PTR(SObject) MonObj, QString TypeObject, int option
   return bOK ;
 }
 //================================================================
+// Retourne vrai si l'objet est une frontiere CAO
+//================================================================
+bool HOMARD_UTILS::isBoundaryCAO(_PTR(SObject) MonObj)
+{
+   return isObject( MonObj, QString("BoundaryCAOHomard"), -1 ) ;
+}
+//================================================================
 // Retourne vrai si l'objet est une frontiere analytique
 //================================================================
 bool HOMARD_UTILS::isBoundaryAn(_PTR(SObject) MonObj)