From b2c75e4e656b2dd5255d169e3356fc372353377e Mon Sep 17 00:00:00 2001 From: mzn Date: Wed, 30 Nov 2005 12:34:46 +0000 Subject: [PATCH] Fix for bug IPAL10226 (Point Construction: impossible to create point on vertex). --- src/BasicGUI/BasicGUI_PointDlg.cxx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/BasicGUI/BasicGUI_PointDlg.cxx b/src/BasicGUI/BasicGUI_PointDlg.cxx index b63a8bd1e..da52b79f8 100644 --- a/src/BasicGUI/BasicGUI_PointDlg.cxx +++ b/src/BasicGUI/BasicGUI_PointDlg.cxx @@ -44,6 +44,9 @@ #include #include #include +#include +#include +#include #include using namespace std; @@ -330,15 +333,31 @@ void BasicGUI_PointDlg::SelectionIntoArgument() if ( IObjectCount() == 1 ) { Standard_Boolean aRes = Standard_False; - GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( firstIObject(), aRes ); + Handle(SALOME_InteractiveObject) anIO = firstIObject(); + GEOM::GEOM_Object_var aSelectedObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes ); if ( !CORBA::is_nil( aSelectedObject ) && aRes ) { if ( id == 0 ) { // get CORBA reference to data object TopoDS_Shape aShape = myGeometryGUI->GetShapeReader().GetShape( myGeometryGUI->GetGeomGen(), aSelectedObject ); - if ( !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) + if ( aShape.IsNull() ) + return; + + TColStd_IndexedMapOfInteger aMap; + + ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr()->GetIndexes( anIO, aMap ); + + if ( aMap.Extent() == 1 ) { + int anIndex = aMap( 1 ); + TopTools_IndexedMapOfShape aShapes; + TopExp::MapShapes( aShape, aShapes ); + aShape = aShapes.FindKey( anIndex ); + + if ( aShape.IsNull() || aShape.ShapeType() != TopAbs_VERTEX ) + return; + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); GroupXYZ->SpinBox_DX->SetValue( aPnt.X() ); GroupXYZ->SpinBox_DY->SetValue( aPnt.Y() ); -- 2.39.2