X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FEntityGUI%2FEntityGUI_3DSketcherDlg.cxx;h=861d7c5b3fd4edcfdb38d47a9a9a4d99be9587c7;hb=89af3a1499d8a51176776872c43c79808ec95ea0;hp=40a0e5228730111bc198707b9401b4aed2d7f0de;hpb=7d880c6a8262b6d670ed70ee2b9ec25c199a46d4;p=modules%2Fgeom.git diff --git a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx index 40a0e5228..861d7c5b3 100755 --- a/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx +++ b/src/EntityGUI/EntityGUI_3DSketcherDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2014 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -60,14 +60,12 @@ #include #include #include -#include #include #include #include #include #include #include -#if OCC_VERSION_LARGE > 0x06050300 #include #include #include @@ -75,7 +73,6 @@ #include #include #include -#endif // OCC_VERSION_LARGE > 0x06050300 // This include must be *AFTER* SOCC_ViewModel.h because // of the constant ROTATE which is a #define in @@ -103,7 +100,6 @@ private: bool& myLock; }; -#if OCC_VERSION_LARGE > 0x06050300 DEFINE_STANDARD_HANDLE(AIS_Text, AIS_InteractiveObject) class AIS_Text:public AIS_InteractiveObject @@ -197,7 +193,6 @@ void AIS_Text::Compute(const Handle(PrsMgr_PresentationManager3d)& aPresentation asp->Aspect()->SetTextFontAspect(aFontAspect); Prs3d_Text::Draw(aPresentation, asp, aText, aPosition); }; -#endif // OCC_VERSION_LARGE > 0x06050300 bool isSame (double d1, double d2) { @@ -219,7 +214,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"))); @@ -329,11 +325,9 @@ void EntityGUI_3DSketcherDlg::Init() SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); myAnglePrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); myLengthPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); -#if OCC_VERSION_LARGE > 0x06050300 myTextPrs = dynamic_cast(((SOCC_Viewer*)(vw->getViewManager()->getViewModel()))->CreatePrs(0)); -#endif // OCC_VERSION_LARGE > 0x06050300 - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); /* Get setting of step value from file configuration */ double step = SUIT_Session::session()->resourceMgr()->doubleValue("Geometry", "SettingsGeomStep", 100.0); @@ -615,6 +609,7 @@ void EntityGUI_3DSketcherDlg::UpdatePointCoordinates() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnUndo() { + myIsUndoRedo = true; if (myPointsList.count() > 0) { myRedoList.append(myPointsList.last()); @@ -635,6 +630,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 +640,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() updateViewer(); } + myIsUndoRedo = false; } //================================================================================= @@ -652,6 +649,7 @@ void EntityGUI_3DSketcherDlg::ClickOnUndo() //================================================================================= void EntityGUI_3DSketcherDlg::ClickOnRedo() { + myIsUndoRedo = true; if (myRedoList.count() > 0) { myPointsList.append(myRedoList.last()); @@ -672,6 +670,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 +680,7 @@ void EntityGUI_3DSketcherDlg::ClickOnRedo() updateViewer(); } + myIsUndoRedo = false; } //================================================================================= @@ -823,7 +823,7 @@ void EntityGUI_3DSketcherDlg::ActivateThisDialog() connect(myGeomGUI->getApp()->selectionMgr(), SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument())); - localSelection(GEOM::GEOM_Object::_nil(), TopAbs_VERTEX); + localSelection(TopAbs_VERTEX); GEOMBase_Helper::displayPreview(true, false, true, true, myLineWidth); } @@ -1242,7 +1242,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 +1309,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; } @@ -1611,7 +1619,6 @@ void EntityGUI_3DSketcherDlg::displayText ( std::string theText, gp_Pnt P, bool store ) { -#if OCC_VERSION_LARGE > 0x06050300 SUIT_ViewWindow* vw = SUIT_Session::session()->activeApplication()->desktop()->activeWindow(); Handle(AIS_Text) anIO = new AIS_Text(TCollection_ExtendedString(theText.c_str()), P); @@ -1638,7 +1645,7 @@ void EntityGUI_3DSketcherDlg::displayText ( std::string theText, GEOMBase_Helper::displayPreview(aSPrs, true, true); } } -#endif // OCC_VERSION_LARGE > 0x06050300 + } //================================================================ @@ -1699,7 +1706,7 @@ Handle(AIS_AngleDimension) EntityGUI_3DSketcherDlg::createAISAngleDimension(doub Handle(AIS_AngleDimension) anIO = new AIS_AngleDimension( P1, P0, P2 ); - anIO->SetCustomValue( theAngle ); + //anIO->SetCustomValue( theAngle ); SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr(); int w = resMgr->integerValue( "Geometry", "measures_line_width", 1 );