From: vsv Date: Tue, 29 Jul 2014 13:52:43 +0000 (+0400) Subject: Issue #86 : Fix for extrusion operation X-Git-Tag: V_0.4.4~131 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=70f48483fd6aa9c615acc429902c0935ae3b94ae;p=modules%2Fshaper.git Issue #86 : Fix for extrusion operation --- diff --git a/src/ModuleBase/ModuleBase_WidgetSelector.cpp b/src/ModuleBase/ModuleBase_WidgetSelector.cpp index 9ad17625a..8cb33574b 100644 --- a/src/ModuleBase/ModuleBase_WidgetSelector.cpp +++ b/src/ModuleBase/ModuleBase_WidgetSelector.cpp @@ -104,6 +104,10 @@ ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector() //******************************************************************** bool ModuleBase_WidgetSelector::storeValue(ObjectPtr theObject) const { + FeaturePtr aSelectedFeature = ModuleBase_Tools::feature(mySelectedObject); + if (aSelectedFeature == theObject) // In order to avoid selection of the same object + return false; + DataPtr aData = theObject->data(); boost::shared_ptr aRef = boost::dynamic_pointer_cast(aData->attribute(attributeID())); @@ -157,7 +161,7 @@ void ModuleBase_WidgetSelector::onSelectionChanged() mySelectedObject = aObject; if (mySelectedObject) { updateSelectionName(); - activateSelection(false); + myActivateBtn->setChecked(false); raisePanel(); } else { myTextLine->setText(""); @@ -207,7 +211,7 @@ bool ModuleBase_WidgetSelector::eventFilter(QObject* theObj, QEvent* theEvent) { if (theObj == myTextLine) { if (theEvent->type() == QEvent::Polish) { - activateSelection(myActivateOnStart); + myActivateBtn->setChecked(myActivateOnStart); onSelectionChanged(); } } diff --git a/src/PartSet/PartSet_Listener.cpp b/src/PartSet/PartSet_Listener.cpp index 0f60b0c80..de5345666 100644 --- a/src/PartSet/PartSet_Listener.cpp +++ b/src/PartSet/PartSet_Listener.cpp @@ -53,7 +53,7 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage) std::set aFeatures = aUpdMsg->objects(); std::set::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end(); for (; anIt != aLast; anIt++) { - aDisplayer->deactivate(*anIt, false); + aDisplayer->deactivate(*anIt); FeaturePtr aFeature = boost::dynamic_pointer_cast(*anIt); if (aFeature) myModule->activateFeature(aFeature, false); diff --git a/src/PartSet/PartSet_Module.cpp b/src/PartSet/PartSet_Module.cpp index 8ceabc22e..664346205 100644 --- a/src/PartSet/PartSet_Module.cpp +++ b/src/PartSet/PartSet_Module.cpp @@ -188,6 +188,15 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation) XGUI_PropertyPanel* aPropPanel = myWorkshop->propertyPanel(); //disconnect(aPropPanel, SIGNAL(storedPoint2D(ObjectPtr, const std::string&)), // this, SLOT(onStorePoint2D(ObjectPtr, const std::string&))); + } else { + // Activate results of current feature for selection + FeaturePtr aFeature = theOperation->feature(); + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { + aDisplayer->activate(*aIt); + } } } @@ -294,6 +303,13 @@ void PartSet_Module::onLaunchOperation(std::string theName, ObjectPtr theObject) aPreviewOp->initSelection(aSelected, aHighlighted); } else { anOperation->setEditingFeature(aFeature); + //Deactivate result of current feature in order to avoid its selection + XGUI_Displayer* aDisplayer = myWorkshop->displayer(); + std::list aResults = aFeature->results(); + std::list::const_iterator aIt; + for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) { + aDisplayer->deactivate(*aIt); + } } sendOperation(anOperation); myWorkshop->actionsMgr()->updateCheckState(); diff --git a/src/XGUI/XGUI_Displayer.cpp b/src/XGUI/XGUI_Displayer.cpp index f51afd3a9..bc3494219 100644 --- a/src/XGUI/XGUI_Displayer.cpp +++ b/src/XGUI/XGUI_Displayer.cpp @@ -197,7 +197,7 @@ void XGUI_Displayer::activateInLocalContext(ObjectPtr theResult, updateViewer(); } -void XGUI_Displayer::deactivate(ObjectPtr theObject, bool toUpdate) +void XGUI_Displayer::deactivate(ObjectPtr theObject) { if (isVisible(theObject)) { Handle(AIS_InteractiveContext) aContext = AISContext(); @@ -208,6 +208,17 @@ void XGUI_Displayer::deactivate(ObjectPtr theObject, bool toUpdate) } } +void XGUI_Displayer::activate(ObjectPtr theObject) +{ + if (isVisible(theObject)) { + Handle(AIS_InteractiveContext) aContext = AISContext(); + + boost::shared_ptr anObj = myResult2AISObjectMap[theObject]; + Handle(AIS_InteractiveObject) anAIS = anObj->impl(); + aContext->Activate(anAIS); + } +} + void XGUI_Displayer::stopSelection(const QList& theResults, const bool isStop, const bool isUpdateViewer) { diff --git a/src/XGUI/XGUI_Displayer.h b/src/XGUI/XGUI_Displayer.h index af80496e1..ebbfad740 100644 --- a/src/XGUI/XGUI_Displayer.h +++ b/src/XGUI/XGUI_Displayer.h @@ -120,7 +120,9 @@ public: /// \return feature the feature or NULL if it not visualized ObjectPtr getObject(Handle(AIS_InteractiveObject) theIO) const; - void deactivate(ObjectPtr theFeature, bool toUpdate); + void deactivate(ObjectPtr theFeature); + + void activate(ObjectPtr theFeature); protected: /// Deactivate local selection