From: nds Date: Thu, 8 May 2014 13:31:29 +0000 (+0400) Subject: Switch off multi selection during line edit operation. X-Git-Tag: V_0.2~78^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b200f5e5b34f6a3fe603e7769bdc3046975653c3;p=modules%2Fshaper.git Switch off multi selection during line edit operation. --- diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 0939b57fe..82321d023 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -120,6 +120,8 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) if (!theOperation) return; PartSet_OperationSketchBase* aPreviewOp = dynamic_cast(theOperation); + if (aPreviewOp) { + } } void PartSet_Module::onSelectionChanged() @@ -209,6 +211,12 @@ void PartSet_Module::onLaunchOperation(std::string theName, boost::shared_ptrviewer(); + aViewer->enableMultiselection(theEnabled); +} + void PartSet_Module::onFeatureConstructed(boost::shared_ptr theFeature, int theMode) { @@ -257,6 +265,8 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI this, SLOT(onFeatureConstructed(boost::shared_ptr, int))); connect(aPreviewOp, SIGNAL(launchOperation(std::string, boost::shared_ptr)), this, SLOT(onLaunchOperation(std::string, boost::shared_ptr))); + connect(aPreviewOp, SIGNAL(multiSelectionEnabled(bool)), + this, SLOT(onMultiSelectionEnabled(bool))); PartSet_OperationSketch* aSketchOp = dynamic_cast(aPreviewOp); if (aSketchOp) { @@ -264,6 +274,7 @@ ModuleBase_Operation* PartSet_Module::createOperation(const std::string& theCmdI this, SLOT(onPlaneSelected(double, double, double))); } } + return anOperation; } diff --git a/src/PartSet/PartSet_Module.h b/src/PartSet/PartSet_Module.h index 03207f252..75dbd3063 100644 --- a/src/PartSet/PartSet_Module.h +++ b/src/PartSet/PartSet_Module.h @@ -46,8 +46,8 @@ public: public slots: void onFeatureTriggered(); - /// SLOT, that is called after the operation is stopped. Disconnect the sketch feature - /// from the viewer selection and show the sketch preview. + /// SLOT, that is called after the operation is stopped. Switched off the modfications performed + /// by the operation start void onOperationStopped(ModuleBase_Operation* theOperation); /// SLOT, that is called by the selection in the viewer is changed. @@ -78,6 +78,10 @@ public slots: void onLaunchOperation(std::string theName, boost::shared_ptr theFeature); + /// SLOT, to switch on/off the multi selection in the viewer + /// \param theEnabled the enabled state + void onMultiSelectionEnabled(bool theEnabled); + /// SLOT, to visualize the feature in another local context mode /// \param theFeature the feature to be put in another local context mode /// \param theMode the mode appeared on the feature diff --git a/src/PartSet/PartSet_OperationEditLine.cpp b/src/PartSet/PartSet_OperationEditLine.cpp index 46f3b4056..92ae140d2 100644 --- a/src/PartSet/PartSet_OperationEditLine.cpp +++ b/src/PartSet/PartSet_OperationEditLine.cpp @@ -94,6 +94,12 @@ void PartSet_OperationEditLine::setSelected(boost::shared_ptr void PartSet_OperationEditLine::startOperation() { // do nothing in order to do not create a new feature + emit multiSelectionEnabled(false); +} + +void PartSet_OperationEditLine::stopOperation() +{ + emit multiSelectionEnabled(true); } boost::shared_ptr PartSet_OperationEditLine::createFeature() diff --git a/src/PartSet/PartSet_OperationEditLine.h b/src/PartSet/PartSet_OperationEditLine.h index 01a705386..646416f91 100644 --- a/src/PartSet/PartSet_OperationEditLine.h +++ b/src/PartSet/PartSet_OperationEditLine.h @@ -64,9 +64,13 @@ public: protected: /// \brief Virtual method called when operation is started /// Virtual method called when operation started (see start() method for more description) - /// After the parent operation body perform, set sketch feature to the created line feature + /// Switch off the multi selection state virtual void startOperation(); + /// Virtual method called when operation stopped - committed or aborted. + /// Restore the multi selection state + virtual void stopOperation(); + /// Creates an operation new feature /// Returns NULL feature. This is an operation of edition, not creation. /// \returns the created feature diff --git a/src/PartSet/PartSet_OperationSketch.cpp b/src/PartSet/PartSet_OperationSketch.cpp index 46b0c4ca2..b07fd0dff 100644 --- a/src/PartSet/PartSet_OperationSketch.cpp +++ b/src/PartSet/PartSet_OperationSketch.cpp @@ -60,6 +60,9 @@ void PartSet_OperationSketch::setSelected(boost::shared_ptr th void PartSet_OperationSketch::setSketchPlane(const TopoDS_Shape& theShape) { + if (theShape.IsNull()) + return; + // get selected shape boost::shared_ptr aGShape(new GeomAPI_Shape); aGShape->setImpl(new TopoDS_Shape(theShape)); diff --git a/src/PartSet/PartSet_OperationSketchBase.h b/src/PartSet/PartSet_OperationSketchBase.h index 45a6b77d4..0fce89ea6 100644 --- a/src/PartSet/PartSet_OperationSketchBase.h +++ b/src/PartSet/PartSet_OperationSketchBase.h @@ -86,6 +86,9 @@ signals: /// theName the operation name /// theFeature the operation argument void launchOperation(std::string theName, boost::shared_ptr theFeature); + /// signal to enable/disable multi selection in the viewer + /// \param theEnabled the boolean state + void multiSelectionEnabled(bool theEnabled); protected: /// Creates an operation new feature