From c2a62ff550708341eb9ad22cbdecf3e3b625c290 Mon Sep 17 00:00:00 2001 From: vsv Date: Fri, 27 Dec 2019 18:26:04 +0300 Subject: [PATCH] Improve ReplaceShape interface --- idl/SMESH_Mesh.idl | 2 +- src/SMESH_I/SMESH_Mesh_i.cxx | 10 ++++++---- src/SMESH_I/SMESH_Mesh_i.hxx | 2 +- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index b4ec14dc8..8cda08472 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -350,7 +350,7 @@ module SMESH /*! * Replaces a shape in the mesh */ - void ReplaceShape(in GEOM::GEOM_Object theNewGeom, in GEOM::GEOM_Object theOldGeom) + void ReplaceShape(in GEOM::GEOM_Object theNewGeom) raises (SALOME::SALOME_Exception); /*! diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index 1740de242..0f7ce9646 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -259,13 +259,15 @@ GEOM::GEOM_Object_ptr SMESH_Mesh_i::GetShapeToMesh() * \brief Replaces a shape in the mesh */ //================================================================================ -void SMESH_Mesh_i::ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom, GEOM::GEOM_Object_ptr theOldGeom) +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(); - GEOM::GEOM_Gen_var geomGen = _gen_i->GetGeomEngine(theOldGeom); - CORBA::String_var groupIOR = geomGen->GetStringFromIOR(theOldGeom); - geomClient->RemoveShapeFromBuffer(groupIOR.in()); + TCollection_AsciiString aIOR; + if (geomClient->Find(S, aIOR)) { + geomClient->RemoveShapeFromBuffer(aIOR); + } _impl->UndefShapeToMesh(); SetShape(theNewGeom); } diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index 9c564e176..535931d93 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -74,7 +74,7 @@ public: GEOM::GEOM_Object_ptr GetShapeToMesh() throw (SALOME::SALOME_Exception); - virtual void ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom, GEOM::GEOM_Object_ptr theOldGeom) + virtual void ReplaceShape(GEOM::GEOM_Object_ptr theNewGeom) throw (SALOME::SALOME_Exception); CORBA::Boolean IsLoaded() -- 2.39.2