From: rnc Date: Mon, 19 Nov 2012 17:58:33 +0000 (+0000) Subject: Small bug fix in undo / redo mechanism of 3d sketcher X-Git-Tag: V6_6_0rc1~4 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d1371cd8250b6758120d738d63d2436fe08ed438;p=modules%2Fgeom.git Small bug fix in undo / redo mechanism of 3d sketcher --- diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 8be419d38..073969747 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -530,6 +530,7 @@ void EntityGUI_3DSketcherDlg::ClickOnAddPoint() myRedoList.clear(); myLengthIORedoList.Clear(); myAngleIORedoList.Clear(); + myTextIORedoList.Clear(); if (myCoordType == 0 && myMode == 1) // RELATIVE CARTESIAN COORDINATES { @@ -622,6 +623,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true); removeLastIOFromPrs(); @@ -630,6 +632,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); if (isAngleVisible) ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); // Remove last point from list myPointsList.removeLast(); @@ -657,6 +660,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myLengthPrs, true); ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myAnglePrs, true); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Erase(myTextPrs, true); restoreLastIOToPrs(); @@ -665,6 +669,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myLengthPrs); if (isAngleVisible) ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myAnglePrs); + ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); // Remove last point from redo list myRedoList.removeLast(); @@ -699,6 +704,12 @@ void EntityGUI_3DSketcherDlg::removeLastIOFromPrs () myAngleIORedoList.Prepend(anIOList.First()); // Store last prepended Angle IO in redo list myAnglePrs->RemoveFirst(); // Remove it from myAnglePrs } + for (int t = 0; tGetObjects(anIOList); + myTextIORedoList.Prepend(anIOList.First()); // Store last prepended Text IO in redo list + myTextPrs->RemoveFirst(); // Remove it from myTextPrs + } } //================================================================================= @@ -719,6 +730,11 @@ void EntityGUI_3DSketcherDlg::restoreLastIOToPrs () myAnglePrs->PrependObject(myAngleIORedoList.First()); // Restore last removed IO myAngleIORedoList.RemoveFirst(); // Remove it from redo list } + for (int t = 0; tPrependObject(myTextIORedoList.First()); // Restore last removed IO + myTextIORedoList.RemoveFirst(); // Remove it from redo list + } } //================================================================================= @@ -1209,6 +1225,7 @@ EntityGUI_3DSketcherDlg::XYZ EntityGUI_3DSketcherDlg::getCurrentPoint() const // Update point presentation type xyz.A = myPrsType.A; // Number of angle diomensions xyz.L = myPrsType.L; // Number of length dimensions + xyz.T = myPrsType.T; // Number of text objects return xyz; } @@ -1463,7 +1480,7 @@ void EntityGUI_3DSketcherDlg::displayDimensions (bool store) displayAngle(anAngle1, P0, P1, P2, store); else { - std::string anAngleText = doubleToString(anAngle1) + "deg"; + std::string anAngleText = doubleToString(anAngle1) + " deg."; displayText(anAngleText, Current_Pnt, store); } @@ -1607,6 +1624,9 @@ void EntityGUI_3DSketcherDlg::displayText ( std::string theText, // Display modified presentation ((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->Display(myTextPrs); + + // Update dimension presentation text count for later undo / redo + myPrsType.T += 1; } else { diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.h b/src/EntityGUI/EntityGUI_3DSketcherDlg.h index 2ea8e6f3f..a4b4d98af 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.h +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.h @@ -58,18 +58,19 @@ class EntityGUI_3DSketcherDlg : public GEOMBase_Skeleton struct XYZ { - XYZ() { x = y = z = 0.0; command = params = ""; L=A=0; } + XYZ() { x = y = z = 0.0; command = params = ""; L=A=T=0; } double x, y, z; // for preview only - int L, A; // for preview only + int L, A, T; // for preview only QString command; QString params; }; struct prsType { - prsType(){L=A=0;} + prsType(){L=A=T=0;} int L; int A; + int T; }; typedef QList XYZList; @@ -154,6 +155,7 @@ private: XYZList myRedoList; AIS_ListOfInteractive myLengthIORedoList; AIS_ListOfInteractive myAngleIORedoList; + AIS_ListOfInteractive myTextIORedoList; prsType myPrsType; EntityGUI_3Spin* Group3Spin;