Salome HOME
20885 EDF 607 SMESH: Measure tools
authoreap <eap@opencascade.com>
Wed, 20 Oct 2010 07:02:01 +0000 (07:02 +0000)
committereap <eap@opencascade.com>
Wed, 20 Oct 2010 07:02:01 +0000 (07:02 +0000)
   interface SMESH_IDSource
   {
+    SMESH_Mesh GetMesh();

idl/SMESH_Mesh.idl
src/SMESH_I/SMESH_MeshEditor_i.cxx
src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx
src/SMESH_I/SMESH_subMesh_i.cxx
src/SMESH_I/SMESH_subMesh_i.hxx

index cc97d1e14bed63a706a0877f4122723b4ff2183b..8165d5c00c5e37cb10984eb3fc6d69f339a118e9 100644 (file)
@@ -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;
index b88de2d3951e42016f5f55ea5b89f7b3a1b3a9e1..f763c47626a0bc420f309c60c2a7a3374476f9f3 100644 (file)
@@ -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();
index bb8c8b4971c2b3dd79466ff4a500ca73d7717dd2..a4d94c29431838884bcb9d484552bfbae05ec245 100644 (file)
@@ -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
index d3f550ecdae29dd71f1e457bc7c6d7e7b722f10b..ea33ec9fa2ca04710e2c6d13fc9e9defce10080b 100644 (file)
@@ -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<int, SMESH_subMesh_i*> _mapSubMesh_i; //NRI
index 8401ce7755da50a8c3ac59b5df82a7c6db6f079a..2f3cba1b9bbde6ddaaf8474bd91059913482c34c 100644 (file)
@@ -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();
+}
index 3f90a8cb818294d7f443646352405e181532e1db..f5fd559d404dc692d65f4f7ed3d4376455e61464 100644 (file)
@@ -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