X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationFeatureBase.cpp;h=6beb71ca409f2489b5d150de498434d5c0623600;hb=0906e8d8425cb17be2861a710051e0b1f1e231c2;hp=9955fa5f05a9eefd10a419b6c013c83b66c0df61;hpb=a6b5300a8b356e933d4778d93bb78f3cc9d7b9cb;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationFeatureBase.cpp b/src/PartSet/PartSet_OperationFeatureBase.cpp index 9955fa5f0..6beb71ca4 100644 --- a/src/PartSet/PartSet_OperationFeatureBase.cpp +++ b/src/PartSet/PartSet_OperationFeatureBase.cpp @@ -25,6 +25,8 @@ #include #include #include "ModuleBase_IPropertyPanel.h" +#include "ModuleBase_ISelection.h" +#include "ModuleBase_IViewer.h" #include @@ -59,35 +61,36 @@ CompositeFeaturePtr PartSet_OperationFeatureBase::sketch() const return mySketch; } -void PartSet_OperationFeatureBase::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView, - const std::list& theSelected, - const std::list& /*theHighlighted*/) +void PartSet_OperationFeatureBase::mouseReleased(QMouseEvent* theEvent, ModuleBase_IViewer* theViewer, + ModuleBase_ISelection* theSelection) { - gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), theView); + Handle(V3d_View) aView = theViewer->activeView(); + gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(theEvent->pos(), aView); double aX = aPoint.X(), anY = aPoint.Y(); + QList aSelected = theSelection->getSelected(); - if (theSelected.empty()) { - PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); + if (aSelected.empty()) { + PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY); } else { - ModuleBase_ViewerPrs aPrs = theSelected.front(); + ModuleBase_ViewerPrs aPrs = aSelected.first(); const TopoDS_Shape& aShape = aPrs.shape(); if (!aShape.IsNull()) { if (aShape.ShapeType() == TopAbs_VERTEX) { // a point is selected const TopoDS_Vertex& aVertex = TopoDS::Vertex(aShape); if (!aVertex.IsNull()) { aPoint = BRep_Tool::Pnt(aVertex); - PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); + PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY); ModuleBase_ModelWidget* aActiveWgt = myPropertyPanel->activeWidget(); PartSet_Tools::setConstraints(sketch(), feature(), aActiveWgt->attributeID(), aX, anY); } } else if (aShape.ShapeType() == TopAbs_EDGE) { // a line is selected - PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY); + PartSet_Tools::convertTo2D(aPoint, sketch(), aView, aX, anY); } } } ObjectPtr aFeature; - if (!theSelected.empty()) { - ModuleBase_ViewerPrs aPrs = theSelected.front(); + if (!aSelected.empty()) { + ModuleBase_ViewerPrs aPrs = aSelected.first(); aFeature = aPrs.object(); } else { aFeature = feature(); // for the widget distance only @@ -98,7 +101,13 @@ void PartSet_OperationFeatureBase::mouseReleased(QMouseEvent* theEvent, Handle(V flushUpdated(); myPropertyPanel->activateNextWidget(); } - commit(); + // the operation can be committed only when there is no an active widget anymore + // if this check is absent, the edit operation for constraint perpendicular is stopped + // after the first object selection in the viewer(there are two objects to be selected) + // the second case is the constraint distance, the edit is stopped after any mouse click + // in the viewer whenever it is applyed or not to the selection control + if (!myPropertyPanel->activeWidget()) + commit(); } /*bool PartSet_OperationFeatureBase::setWidgetValue(ObjectPtr theFeature, double theX, double theY)