Salome HOME
Merge from BR_OPENCV
[modules/geom.git] / src / EntityGUI / EntityGUI_SketcherDlg.cxx
index c2b167b9890cb878f17c89de934404efa5966f9a..27604981e15383083916dec23ca9ecec26e23307 100644 (file)
@@ -28,6 +28,9 @@
 #include "EntityGUI_Widgets.h"
 #include <SalomeApp_DoubleSpinBox.h>
 
+#include <OCCViewer_ViewPort3d.h>
+#include <OCCViewer_ViewWindow.h>
+
 #include <GEOMBase.h>
 #include <GeometryGUI.h>
 #include <GEOMImpl_Types.hxx>
@@ -1525,6 +1528,10 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con
 {
   MESSAGE("EntityGUI_SketcherDlg::OnPointSelected")
   
+  SUIT_ViewWindow*       theViewWindow  = getDesktop()->activeWindow();
+  OCCViewer_ViewPort3d*  vp             = ((OCCViewer_ViewWindow*)theViewWindow)->getViewPort();
+  QString                theImgFileName = vp->backgroundImageFilename();
+  
   double x, y;
   x = y = 0;
   
@@ -1542,8 +1549,8 @@ void EntityGUI_SketcherDlg::OnPointSelected(Qt::KeyboardModifiers modifiers, con
   gp_Pnt aTrsfPnt; 
   GEOMBase::VertexToPoint( aShape, aTrsfPnt );
   
-  autoApply = ( getPnt2ConstructorId() == 1 && false );  // If no additional argument needed after selection
-                                                         // -> apply automatically --> disabled for now
+  autoApply = ( (getPnt2ConstructorId() == 1) && (!theImgFileName.isEmpty()) );  // If no additional argument needed after selection and there is a backgroundimage
+                                                                                 // -> apply automatically 
   
   if ( getPnt1ConstructorId() == 0 ){                    // Relative selection mode
     x = aTrsfPnt.X() - myLastX1;