X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationSketch.cpp;h=e5290aa77eb9bc3cbd86ec285cb4b6afdf623019;hb=1d7a043abfadf964bf38802e8adb5a4773fec900;hp=b07fd0dff107d841cc110a82eeb1c8c7891ffca7;hpb=d0a5b5b068f5b1b55095d3b4f9f4fe4da7165b40;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index b07fd0dff..e5290aa77 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -5,21 +5,28 @@ #include #include +#include #include + #include #include #include #include #include +#include + #include #include +#include #ifdef _DEBUG #include #endif +#include + using namespace std; PartSet_OperationSketch::PartSet_OperationSketch(const QString& theId, @@ -44,18 +51,32 @@ std::list PartSet_OperationSketch::getSelectionModes(boost::shared_ptr theFeature, - const TopoDS_Shape& theShape) +void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView, + const std::list& theSelected) { - if (theShape.IsNull()) + if (theSelected.empty()) return; if (!myIsEditMode) { - setSketchPlane(theShape); - myIsEditMode = true; + XGUI_ViewerPrs aPrs = theSelected.front(); + const TopoDS_Shape& aShape = aPrs.shape(); + if (!aShape.IsNull()) { + setSketchPlane(aShape); + myIsEditMode = true; + } } - else if (theFeature) - emit launchOperation(PartSet_OperationEditLine::Type(), theFeature); +} + +void PartSet_OperationSketch::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView, + const std::list& theSelected) +{ + if (!myIsEditMode || !(theEvent->buttons() & Qt::LeftButton) || theSelected.empty()) + return; + + boost::shared_ptr aFeature = PartSet_Tools::NearestFeature(theEvent->pos(), + theView, feature(), theSelected); + if (aFeature) + emit launchOperation(PartSet_OperationEditLine::Type(), aFeature); } void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape) @@ -98,4 +119,3 @@ void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape) boost::shared_ptr aDir = aPlane->direction(); emit planeSelected(aDir->x(), aDir->y(), aDir->z()); } -