From: eap Date: Wed, 20 Oct 2010 07:02:01 +0000 (+0000) Subject: 20885 EDF 607 SMESH: Measure tools X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=bc6dc0fb30309db94cb6fbd89de9bc320f5c169d;p=modules%2Fsmesh.git 20885 EDF 607 SMESH: Measure tools interface SMESH_IDSource { + SMESH_Mesh GetMesh(); --- diff --git a/idl/SMESH_Mesh.idl b/idl/SMESH_Mesh.idl index cc97d1e14..8165d5c00 100644 --- a/idl/SMESH_Mesh.idl +++ b/idl/SMESH_Mesh.idl @@ -248,6 +248,8 @@ module SMESH long_array elementConnectivities; types_array elementTypes; }; + interface SMESH_Mesh; + interface SMESH_IDSource { /*! @@ -265,6 +267,11 @@ module SMESH * Returns types of elements it contains */ array_of_ElementType GetTypes(); + + /*! + * Returns the mesh + */ + SMESH_Mesh GetMesh(); }; interface SMESH_Group; diff --git a/src/SMESH_I/SMESH_MeshEditor_i.cxx b/src/SMESH_I/SMESH_MeshEditor_i.cxx index b88de2d39..f763c4762 100644 --- a/src/SMESH_I/SMESH_MeshEditor_i.cxx +++ b/src/SMESH_I/SMESH_MeshEditor_i.cxx @@ -365,10 +365,12 @@ void SMESH_MeshEditor_i::initData(bool deleteSearchers) struct _IDSource : public POA_SMESH::SMESH_IDSource { - SMESH::long_array _ids; - SMESH::ElementType _type; + SMESH::long_array _ids; + SMESH::ElementType _type; + SMESH::SMESH_Mesh_ptr _mesh; SMESH::long_array* GetIDs() { return new SMESH::long_array( _ids ); } SMESH::long_array* GetMeshInfo() { return 0; } + SMESH::SMESH_Mesh_ptr GetMesh() { return SMESH::SMESH_Mesh::_duplicate( _mesh ); } SMESH::array_of_ElementType* GetTypes() { SMESH::array_of_ElementType_var types = new SMESH::array_of_ElementType; @@ -384,6 +386,7 @@ SMESH::SMESH_IDSource_ptr SMESH_MeshEditor_i::MakeIDSource(const SMESH::long_arr _IDSource* anIDSource = new _IDSource; anIDSource->_ids = ids; anIDSource->_type = type; + anIDSource->_mesh = myMesh_i->_this(); SMESH::SMESH_IDSource_var anIDSourceVar = anIDSource->_this(); return anIDSourceVar._retn(); diff --git a/src/SMESH_I/SMESH_Mesh_i.cxx b/src/SMESH_I/SMESH_Mesh_i.cxx index bb8c8b497..a4d94c294 100644 --- a/src/SMESH_I/SMESH_Mesh_i.cxx +++ b/src/SMESH_I/SMESH_Mesh_i.cxx @@ -3581,6 +3581,16 @@ SMESH::array_of_ElementType* SMESH_Mesh_i::GetTypes() return types._retn(); } +//======================================================================= +//function : GetMesh +//purpose : Returns self +//======================================================================= + +SMESH::SMESH_Mesh_ptr SMESH_Mesh_i::GetMesh() +{ + return SMESH::SMESH_Mesh::_duplicate( _this() ); +} + //============================================================================= /*! * \brief Returns statistic of mesh elements diff --git a/src/SMESH_I/SMESH_Mesh_i.hxx b/src/SMESH_I/SMESH_Mesh_i.hxx index d3f550ecd..ea33ec9fa 100644 --- a/src/SMESH_I/SMESH_Mesh_i.hxx +++ b/src/SMESH_I/SMESH_Mesh_i.hxx @@ -521,18 +521,20 @@ public: // ========================= virtual SMESH::long_array* GetIDs(); - /*! * Returns statistic of mesh elements * Result array of number enityties * Inherited from SMESH_IDSource */ virtual SMESH::long_array* GetMeshInfo(); - /*! * Returns types of elements it contains */ virtual SMESH::array_of_ElementType* GetTypes(); + /*! + * Returns self + */ + virtual SMESH::SMESH_Mesh_ptr GetMesh(); std::map _mapSubMesh_i; //NRI diff --git a/src/SMESH_I/SMESH_subMesh_i.cxx b/src/SMESH_I/SMESH_subMesh_i.cxx index 8401ce775..2f3cba1b9 100644 --- a/src/SMESH_I/SMESH_subMesh_i.cxx +++ b/src/SMESH_I/SMESH_subMesh_i.cxx @@ -568,3 +568,13 @@ SMESH::array_of_ElementType* SMESH_subMesh_i::GetTypes() } return types._retn(); } + +//======================================================================= +//function : GetMesh +//purpose : interface SMESH_IDSource +//======================================================================= + +SMESH::SMESH_Mesh_ptr SMESH_subMesh_i::GetMesh() +{ + return GetFather(); +} diff --git a/src/SMESH_I/SMESH_subMesh_i.hxx b/src/SMESH_I/SMESH_subMesh_i.hxx index 3f90a8cb8..f5fd559d4 100644 --- a/src/SMESH_I/SMESH_subMesh_i.hxx +++ b/src/SMESH_I/SMESH_subMesh_i.hxx @@ -85,19 +85,28 @@ public: SALOME_MED::FAMILY_ptr GetFamily() throw (SALOME::SALOME_Exception); - virtual SMESH::long_array* GetIDs(); + // ========================= + // interface SMESH_IDSource + // ========================= + /*! + * Returns a sequence of all element IDs + */ + virtual SMESH::long_array* GetIDs(); /*! * Returns statistic of mesh elements * Result array of number enityties * Inherited from SMESH_IDSource */ virtual SMESH::long_array* GetMeshInfo(); - /*! * Returns types of elements it contains */ virtual SMESH::array_of_ElementType* GetTypes(); + /*! + * Returns the mesh + */ + SMESH::SMESH_Mesh_ptr GetMesh(); SMESH_Mesh_i* _mesh_i; //NRI