Salome HOME
Corrected for PAL13626.
authorskl <skl@opencascade.com>
Fri, 20 Oct 2006 05:10:49 +0000 (05:10 +0000)
committerskl <skl@opencascade.com>
Fri, 20 Oct 2006 05:10:49 +0000 (05:10 +0000)
New method GetShapeIDForElem() is added.
Mehtod GetShapeID() is changed.

src/SMESH_I/SMESH_Mesh_i.cxx
src/SMESH_I/SMESH_Mesh_i.hxx

index 367eda450af834afe338271f2f4eb1b58b9bf1f8..c8b54f6bb13b3ccaf07f9a0e16a559ff8c92b95a 100644 (file)
@@ -49,6 +49,7 @@
 //#include "SMDS_ElemIterator.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESH_MesherHelper.hxx"
 //#include "SMDS_ElemIterator.hxx"
 #include "SMDS_VolumeTool.hxx"
 #include "SMESH_MesherHelper.hxx"
+#include "SMESH_MeshEditor.hxx"
 
 // OCCT Includes
 #include <OSD_Path.hxx>
 
 // OCCT Includes
 #include <OSD_Path.hxx>
@@ -1857,9 +1858,7 @@ SMESH::long_array* SMESH_Mesh_i::GetNodeInverseElements(const CORBA::Long id)
 //=============================================================================
 /*!
  * If given element is node returns IDs of shape from position
 //=============================================================================
 /*!
  * If given element is node returns IDs of shape from position
- * else - return ID of result shape after ::FindShape()
- * from SMESH_MeshEditor
- * If there is not element for given ID - returns -1
+ * If there is not node for given ID - returns -1
  */
 //=============================================================================
 
  */
 //=============================================================================
 
@@ -1879,12 +1878,35 @@ CORBA::Long SMESH_Mesh_i::GetShapeID(const CORBA::Long id)
       return pos->GetShapeId();
   }
 
       return pos->GetShapeId();
   }
 
+  return -1;
+}
+
+
+//=============================================================================
+/*!
+ * For given element returns ID of result shape after 
+ * ::FindShape() from SMESH_MeshEditor
+ * If there is not element for given ID - returns -1
+ */
+//=============================================================================
+
+CORBA::Long SMESH_Mesh_i::GetShapeIDForElem(const CORBA::Long id)
+{
+  SMESHDS_Mesh* aSMESHDS_Mesh = _impl->GetMeshDS();
+  if ( aSMESHDS_Mesh == NULL )
+    return -1;
+
   // try to find element
   const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
   if(!elem)
     return -1;
 
   // try to find element
   const SMDS_MeshElement* elem = aSMESHDS_Mesh->FindElement(id);
   if(!elem)
     return -1;
 
-  // need implementation???????????????????????????????????????????????
+  //SMESH::SMESH_MeshEditor_var aMeshEditor = SMESH_Mesh_i::GetMeshEditor();
+  ::SMESH_MeshEditor aMeshEditor(_impl);
+  int index = aMeshEditor.FindShape( elem );
+  if(index>0)
+    return index;
+
   return -1;
 }
 
   return -1;
 }
 
index d7c37b1de10893d4326945f97f63579d86db5ec6..6e87e03831b04ec6d2a5d985d3dd78ffaf291d48 100644 (file)
@@ -321,12 +321,17 @@ public:
 
   /*!
    * If given element is node returns IDs of shape from position
 
   /*!
    * If given element is node returns IDs of shape from position
-   * else - return ID of result shape after ::FindShape()
-   * from SMESH_MeshEditor
-   * If there is not element for given ID - returns -1
+   * If there is not node for given ID - returns -1
    */
   CORBA::Long GetShapeID(const CORBA::Long id);
 
    */
   CORBA::Long GetShapeID(const CORBA::Long id);
 
+  /*!
+   * For given element returns ID of result shape after 
+   * ::FindShape() from SMESH_MeshEditor
+   * If there is not element for given ID - returns -1
+   */
+  CORBA::Long GetShapeIDForElem(const CORBA::Long id);
+
   /*!
    * Returns number of nodes for given element
    * If there is not element for given ID - returns -1
   /*!
    * Returns number of nodes for given element
    * If there is not element for given ID - returns -1