From: nds Date: Tue, 20 May 2014 04:46:29 +0000 (+0400) Subject: refs #30 - Sketch base GUI: create, draw lines X-Git-Tag: V_0.2~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c5c4265be515dd6e8ac7681ae50259a93e2bc159;p=modules%2Fshaper.git refs #30 - Sketch base GUI: create, draw lines Do not perform the selection clear/set if only one feature is modified. --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 5214dd6e1..0074285dd 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -195,11 +195,9 @@ void PartSet_Module::onMultiSelectionEnabled(bool theEnabled) aViewer->enableMultiselection(theEnabled); } -void PartSet_Module::onStopSelection(const std::list& theFeatures, const bool isStop, - const bool isToSelect) +void PartSet_Module::onStopSelection(const std::list& theFeatures, const bool isStop) { XGUI_Displayer* aDisplayer = myWorkshop->displayer(); - aDisplayer->StopSelection(theFeatures, isStop, false); if (!isStop) { std::list::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end(); boost::shared_ptr aFeature; @@ -207,8 +205,14 @@ void PartSet_Module::onStopSelection(const std::list& theFeature activateFeature((*anIt).feature(), false); } } - if (isToSelect) - aDisplayer->SetSelected(theFeatures, false); + aDisplayer->StopSelection(theFeatures, isStop, false); + aDisplayer->UpdateViewer(); +} + +void PartSet_Module::onSetSelection(const std::list& theFeatures) +{ + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + aDisplayer->SetSelected(theFeatures, false); aDisplayer->UpdateViewer(); } @@ -269,8 +273,10 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), this, SLOT(onMultiSelectionEnabled(bool))); - connect(aPreviewOp, SIGNAL(stopSelection(const std::list&, const bool, const bool)), - this, SLOT(onStopSelection(const std::list&, const bool, const bool))); + connect(aPreviewOp, SIGNAL(stopSelection(const std::list&, const bool)), + this, SLOT(onStopSelection(const std::list&, const bool))); + connect(aPreviewOp, SIGNAL(setSelection(const std::list&)), + this, SLOT(onSetSelection(const std::list&))); PartSet_OperationSketch* aSketchOp = dynamic_cast(aPreviewOp); if (aSketchOp) { diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index bfb57de78..7078a1253 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -95,9 +95,11 @@ public slots: /// SLOT, to stop or start selection mode for the features /// \param theFeatures a list of features to be disabled /// \param theToStop the boolean state whether it it stopped or non stopped - /// \param isToSelect the boolean state whether the features should be selected - void onStopSelection(const std::list& theFeatures, const bool isStop, - const bool isToSelect); + void onStopSelection(const std::list& theFeatures, const bool isStop); + + /// SLOT, to set selection + /// \param theFeatures a list of features to be selected + void onSetSelection(const std::list& theFeatures); /// SLOT, to visualize the feature in another local context mode /// \param theFeature the feature to be put in another local context mode diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index 941195a56..f482cabef 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -119,7 +119,8 @@ void PartSet_OperationEditLine::startOperation() { // do nothing in order to do not create a new feature emit multiSelectionEnabled(false); - emit stopSelection(myFeatures, true, false); + emit setSelection(std::list()); + emit stopSelection(myFeatures, true); myCurPoint.clear(); } @@ -127,7 +128,10 @@ void PartSet_OperationEditLine::stopOperation() { emit multiSelectionEnabled(true); bool isSelectFeatures = myFeatures.size() > 1; - emit stopSelection(myFeatures, false, isSelectFeatures); + emit stopSelection(myFeatures, false); + if (isSelectFeatures) + emit setSelection(myFeatures); + myFeatures.clear(); } diff --git a/src/PartSet/PartSet_OperationSketchBase.h b/src/PartSet/PartSet_OperationSketchBase.h index d8154f86c..4fd20d515 100644 --- a/src/PartSet/PartSet_OperationSketchBase.h +++ b/src/PartSet/PartSet_OperationSketchBase.h @@ -103,9 +103,10 @@ signals: /// signal to enable/disable selection in the viewer /// \param theFeatures a list of features to be disabled /// \param theToStop the boolean state whether it it stopped or non stopped - /// \param isToSelect the boolean state whether the features should be selected - void stopSelection(const std::list& theFeatures, const bool theToStop, - const bool isToSelect); + void stopSelection(const std::list& theFeatures, const bool theToStop); + /// signal to set selection in the viewer + /// \param theFeatures a list of features to be disabled + void setSelection(const std::list& theFeatures); /// signal to enable/disable usual selection in the viewer /// \param theEnabled the boolean state