From: rnv Date: Fri, 18 Apr 2014 14:05:27 +0000 (+0400) Subject: Fix for the 0052398: TC7.4.0: fatal error during redo in the "3D Sketch X-Git-Tag: V7_4_0rc1~14 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=1dbd8cb223da9c2ab30e5fc12555b94e18dbbc11;p=modules%2Fgeom.git Fix for the 0052398: TC7.4.0: fatal error during redo in the "3D Sketch Construction" dialog issue. --- diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 40a0e5228..609b7e8a3 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -219,7 +219,8 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg (GeometryGUI* theGeometryGUI, Q myOK(false), myLineWidth(lineWidth), myGeometryGUI(theGeometryGUI), - myLengthIORedoList() + myLengthIORedoList(), + myIsUndoRedo(false) { QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_UNDO"))); @@ -615,6 +616,7 @@ void EntityGUI_3DSketcherDlg::UpdatePointCoordinates() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnUndo() { + myIsUndoRedo = true; if (myPointsList.count() > 0) { myRedoList.append(myPointsList.last()); @@ -635,6 +637,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); // Remove last point from list + myWorkPoint = myPointsList.last(); myPointsList.removeLast(); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); UpdateButtonsState(); @@ -644,6 +647,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() updateViewer(); } + myIsUndoRedo = false; } //================================================================================= @@ -652,6 +656,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnRedo() { + myIsUndoRedo = true; if (myRedoList.count() > 0) { myPointsList.append(myRedoList.last()); @@ -672,6 +677,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); // Remove last point from redo list + myWorkPoint = myRedoList.last(); myRedoList.removeLast(); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); UpdateButtonsState(); @@ -681,6 +687,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() updateViewer(); } + myIsUndoRedo = false; } //================================================================================= @@ -1242,7 +1249,13 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const bool twoAngles = GroupAngles->checkBox->isChecked(); XYZ Last = getLastPoint(); - XYZ Current = getCurrentPoint(); + XYZ Current; + if( myIsUndoRedo ) { + Current = myWorkPoint; + } else { + Current = getCurrentPoint(); + } + XYZ Penultimate = getPenultimatePoint(); gp_Pnt P1 = gp_Pnt(Last.x,Last.y,Last.z); @@ -1303,7 +1316,9 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const } } // If no angles, the plane is the one formed by the last edge and the current one - aNormal = gp_Dir(Vec1.Crossed(Vec2)); + if(Abs(Vec1.CrossMagnitude(Vec2)) > Precision::Confusion()) { + aNormal = gp_Dir(Vec1.Crossed(Vec2)); + } } return aNormal; } diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.h b/src/EntityGUI/EntityGUI_3DSketcherDlg.h index 2f4b8f4b7..a60a8063f 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.h +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.h @@ -178,6 +178,8 @@ private: SOCC_Prs* myAnglePrs; SOCC_Prs* myLengthPrs; SOCC_Prs* myTextPrs; + bool myIsUndoRedo; + XYZ myWorkPoint; private slots: void ClickOnOk();