]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
Fix for bug IPAL10226 (Point Construction: impossible to create point on vertex).
authormzn <mzn@opencascade.com>
Wed, 30 Nov 2005 12:34:46 +0000 (12:34 +0000)
committermzn <mzn@opencascade.com>
Wed, 30 Nov 2005 12:34:46 +0000 (12:34 +0000)
src/BasicGUI/BasicGUI_PointDlg.cxx

index b63a8bd1ed0fb8d374576138e5225a56ccc8183f..da52b79f8f51c5eb805899c60f738022dd440d0e 100644 (file)
@@ -44,6 +44,9 @@
 #include <TopAbs_ShapeEnum.hxx>
 #include <TopoDS.hxx>
 #include <BRep_Tool.hxx>
+#include <TopExp.hxx>
+#include <TColStd_IndexedMapOfInteger.hxx>
+#include <TopTools_IndexedMapOfShape.hxx>
 
 #include <qapplication.h>
 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() );