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),
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,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(Abs(Vec1.CrossMagnitude(Vec2)) > Precision::Confusion()) {
aNormal = gp_Dir(Vec1.Crossed(Vec2));
}
}
return aNormal;
}

View File

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