Salome HOME
IPAL52974: Find Element by Point shows nodes that do not belong to current group
authoreap <eap@opencascade.com>
Fri, 18 Mar 2016 12:42:33 +0000 (15:42 +0300)
committereap <eap@opencascade.com>
Fri, 18 Mar 2016 12:42:33 +0000 (15:42 +0300)
src/SMESHGUI/SMESHGUI_MeshEditPreview.cxx
src/SMESHGUI/SMESHGUI_MeshEditPreview.h
src/SMESHUtils/SMESH_MeshAlgos.cxx
src/SMESHUtils/SMESH_MeshAlgos.hxx

index 50fe4e59246f8db15af2859fbdb98c499f001f34..73377c3b11b5aed9641ec11c88e2a08da5ebbaae 100644 (file)
@@ -404,3 +404,14 @@ vtkUnstructuredGrid* SMESHGUI_MeshEditPreview::GetGrid() const
 {
   return myGrid;
 }
+
+//================================================================================
+/*!
+ * \brief Returns myViewWindow
+ */
+//================================================================================
+
+SVTK_ViewWindow* SMESHGUI_MeshEditPreview::GetViewWindow() const
+{
+  return myViewWindow;
+}
index a506a371800e07f079d93872067cb06802ee49b3..e88355819a015cba14c3590f8c06f6e6e642fb5e 100644 (file)
@@ -74,6 +74,7 @@ public:
 
   SALOME_Actor*        GetActor() const;
   vtkUnstructuredGrid* GetGrid() const;
+  SVTK_ViewWindow*     GetViewWindow() const;
 };
 
 #endif // SMESHGUI_MESHEDITPREVIEW_H
index 985e4a7ae8690b1726d59a710a50ceba2bae9401..a5f7701c2d549e6fb251dcd3d01d099a40491c3f 100644 (file)
@@ -60,7 +60,8 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
   /*!
    * \brief Constructor
    */
-  SMESH_NodeSearcherImpl( const SMDS_Mesh* theMesh )
+  SMESH_NodeSearcherImpl( const SMDS_Mesh*     theMesh   = 0,
+                          SMDS_ElemIteratorPtr theElemIt = SMDS_ElemIteratorPtr() )
   {
     myMesh = ( SMDS_Mesh* ) theMesh;
 
@@ -70,6 +71,14 @@ struct SMESH_NodeSearcherImpl: public SMESH_NodeSearcher
       while ( nIt->more() )
         nodes.insert( nodes.end(), nIt->next() );
     }
+    else if ( theElemIt )
+    {
+      while ( theElemIt->more() )
+      {
+        const SMDS_MeshElement* e = theElemIt->next();
+        nodes.insert( e->begin_nodes(), e->end_nodes() );
+      }
+    }
     myOctreeNode = new SMESH_OctreeNode(nodes) ;
 
     // get max size of a leaf box
@@ -714,8 +723,12 @@ FindElementsByPoint(const gp_Pnt&                      point,
   if ( type == SMDSAbs_Node || type == SMDSAbs_0DElement || type == SMDSAbs_Ball)
   {
     if ( !_nodeSearcher )
-      _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
-
+    {
+      if ( _meshPartIt )
+        _nodeSearcher = new SMESH_NodeSearcherImpl( 0, _meshPartIt );
+      else
+        _nodeSearcher = new SMESH_NodeSearcherImpl( _mesh );
+    }
     std::vector< const SMDS_MeshNode* > foundNodes;
     _nodeSearcher->FindNearPoint( point, tolerance, foundNodes );
 
@@ -1695,6 +1708,17 @@ SMESH_NodeSearcher* SMESH_MeshAlgos::GetNodeSearcher(SMDS_Mesh& mesh)
   return new SMESH_NodeSearcherImpl( &mesh );
 }
 
+//=======================================================================
+/*!
+ * \brief Return SMESH_NodeSearcher
+ */
+//=======================================================================
+
+SMESH_NodeSearcher* SMESH_MeshAlgos::GetNodeSearcher(SMDS_ElemIteratorPtr elemIt)
+{
+  return new SMESH_NodeSearcherImpl( 0, elemIt );
+}
+
 //=======================================================================
 /*!
  * \brief Return SMESH_ElementSearcher
index f8ea69a6b0d60b53206cf8899ddfda1cdfd29d62..6420bf96631bb5af6bebccb7f0267d4ee9896d61 100644 (file)
@@ -159,6 +159,9 @@ namespace SMESH_MeshAlgos
   SMESHUtils_EXPORT
   SMESH_NodeSearcher* GetNodeSearcher( SMDS_Mesh& mesh );
 
+  SMESHUtils_EXPORT
+  SMESH_NodeSearcher* GetNodeSearcher( SMDS_ElemIteratorPtr elemIt );
+
   /*!
    * \brief Return SMESH_ElementSearcher. The caller is responsible for deleting it
    */