Salome HOME
Merge multi-study removal branch.
[modules/smesh.git] / src / SMESHGUI / SMESHGUI_GroupOnShapeDlg.cxx
index deeaad22ff1481a30d5eeb513726c2c7683933f1..aaf5f6801e7816bc65f882f23fd720d2da8bf6dc 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -30,7 +30,6 @@
 #include "SMESHGUI.h"
 #include "SMESHGUI_Utils.h"
 #include "SMESHGUI_GEOMGenUtils.h"
-#include <SMESH_ActorUtils.h>
 
 #include <GeometryGUI.h>
 #include <GEOM_SelectionFilter.h>
@@ -220,13 +219,12 @@ static SMESH::ElementType elementType(GEOM::GEOM_Object_var geom)
     case GEOM::COMPOUND: break;
     default:             return SMESH::ALL;
     }
-    _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
     GEOM::GEOM_IShapesOperations_wrap aShapeOp =
-      SMESH::GetGEOMGen()->GetIShapesOperations(aStudy->StudyId());
+      SMESH::GetGEOMGen()->GetIShapesOperations();
 
     if ( geom->GetType() == 37 ) { // geom group
       GEOM::GEOM_IGroupOperations_wrap aGroupOp =
-        SMESH::GetGEOMGen()->GetIGroupOperations(aStudy->StudyId());
+        SMESH::GetGEOMGen()->GetIGroupOperations();
       if ( !aGroupOp->_is_nil() ) {
         // mainShape is an existing servant => GEOM_Object_var not GEOM_Object_wrap
         GEOM::GEOM_Object_var mainShape = aGroupOp->GetMainShape( geom );
@@ -297,11 +295,11 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
 {
   SUIT_OverrideCursor aWaitCursor;
 
-  if (isStudyLocked())
+  if (SMESHGUI::isStudyLocked())
     return false;
 
   // study
-  _PTR(Study) aStudy = SMESH::GetActiveStudyDocument();
+  _PTR(Study) aStudy = SMESH::getStudy();
   if ( !aStudy ) return false;
 
   // mesh
@@ -351,17 +349,9 @@ bool SMESHGUI_GroupOnShapeOp::onApply()
 
       //printf( "apply() %s %s\n", (*geomID).latin1(), name.latin1() );
       group = mesh->CreateGroupFromGEOM( elemType, name.toLatin1().data(), geom );
-      if( !group->_is_nil() ) {
-        // set default color for created group
-        QColor c = SMESH::GetColor( "SMESH", "default_grp_color" );
-        SALOMEDS::Color aColor;
-        aColor.R = c.redF();
-        aColor.G = c.greenF();
-        aColor.B = c.blueF();
-        group->SetColor(aColor);
+      if( !group->_is_nil() )
         if( _PTR(SObject) aSObject = SMESH::ObjectToSObject( group ) )
           anEntryList.append( aSObject->GetID().c_str() );
-      }
     }
   }
   SMESHGUI::Modified();
@@ -469,7 +459,7 @@ void SMESHGUI_GroupOnShapeOp::selectionDone()
   QStringList goodNames, goodIds;
   if (nbSelected > 0) {
     // study
-    if (_PTR(Study) aStudy = SMESH::GetActiveStudyDocument()) {
+    if (_PTR(Study) aStudy = SMESH::getStudy()) {
       // mesh
       if (_PTR(SObject)  meshSO = aStudy->FindObjectID( myMeshID.toLatin1().data() )) {
         // shape to mesh