Salome HOME
IPAL19834: Incorrect result after make Partition of 2 objects. A fix by PKV.
[modules/geom.git] / src / BasicGUI / BasicGUI_PointDlg.cxx
index 5a2a9c4aea4f5c3a4713c6d87ad5891ab4c86303..59b1121ccf8c8f6a72c8f6895a01b6050dd78b9c 100644 (file)
@@ -64,6 +64,8 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   QPixmap image1( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_EDGE" ) ) );
   QPixmap image2( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_SELECT" ) ) );
   QPixmap image3( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_REF" ) ) );
+  QPixmap image4( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_LINES") ) );
+  QPixmap image5( SUIT_Session::session()->resourceMgr()->loadPixmap( "GEOM", tr( "ICON_DLG_POINT_FACE" ) ) );
 
   setWindowTitle( tr( "GEOM_POINT_TITLE" ) );
 
@@ -72,6 +74,10 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   mainFrame()->RadioButton1->setIcon( image0 );
   mainFrame()->RadioButton2->setIcon( image3 );
   mainFrame()->RadioButton3->setIcon( image1 );
+  mainFrame()->RadioButton4->show();
+  mainFrame()->RadioButton4->setIcon( image4 );
+  mainFrame()->RadioButton5->show();
+  mainFrame()->RadioButton5->setIcon( image5 );
 
   GroupXYZ = new DlgRef_3Spin( centralWidget() );
   GroupXYZ->GroupBox1->setTitle( tr( "GEOM_COORDINATES" ) );
@@ -85,6 +91,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   GroupOnCurve->TextLabel2->setText( tr( "GEOM_PARAMETER" ) );
   GroupOnCurve->PushButton1->setIcon( image2 );
 
+  GroupOnSurface = new DlgRef_1Sel2Spin( centralWidget() );
+  GroupOnSurface->GroupBox1->setTitle( tr( "GEOM_PARAM_POINT" ) );
+  GroupOnSurface->TextLabel1->setText( tr( "GEOM_FACE" ) );
+  GroupOnSurface->TextLabel2->setText( tr( "GEOM_UPARAMETER" ) );
+  GroupOnSurface->TextLabel3->setText( tr( "GEOM_VPARAMETER" ) );
+  GroupOnSurface->PushButton1->setIcon( image2 );
+
   GroupRefPoint = new DlgRef_1Sel3Spin( centralWidget() );
   GroupRefPoint->GroupBox1->setTitle( tr( "GEOM_REF_POINT" ) );
   GroupRefPoint->TextLabel1->setText( tr( "GEOM_POINT" ) );
@@ -93,6 +106,13 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   GroupRefPoint->TextLabel3->setText( tr( "GEOM_DY" ) );
   GroupRefPoint->TextLabel4->setText( tr( "GEOM_DZ" ) );
 
+  GroupLineIntersection = new DlgRef_2Sel( centralWidget() );
+  GroupLineIntersection->GroupBox1->setTitle( tr( "GEOM_LINE_INTERSECTION" ) );
+  GroupLineIntersection->TextLabel1->setText( tr( "GEOM_LINE1" ) );
+  GroupLineIntersection->TextLabel2->setText( tr( "GEOM_LINE2" ) );
+  GroupLineIntersection->PushButton1->setIcon( image2 );
+  GroupLineIntersection->PushButton2->setIcon( image2 );
+
   myCoordGrp = new QGroupBox( tr( "GEOM_COORDINATES" ), centralWidget() );
   QGridLayout* myCoordGrpLayout = new QGridLayout( myCoordGrp );
   myCoordGrpLayout->addWidget( new QLabel( tr( "GEOM_X" ), myCoordGrp ), 0, 0 );
@@ -109,7 +129,9 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   layout->setMargin( 0 ); layout->setSpacing( 6 );
   layout->addWidget( GroupXYZ );
   layout->addWidget( GroupOnCurve );
+  layout->addWidget( GroupOnSurface );
   layout->addWidget( GroupRefPoint );
+  layout->addWidget( GroupLineIntersection );
   layout->addWidget( myCoordGrp );
 
   myX->setReadOnly( true );
@@ -126,7 +148,7 @@ BasicGUI_PointDlg::BasicGUI_PointDlg( GeometryGUI* theGeometryGUI, QWidget* pare
   myY->setPalette( aPal );
   myZ->setPalette( aPal );
 
-  setHelpFileName( "point.htm" );
+  setHelpFileName( "create_point_page.html" );
  
   Init();
 }
@@ -148,7 +170,10 @@ BasicGUI_PointDlg::~BasicGUI_PointDlg()
 void BasicGUI_PointDlg::Init()
 {
   GroupOnCurve->LineEdit1->setReadOnly( true );
+  GroupOnSurface->LineEdit1->setReadOnly( true );
   GroupRefPoint->LineEdit1->setReadOnly( true );
+  GroupLineIntersection->LineEdit1->setReadOnly( true );
+  GroupLineIntersection->LineEdit2->setReadOnly( true );
 
   myEdge = GEOM::GEOM_Object::_nil();
   myRefPoint = GEOM::GEOM_Object::_nil();
@@ -160,25 +185,30 @@ void BasicGUI_PointDlg::Init()
   double step = resMgr->doubleValue( "Geometry", "SettingsGeomStep", 100 );
   
   /* min, max, step and decimals for spin boxes */
-  initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 );
-  initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 );
-  initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 );
+  initSpinBox( GroupXYZ->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupXYZ->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupXYZ->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
   GroupXYZ->SpinBox_DX->setValue( 0.0 );
   GroupXYZ->SpinBox_DY->setValue( 0.0 );
   GroupXYZ->SpinBox_DZ->setValue( 0.0 );
 
-  initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 );
-  initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 );
-  initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 );
+  initSpinBox( GroupRefPoint->SpinBox_DX, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupRefPoint->SpinBox_DY, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  initSpinBox( GroupRefPoint->SpinBox_DZ, COORD_MIN, COORD_MAX, step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
   GroupRefPoint->SpinBox_DX->setValue( 0.0 );
   GroupRefPoint->SpinBox_DY->setValue( 0.0 );
   GroupRefPoint->SpinBox_DZ->setValue( 0.0 );
 
   step = 0.1;
 
-  initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, 3 );
+  initSpinBox( GroupOnCurve->SpinBox_DX, 0., 1., step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
   GroupOnCurve->SpinBox_DX->setValue( 0.5 );
 
+  initSpinBox( GroupOnSurface->SpinBox_DX, 0., 1., step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  GroupOnSurface->SpinBox_DX->setValue( 0.5 );
+  initSpinBox( GroupOnSurface->SpinBox_DY, 0., 1., step, 3 ); // VSR:TODO : DBL_DIGITS_DISPLAY
+  GroupOnSurface->SpinBox_DY->setValue( 0.5 );
+
   /* signals and slots connections */
   connect( myGeomGUI,      SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT( DeactivateActiveDialog() ) );
   connect( myGeomGUI,      SIGNAL( SignalCloseAllDialogs() ),        this, SLOT( ClickOnCancel() ) );
@@ -191,32 +221,52 @@ void BasicGUI_PointDlg::Init()
   connect( GroupOnCurve->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
   connect( GroupOnCurve->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
 
-  connect( GroupOnCurve->SpinBox_DX,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupXYZ->SpinBox_DX,      SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupXYZ->SpinBox_DY,      SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupXYZ->SpinBox_DZ,      SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupRefPoint->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupRefPoint->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-  connect( GroupRefPoint->SpinBox_DZ, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
-
-  // VSR: TODO ->>
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupOnCurve->SpinBox_DX,  SLOT( SetStep( double ) ) );
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DX,      SLOT( SetStep( double ) ) );
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DY,      SLOT( SetStep( double ) ) );
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupXYZ->SpinBox_DZ,      SLOT( SetStep( double ) ) );
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DX, SLOT( SetStep( double ) ) );
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DY, SLOT( SetStep( double ) ) );
-  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), GroupRefPoint->SpinBox_DZ, SLOT( SetStep( double ) ) );
-  // <<-
-
-  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(), 
-          SIGNAL( currentSelectionChanged() ), this, SLOT( SelectionIntoArgument() ) );  
+  connect( GroupOnSurface->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupOnSurface->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+
+  connect( GroupLineIntersection->PushButton1, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupLineIntersection->PushButton2, SIGNAL( clicked() ),       this, SLOT( SetEditCurrentArgument() ) );
+  connect( GroupLineIntersection->LineEdit1,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+  connect( GroupLineIntersection->LineEdit2,   SIGNAL( returnPressed() ), this, SLOT( LineEditReturnPressed() ) );
+
+  connect( GroupOnCurve->SpinBox_DX,   SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupOnSurface->SpinBox_DX, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupOnSurface->SpinBox_DY, SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupXYZ->SpinBox_DX,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupXYZ->SpinBox_DY,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupXYZ->SpinBox_DZ,       SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupRefPoint->SpinBox_DX,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupRefPoint->SpinBox_DY,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+  connect( GroupRefPoint->SpinBox_DZ,  SIGNAL( valueChanged( double ) ), this, SLOT( ValueChangedInSpinBox( double ) ) );
+
+  connect( myGeomGUI, SIGNAL( SignalDefaultStepValueChanged( double ) ), this,  SLOT( SetDoubleSpinBoxStep( double ) ) );
+
+  connect( myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged() ),
+          this,  SLOT(SelectionIntoArgument() ) );
+
   
   initName( tr( "GEOM_VERTEX" ) );
   
   ConstructorsClicked( 0 );
 }
 
+//=================================================================================
+// function : SetDoubleSpinBoxStep()
+// purpose  : Double spin box management
+//=================================================================================
+void BasicGUI_PointDlg::SetDoubleSpinBoxStep( double step )
+{
+  GroupOnCurve->SpinBox_DX->setSingleStep(step);
+  GroupXYZ->SpinBox_DX->setSingleStep(step);
+  GroupXYZ->SpinBox_DY->setSingleStep(step);
+  GroupXYZ->SpinBox_DZ->setSingleStep(step);
+  GroupRefPoint->SpinBox_DX->setSingleStep(step);
+  GroupRefPoint->SpinBox_DY->setSingleStep(step);
+  GroupRefPoint->SpinBox_DZ->setSingleStep(step);
+  GroupOnSurface->SpinBox_DX->setSingleStep(step);
+  GroupOnSurface->SpinBox_DY->setSingleStep(step);
+}
+
 
 //=================================================================================
 // function : ConstructorsClicked()
@@ -224,6 +274,8 @@ void BasicGUI_PointDlg::Init()
 //=================================================================================
 void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
 {  
+  globalSelection(); // close local contexts, if any
+
   switch ( constructorId ) {
   case 0:
     {
@@ -231,6 +283,8 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       
       GroupRefPoint->hide();
       GroupOnCurve->hide();
+      GroupLineIntersection->hide();
+      GroupOnSurface->hide();
 
       myCoordGrp->hide();
 
@@ -243,10 +297,12 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument->setText( "" );
       myRefPoint = GEOM::GEOM_Object::_nil();
       
-      globalSelection( GEOM_POINT );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
       
       GroupXYZ->hide();
       GroupOnCurve->hide();
+      GroupLineIntersection->hide();
+      GroupOnSurface->hide();
       
       GroupRefPoint->show();
       
@@ -259,13 +315,53 @@ void BasicGUI_PointDlg::ConstructorsClicked(int constructorId)
       myEditCurrentArgument->setText( "" );
       myEdge = GEOM::GEOM_Object::_nil();
 
-      globalSelection( GEOM_EDGE );
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
 
       GroupXYZ->hide();
       GroupRefPoint->hide();
+      GroupLineIntersection->hide();
+      GroupOnSurface->hide();
 
       GroupOnCurve->show();
       
+      myCoordGrp->show();
+      break;
+    }
+  case 3:
+    {
+      myEditCurrentArgument = GroupLineIntersection->LineEdit1;
+      GroupLineIntersection->LineEdit1->setText( "" );
+      GroupLineIntersection->LineEdit2->setText( "" );
+      myLine1 = GEOM::GEOM_Object::_nil();
+      myLine2 = GEOM::GEOM_Object::_nil();
+
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+
+      GroupXYZ->hide();
+      GroupRefPoint->hide();
+      GroupOnCurve->hide();
+      GroupOnSurface->hide();
+
+      myCoordGrp->hide();
+
+      GroupLineIntersection->show();
+      break;
+    }
+  case 4:
+    {
+      myEditCurrentArgument = GroupOnSurface->LineEdit1;
+      myEditCurrentArgument->setText( "" );
+      myFace = GEOM::GEOM_Object::_nil();
+
+      localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+
+      GroupXYZ->hide();
+      GroupRefPoint->hide();
+      GroupOnCurve->hide();
+      GroupLineIntersection->hide();
+
+      GroupOnSurface->show();
+
       myCoordGrp->show();
       break;
     }
@@ -317,12 +413,13 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
 {
   const int id = getConstructorId();
 
-  if ( ( id == 1 || id == 2 ) && myEditCurrentArgument != 0 ) {
+  if ( ( id == 1 || id == 2 || id == 4 ) && myEditCurrentArgument != 0 )
+  {
     myEditCurrentArgument->setText( "" );
     myX->setText( "" );
     myY->setText( "" );
     myZ->setText( "" );
-    myRefPoint = myEdge = GEOM::GEOM_Object::_nil();
+    myRefPoint = myEdge = myFace = GEOM::GEOM_Object::_nil();
   }
 
   if ( IObjectCount() == 1 ) {
@@ -330,31 +427,48 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
     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 = myGeomGUI->GetShapeReader().GetShape( myGeomGUI->GetGeomGen(), aSelectedObject );
-        if ( aShape.IsNull() )
-          return;
-
-        if ( aShape.ShapeType() != TopAbs_VERTEX ) {
-          TColStd_IndexedMapOfInteger aMap;
-          LightApp_Application* anApp =
-            (LightApp_Application*)(SUIT_Session::session()->activeApplication());
-          anApp->selectionMgr()->GetIndexes( anIO, aMap );
+      QString aName = GEOMBase::GetName(aSelectedObject);
+
+      TopoDS_Shape aShape;
+      if ( GEOMBase::GetShape( aSelectedObject, aShape, TopAbs_SHAPE ) && !aShape.IsNull() ) {
+        TopAbs_ShapeEnum aNeedType = TopAbs_VERTEX;
+        if ( id == 2 || id == 3 )
+          aNeedType = TopAbs_EDGE;
+        else if ( id == 4 )
+          aNeedType = TopAbs_FACE;
+
+        LightApp_SelectionMgr* aSelMgr = myGeomGUI->getApp()->selectionMgr();
+        TColStd_IndexedMapOfInteger aMap;
+        aSelMgr->GetIndexes(firstIObject(), aMap);
+        if ( aMap.Extent() == 1 ) { // Local Selection
+          int anIndex = aMap( 1 );
+          if ( aNeedType == TopAbs_EDGE )
+            aName += QString( ":edge_%1" ).arg( anIndex );
+          else
+            aName += QString( ":vertex_%1" ).arg( anIndex );
+
+         //Find SubShape Object in Father
+         GEOM::GEOM_Object_var aFindedObject = GEOMBase_Helper::findObjectInFather( aSelectedObject, aName );
          
-          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;
+         if ( aFindedObject == GEOM::GEOM_Object::_nil() ) { // Object not found in study
+           GEOM::GEOM_IShapesOperations_var aShapesOp = getGeomEngine()->GetIShapesOperations( getStudyId() );
+           aSelectedObject = aShapesOp->GetSubShape( aSelectedObject, anIndex );
+         }
+         else {
+           aSelectedObject = aFindedObject; // get Object from study
+         }
+        }
+        else { // Global Selection
+          if ( aShape.ShapeType() != aNeedType ) {
+            aSelectedObject = GEOM::GEOM_Object::_nil();
+            aName = "";
+            if ( id == 0 ) return;
           }
-          else
-            return;
         }
+      }
 
+      if ( id == 0 ) {
+        if ( aShape.IsNull() ) return;
         gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
         GroupXYZ->SpinBox_DX->setValue( aPnt.X() );
         GroupXYZ->SpinBox_DY->setValue( aPnt.Y() );
@@ -362,11 +476,26 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
       }
       else if ( id == 1 ) {
         myRefPoint = aSelectedObject;
-        GroupRefPoint->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+        GroupRefPoint->LineEdit1->setText( aName );
       }
       else if ( id == 2 ) {
         myEdge = aSelectedObject;
-        GroupOnCurve->LineEdit1->setText( GEOMBase::GetName( aSelectedObject ) );
+        GroupOnCurve->LineEdit1->setText( aName );
+      }
+      else if ( id == 3 ) {
+        if ( myEditCurrentArgument == GroupLineIntersection->LineEdit1 ) {
+          myLine1 = aSelectedObject;
+          myEditCurrentArgument->setText( aName );
+        }
+        else if ( myEditCurrentArgument == GroupLineIntersection->LineEdit2 ) {
+          myLine2 = aSelectedObject;
+          myEditCurrentArgument->setText( aName );
+        }
+      }
+      else if ( id == 4 )
+      {
+       myFace = aSelectedObject;
+       GroupOnSurface->LineEdit1->setText( aName );
       }
     }
   }
@@ -382,11 +511,13 @@ void BasicGUI_PointDlg::SelectionIntoArgument()
 void BasicGUI_PointDlg::LineEditReturnPressed()
 {
   QLineEdit* send = (QLineEdit*)sender();
-  if ( send == GroupRefPoint->LineEdit1 || send == GroupOnCurve->LineEdit1 )
-    {
-      myEditCurrentArgument = send;
-      GEOMBase_Skeleton::LineEditReturnPressed();
-    }
+  if ( send == GroupRefPoint->LineEdit1         || 
+       send == GroupOnCurve->LineEdit1          ||
+       send == GroupLineIntersection->LineEdit1 || 
+       send == GroupLineIntersection->LineEdit2  ) {
+    myEditCurrentArgument = send;
+    GEOMBase_Skeleton::LineEditReturnPressed();
+  }
 }
 
 
@@ -396,19 +527,41 @@ void BasicGUI_PointDlg::LineEditReturnPressed()
 //=================================================================================
 void BasicGUI_PointDlg::SetEditCurrentArgument()
 {
+  globalSelection(); // close local contexts, if any
+
   QPushButton* send = (QPushButton*)sender();
+  globalSelection( GEOM_POINT ); // to break previous local selection
 
   if ( send == GroupRefPoint->PushButton1 ) {
     GroupRefPoint->LineEdit1->setFocus();
     myEditCurrentArgument = GroupRefPoint->LineEdit1;
     
-    globalSelection( GEOM_POINT );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_VERTEX );
   }
   else if ( send == GroupOnCurve->PushButton1 ) {
     GroupOnCurve->LineEdit1->setFocus();
     myEditCurrentArgument = GroupOnCurve->LineEdit1;
     
-    globalSelection( GEOM_EDGE );
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+  }
+  else if ( send == GroupOnSurface->PushButton1 )
+  {
+    GroupOnSurface->LineEdit1->setFocus();
+    myEditCurrentArgument = GroupOnSurface->LineEdit1;
+
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_FACE );
+  }
+  else if ( send == GroupLineIntersection->PushButton1 ) {
+    GroupLineIntersection->LineEdit1->setFocus();
+    myEditCurrentArgument = GroupLineIntersection->LineEdit1;
+
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
+  }
+  else if ( send == GroupLineIntersection->PushButton2 ) {
+    GroupLineIntersection->LineEdit2->setFocus();
+    myEditCurrentArgument = GroupLineIntersection->LineEdit2;
+
+    localSelection( GEOM::GEOM_Object::_nil(), TopAbs_EDGE );
   }
 }
 
@@ -465,6 +618,27 @@ double BasicGUI_PointDlg::getParameter() const
   return GroupOnCurve->SpinBox_DX->value();
 }
 
+
+//=================================================================================
+// funcion  : getUParameter()
+// purpose  :
+//=================================================================================
+double BasicGUI_PointDlg::getUParameter() const
+{
+  return GroupOnSurface->SpinBox_DX->value();
+}
+
+
+//=================================================================================
+// funcion  : getVParameter()
+// purpose  :
+//=================================================================================
+double BasicGUI_PointDlg::getVParameter() const
+{
+  return GroupOnSurface->SpinBox_DY->value();
+}
+
+
 //=================================================================================
 // function : OnPointSelected
 // purpose  :
@@ -502,6 +676,10 @@ bool BasicGUI_PointDlg::isValid( QString& /*msg*/ )
     return !myRefPoint->_is_nil();
   else if ( id == 2 )
     return !myEdge->_is_nil();
+  else if ( id == 3 )
+    return ( !myLine1->_is_nil() && !myLine2->_is_nil() );
+  else if ( id == 4 )
+    return !myFace->_is_nil();
   return false;
 }
 
@@ -542,11 +720,23 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
       MakePointOnCurve( myEdge, getParameter() );
     res = true;
     break;
+  case 3 :
+    anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
+      MakePointOnLinesIntersection( myLine1, myLine2 );
+    res = true;
+    break;
+  case 4 :
+    anObj = GEOM::GEOM_IBasicOperations::_narrow( getOperation() )->
+      MakePointOnSurface( myFace, getUParameter(), getVParameter() );
+    res = true;
+    break;
   }
   
