X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FPartSet%2FPartSet_OperationEditLine.cpp;h=5486ffff028ff7ddc4aa93668172e25c2163746d;hb=e53354ef01af8360be76548c42fb15d46a471e0d;hp=f0049b007d46a956a908173655af8fda6266e2f6;hpb=1d7a043abfadf964bf38802e8adb5a4773fec900;p=modules%2Fshaper.git diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index f0049b007..5486ffff0 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -48,9 +48,11 @@ std::list PartSet_OperationEditLine::getSelectionModes(boost::shared_ptr theFeature) +void PartSet_OperationEditLine::init(boost::shared_ptr theFeature, + const std::list& thePresentations) { setFeature(theFeature); + myFeatures = thePresentations; } void PartSet_OperationEditLine::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView) @@ -61,11 +63,11 @@ void PartSet_OperationEditLine::mousePressed(QMouseEvent* theEvent, Handle(V3d_V myCurPoint.setPoint(aPoint); } -void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView, - const std::list& theSelected) +void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView) { if (!(theEvent->buttons() & Qt::LeftButton)) return; + gp_Pnt aPoint = PartSet_Tools::ConvertClickToPoint(theEvent->pos(), theView); if (myCurPoint.myIsInitialized) { @@ -81,14 +83,14 @@ void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_Vie moveLinePoint(feature(), aDeltaX, aDeltaY, LINE_ATTR_START); moveLinePoint(feature(), aDeltaX, aDeltaY, LINE_ATTR_END); - /*std::list::const_iterator anIt = theSelected.begin(), aLast = theSelected.end(); + std::list::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end(); for (; anIt != aLast; anIt++) { boost::shared_ptr aFeature = (*anIt).feature(); - if (!aFeature) + if (!aFeature || aFeature == feature()) continue; moveLinePoint(aFeature, aDeltaX, aDeltaY, LINE_ATTR_START); moveLinePoint(aFeature, aDeltaX, aDeltaY, LINE_ATTR_END); - }*/ + } } myCurPoint.setPoint(aPoint); } @@ -96,28 +98,41 @@ void PartSet_OperationEditLine::mouseMoved(QMouseEvent* theEvent, Handle(V3d_Vie void PartSet_OperationEditLine::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView, const std::list& theSelected) { - boost::shared_ptr aFeature; - if (!theSelected.empty()) - aFeature = theSelected.front().feature(); - - if (aFeature == feature()) - return; + std::list aFeatures = myFeatures; + if (myFeatures.size() == 1) { + boost::shared_ptr aFeature; + if (!theSelected.empty()) + aFeature = theSelected.front().feature(); + + if (aFeature == feature()) + return; - commit(); - if (aFeature) - emit launchOperation(PartSet_OperationEditLine::Type(), aFeature); + commit(); + if (aFeature) + emit launchOperation(PartSet_OperationEditLine::Type(), aFeature); + } + else { + commit(); + std::list::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); + for (; anIt != aLast; anIt++) { + boost::shared_ptr aFeature = (*anIt).feature(); + if (aFeature) + emit featureConstructed(aFeature, FM_Deactivation); + } + } } void PartSet_OperationEditLine::startOperation() { // do nothing in order to do not create a new feature - emit selectionEnabled(false); + emit multiSelectionEnabled(false); myCurPoint.clear(); } void PartSet_OperationEditLine::stopOperation() { - emit selectionEnabled(true); + emit multiSelectionEnabled(true); + myFeatures.clear(); } boost::shared_ptr PartSet_OperationEditLine::createFeature()