Salome HOME
Implementation of Groups support by the SHAPER-STUDY module
[modules/smesh.git] / src / SMESH_I / SMESH_Mesh_i.cxx
index c2cf46593175fbc9fa88719ef9ee54e5fcc20b5c..cb57e77f450d2134c9fc84c852dfbbf1639194d3 100644 (file)
@@ -254,6 +254,24 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh()
   return aShapeObj._retn();
 }
 
+//================================================================================
+/*!
+* \brief Replaces a shape in the mesh
+*/
+//================================================================================
+void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom)
+  throw (SALOME::SALOME_Exception)
+{
+  TopoDS_Shape S = _impl->GetMeshDS()->ShapeToMesh();
+  GEOM_Client* geomClient = _gen_i->GetShapeReader();
+  TCollection_AsciiString aIOR;
+  if (geomClient->Find(S, aIOR)) {
+    geomClient->RemoveShapeFromBuffer(aIOR);
+  }
+  _impl->UndefShapeToMesh();
+  SetShape(theNewGeom);
+}
+
 //================================================================================
 /*!
  * \brief Return false if the mesh is not yet fully loaded from the study file
@@ -1981,7 +1999,7 @@ void SMESH_Mesh_i::addGeomGroupData(GEOM::GEOM_Object_ptr theGeomObj,
     return;
   // group indices
   GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( theGeomObj );
-  GEOM::GEOM_IGroupOperations_wrap groupOp =
+  GEOM::GEOM_IGroupOperations_ptr groupOp =
     geomGen->GetIGroupOperations();
   GEOM::ListOfLong_var ids = groupOp->GetObjects( theGeomObj );
 
@@ -2040,7 +2058,7 @@ TopoDS_Shape SMESH_Mesh_i::newGroupShape( TGeomGroupData & groupData)
     // get indices of group items
     set<int> curIndices;
     GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine( geomGroup );
-    GEOM::GEOM_IGroupOperations_wrap groupOp =
+    GEOM::GEOM_IGroupOperations_ptr groupOp =
       geomGen->GetIGroupOperations();
     GEOM::ListOfLong_var   ids = groupOp->GetObjects( geomGroup );
     for ( CORBA::ULong i = 0; i < ids->length(); ++i )