-  if ( getConstructorId() == 1 || getConstructorId() == 2 ) {
+  if ( getConstructorId() == 1 || getConstructorId() == 2 ||
+       getConstructorId() == 4 ) {
     TopoDS_Shape aShape;
-    if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() && aShape.ShapeType() == TopAbs_VERTEX ) {
+    if ( GEOMBase::GetShape( anObj, aShape ) && !aShape.IsNull() &&
+         aShape.ShapeType() == TopAbs_VERTEX ) {
       gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) );
       myX->setText( QString( "%1" ).arg( aPnt.X() ) );
       myY->setText( QString( "%1" ).arg( aPnt.Y() ) );
@@ -567,10 +757,29 @@ bool BasicGUI_PointDlg::execute( ObjectList& objects )
 }
 
 //=================================================================================
-// function : closeEvent
-// purpose  :
+// function : addSubshapeToStudy
+// purpose  : virtual method to add new SubObjects if local selection
 //=================================================================================
-void BasicGUI_PointDlg::closeEvent( QCloseEvent* e )
+void BasicGUI_PointDlg::addSubshapesToStudy()
 {
-  GEOMBase_Skeleton::closeEvent( e );
+  QMap<QString, GEOM::GEOM_Object_var> objMap;
+
+  switch ( getConstructorId() ) {
+  case 0:
+    break;
+  case 1:
+    objMap[GroupRefPoint->LineEdit1->text()] = myRefPoint;
+    break;
+  case 2:
+    objMap[GroupOnCurve->LineEdit1->text()] = myEdge;
+    break;
+  case 3:
+    objMap[GroupLineIntersection->LineEdit1->text()] = myLine1;
+    objMap[GroupLineIntersection->LineEdit2->text()] = myLine2;
+    break;
+  case 4:
+    objMap[GroupOnSurface->LineEdit1->text()] = myFace;
+    break;
+  }
+  addSubshapesToFather( objMap );
 }