From 19e44ed37c579229ee219e4d0960ce21d194a0eb Mon Sep 17 00:00:00 2001 From: eap Date: Wed, 30 Mar 2005 08:00:39 +0000 Subject: [PATCH] fix PAL8469. Set "Warning" icon to just published mesh or submesh --- src/SMESH_I/SMESH_Gen_i_1.cxx | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/SMESH_I/SMESH_Gen_i_1.cxx b/src/SMESH_I/SMESH_Gen_i_1.cxx index 4e50171a6..ac8641de2 100644 --- a/src/SMESH_I/SMESH_Gen_i_1.cxx +++ b/src/SMESH_I/SMESH_Gen_i_1.cxx @@ -471,7 +471,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishMesh (SALOMEDS::Study_ptr theStudy, else aTag++; - aMeshSO = publish (theStudy, theMesh, father, aTag, "ICON_SMESH_TREE_MESH" ); + aMeshSO = publish (theStudy, theMesh, father, aTag, "ICON_SMESH_TREE_MESH_WARN" ); if ( aMeshSO->_is_nil() ) return aMeshSO._retn(); } @@ -593,7 +593,7 @@ SALOMEDS::SObject_ptr SMESH_Gen_i::PublishSubMesh (SALOMEDS::Study_ptr theS SetName( aRootSO, aRootName ); // Add new submesh to corresponding sub-tree - aSubMeshSO = publish (theStudy, theSubMesh, aRootSO, 0, "ICON_SMESH_TREE_MESH"); + aSubMeshSO = publish (theStudy, theSubMesh, aRootSO, 0, "ICON_SMESH_TREE_MESH_WARN"); if ( aSubMeshSO->_is_nil() ) return aSubMeshSO._retn(); } @@ -773,7 +773,19 @@ bool SMESH_Gen_i::AddHypothesisToShape(SALOMEDS::Study_ptr theStudy, SALOMEDS::SObject_var aMeshOrSubMesh = GetMeshOrSubmeshByShape( theStudy, theMesh, theShape ); if ( aMeshOrSubMesh->_is_nil() ) - return false; + { + // publish submesh + TopoDS_Shape aShape = GeomObjectToShape( theShape ); + SMESH_Mesh_i* mesh_i = objectToServant( theMesh ); + if ( !aShape.IsNull() && mesh_i && mesh_i->GetImpl().GetMeshDS() ) { + SMESHDS_Mesh* meshDS = mesh_i->GetImpl().GetMeshDS(); + int shapeID = meshDS->ShapeToIndex( aShape ); + SMESH::SMESH_subMesh_var aSubMesh = mesh_i->getSubMesh(shapeID); + aMeshOrSubMesh = PublishSubMesh( theStudy, theMesh, aSubMesh, theShape ); + } + if ( aMeshOrSubMesh->_is_nil() ) + return false; + } //Find or Create Applied Hypothesis root bool aIsAlgo = !SMESH::SMESH_Algo::_narrow( theHyp )->_is_nil(); -- 2.39.2