Fix for the 0052398: TC7.4.0: fatal error during redo in the "3D Sketch

Construction" dialog issue.
This commit is contained in:
rnv 2014-04-18 18:05:27 +04:00
parent 355ff3350f
commit 1dbd8cb223
2 changed files with 20 additions and 3 deletions

View File

@ -219,7 +219,8 @@ EntityGUI_3DSketcherDlg::EntityGUI_3DSketcherDlg (GeometryGUI* theGeometryGUI, Q
myOK(false), myOK(false),
myLineWidth(lineWidth), myLineWidth(lineWidth),
myGeometryGUI(theGeometryGUI), myGeometryGUI(theGeometryGUI),
myLengthIORedoList() myLengthIORedoList(),
myIsUndoRedo(false)
{ {
QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT"))); QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_SELECT")));
QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_UNDO"))); QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM", tr("ICON_DLG_UNDO")));
@ -615,6 +616,7 @@ void EntityGUI_3DSketcherDlg::UpdatePointCoordinates()
//================================================================================= //=================================================================================
void EntityGUI_3DSketcherDlg::ClickOnUndo() void EntityGUI_3DSketcherDlg::ClickOnUndo()
{ {
myIsUndoRedo = true;
if (myPointsList.count() > 0) { if (myPointsList.count() > 0) {
myRedoList.append(myPointsList.last()); myRedoList.append(myPointsList.last());
@ -635,6 +637,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo()
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
// Remove last point from list // Remove last point from list
myWorkPoint = myPointsList.last();
myPointsList.removeLast(); myPointsList.removeLast();
GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
UpdateButtonsState(); UpdateButtonsState();
@ -644,6 +647,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo()
updateViewer(); updateViewer();
} }
myIsUndoRedo = false;
} }
//================================================================================= //=================================================================================
@ -652,6 +656,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo()
//================================================================================= //=================================================================================
void EntityGUI_3DSketcherDlg::ClickOnRedo() void EntityGUI_3DSketcherDlg::ClickOnRedo()
{ {
myIsUndoRedo = true;
if (myRedoList.count() > 0) { if (myRedoList.count() > 0) {
myPointsList.append(myRedoList.last()); myPointsList.append(myRedoList.last());
@ -672,6 +677,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo()
((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs);
// Remove last point from redo list // Remove last point from redo list
myWorkPoint = myRedoList.last();
myRedoList.removeLast(); myRedoList.removeLast();
GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth);
UpdateButtonsState(); UpdateButtonsState();
@ -681,6 +687,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo()
updateViewer(); updateViewer();
} }
myIsUndoRedo = false;
} }
//================================================================================= //=================================================================================
@ -1242,7 +1249,13 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const
bool twoAngles = GroupAngles->checkBox->isChecked(); bool twoAngles = GroupAngles->checkBox->isChecked();
XYZ Last = getLastPoint(); XYZ Last = getLastPoint();
XYZ Current = getCurrentPoint(); XYZ Current;
if( myIsUndoRedo ) {
Current = myWorkPoint;
} else {
Current = getCurrentPoint();
}
XYZ Penultimate = getPenultimatePoint(); XYZ Penultimate = getPenultimatePoint();
gp_Pnt P1 = gp_Pnt(Last.x,Last.y,Last.z); gp_Pnt P1 = gp_Pnt(Last.x,Last.y,Last.z);
@ -1303,8 +1316,10 @@ gp_Dir EntityGUI_3DSketcherDlg::getPresentationPlane() const
} }
} }
// If no angles, the plane is the one formed by the last edge and the current one // If no angles, the plane is the one formed by the last edge and the current one
if(Abs(Vec1.CrossMagnitude(Vec2)) > Precision::Confusion()) {
aNormal = gp_Dir(Vec1.Crossed(Vec2)); aNormal = gp_Dir(Vec1.Crossed(Vec2));
} }
}
return aNormal; return aNormal;
} }

View File

@ -178,6 +178,8 @@ private:
SOCC_Prs* myAnglePrs; SOCC_Prs* myAnglePrs;
SOCC_Prs* myLengthPrs; SOCC_Prs* myLengthPrs;
SOCC_Prs* myTextPrs; SOCC_Prs* myTextPrs;
bool myIsUndoRedo;
XYZ myWorkPoint;
private slots: private slots:
void ClickOnOk(); void ClickOnOk();