]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
#1108 Point coordinates is changed after click in the viewer
authornds <nds@opencascade.com>
Tue, 1 Dec 2015 12:21:09 +0000 (15:21 +0300)
committerdbv <dbv@opencascade.com>
Tue, 8 Dec 2015 08:48:38 +0000 (11:48 +0300)
The problem was in myClickedPoint, it was not cleared and after click, the new line used the old clicked coordinates. The point and coincide last point of the previous line are moved to a start point of a new line.
There is a problem with this flag during Alt+TAB when creation of a line is active.
So, the decision is to remove this flag. The case to be checked: contour creation. The preview of created lines should not dragged to an origin. How it is corrected: point 2D widget do not initialize attribute by activating.

src/PartSet/PartSet_SketcherMgr.cpp
src/PartSet/PartSet_SketcherMgr.h
src/PartSet/PartSet_WidgetPoint2d.cpp
src/PartSet/PartSet_WidgetPoint2d.h

index eddf4b07eb0afb9e2f5d3048ec5bdc18b566b272..a90f4a0f8aca8d201aae48aefc8ded020b247d63 100755 (executable)
@@ -323,7 +323,7 @@ void PartSet_SketcherMgr::onMousePressed(ModuleBase_IViewWindow* theWnd, QMouseE
   if (myModule->sketchReentranceMgr()->processMousePressed(theWnd, theEvent))
     return;
 
-  get2dPoint(theWnd, theEvent, myClickedPoint);
+  //get2dPoint(theWnd, theEvent, myClickedPoint);
 
   if (!(theEvent->buttons() & Qt::LeftButton))
     return;
@@ -435,7 +435,7 @@ void PartSet_SketcherMgr::onMouseReleased(ModuleBase_IViewWindow* theWnd, QMouse
   ModuleBase_Operation* aOp = getCurrentOperation();
   if (aOp) {
     if (isNestedSketchOperation(aOp)) {
-      get2dPoint(theWnd, theEvent, myClickedPoint);
+      //get2dPoint(theWnd, theEvent, myClickedPoint);
 
       // Only for sketcher operations
       if (myIsDragging) {
@@ -491,7 +491,7 @@ void PartSet_SketcherMgr::onMouseMoved(ModuleBase_IViewWindow* theWnd, QMouseEve
     }
   }
 
-  myClickedPoint.clear();
+  //myClickedPoint.clear();
 
   if (myIsDragging) {
     // 1. the current selection is saved in the mouse press method in order to restore it after moving
@@ -619,8 +619,8 @@ void PartSet_SketcherMgr::onApplicationStarted()
 
   XGUI_PropertyPanel* aPropertyPanel = aWorkshop->propertyPanel();
   if (aPropertyPanel) {
-    connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)),
-            this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*)));
+    //connect(aPropertyPanel, SIGNAL(beforeWidgetActivated(ModuleBase_ModelWidget*)),
+    //        this, SLOT(onBeforeWidgetActivated(ModuleBase_ModelWidget*)));
 
     connect(aPropertyPanel, SIGNAL(noMoreWidgets(const std::string&)),
             aReentranceMgr, SLOT(onNoMoreWidgets(const std::string&)));
@@ -637,23 +637,23 @@ void PartSet_SketcherMgr::onApplicationStarted()
   connect(aContextMenuMgr, SIGNAL(afterContextMenu()), this, SLOT(onAfterContextMenu()));
 }
 
-void PartSet_SketcherMgr::onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget)
-{
-  if (!myClickedPoint.myIsInitialized)
-    return;
+//void PartSet_SketcherMgr::onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget)
+//{
+  //if (!myClickedPoint.myIsInitialized)
+  //  return;
 
-  ModuleBase_Operation* aOperation = getCurrentOperation();
+  //ModuleBase_Operation* aOperation = getCurrentOperation();
   // the distance constraint feature should not use the clickedd point
   // this is workaround in order to don't throw down the flyout point value,
   // set by execute() method of these type of features
-  if (isDistanceOperation(aOperation))
-    return;
+  //if (isDistanceOperation(aOperation))
+  //  return;
 
-  PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(theWidget);
-  if (aPnt2dWgt) {
-    aPnt2dWgt->setPoint(myClickedPoint.myCurX, myClickedPoint.myCurY);
-  }
-}
+  //PartSet_WidgetPoint2D* aPnt2dWgt = dynamic_cast<PartSet_WidgetPoint2D*>(theWidget);
+  //if (aPnt2dWgt) {
+  //  aPnt2dWgt->setPoint(myClickedPoint.myCurX, myClickedPoint.myCurY);
+  //}
+//}
 
 void PartSet_SketcherMgr::onBeforeContextMenu()
 {
@@ -714,8 +714,7 @@ QString PartSet_SketcherMgr::getFeatureError(const FeaturePtr& theFeature)
 
 void PartSet_SketcherMgr::clearClickedFlags()
 {
-  return;
-  myClickedPoint.clear();
+  //myClickedPoint.clear();
   myCurrentPoint.clear();
 }
 
index 284d2b31602c5626332d14b5420a6ebfd1265fe5..5d31e7d4a1c3adebeac65e9e2ff16bf66bfde58f 100644 (file)
@@ -237,7 +237,7 @@ private slots:
   void onMouseMoved(ModuleBase_IViewWindow*, QMouseEvent*);
   void onMouseDoubleClick(ModuleBase_IViewWindow*, QMouseEvent*);
   void onApplicationStarted();
-  void onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
+  //void onBeforeWidgetActivated(ModuleBase_ModelWidget* theWidget);
 
   void onBeforeContextMenu();
   void onAfterContextMenu();
@@ -317,7 +317,7 @@ private:
   bool myIsMouseOverViewProcessed; /// the state whether the over view state is processed by mouseMove method
   bool myIsPopupMenuActive; /// the state of the popup menu is shown
   Point myCurrentPoint;
-  Point myClickedPoint;
+  //Point myClickedPoint;
 
   CompositeFeaturePtr myCurrentSketch;
 
index 6e78ed9d7c39d8c7c5b4403415b7c5e5b1e6a1f6..b10dd41cfef12985d6b9b7a1f00cec1ee10cb175 100644 (file)
@@ -496,6 +496,10 @@ bool PartSet_WidgetPoint2D::isFeatureContainsPoint(const FeaturePtr& theFeature,
   return aPointIsFound;
 }
 
+void PartSet_WidgetPoint2D::initializeValueByActivate()
+{
+}
+
 /*void PartSet_WidgetPoint2D::onValuesChanged()
 {
   emit valuesChanged();
index c1b0d0576c8609c9c6232e55b580bf81eb42d7ad..e32cf72c190530d98a6ba3b55c395338e3f596f3 100755 (executable)
@@ -134,6 +134,13 @@ protected:
   /// Process value changed event
   //void onValuesChanged();
 
+  /// Compute the feature default value and fill the controls with it
+  /// or store the control value to the feature
+  /// The widget is not initialize the attribute value in order to avoid the 
+  /// incorrect visualization in Sketch. E.g. by a line creation, the line should not
+  /// be visualized immediatelly when the end point widget is activated.
+  virtual void initializeValueByActivate();
+
  private:
    /// Returns point 2d from selected vertex
    /// \param theView a view window