]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #86 : Fix for extrusion operation
authorvsv <vitaly.smetannikov@opencascade.com>
Tue, 29 Jul 2014 13:52:43 +0000 (17:52 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Tue, 29 Jul 2014 13:52:43 +0000 (17:52 +0400)
src/ModuleBase/ModuleBase_WidgetSelector.cpp
src/PartSet/PartSet_Listener.cpp
src/PartSet/PartSet_Module.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h

index 9ad17625a7e4e1e346ac286cf97800c690caaa1d..8cb33574b8183bb175950ce4303c7c2b230a9c11 100644 (file)
@@ -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<ModelAPI_AttributeReference> aRef = 
     boost::dynamic_pointer_cast<ModelAPI_AttributeReference>(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();
     }
   }
index 0f60b0c80bd0077e0216ba291ebd458a0da48cdb..de53456660b728d22b1c3f213e8d4803aec1971b 100644 (file)
@@ -53,7 +53,7 @@ void PartSet_Listener::processEvent(const Events_Message* theMessage)
     std::set<ObjectPtr > aFeatures = aUpdMsg->objects();
     std::set<ObjectPtr >::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<ModelAPI_Feature>(*anIt);
       if (aFeature)
         myModule->activateFeature(aFeature, false);
index 8ceabc22eb944ac2ed90eddebe7661d874bec4a8..664346205879900d16ea51ed29fe2543222b45ed 100644 (file)
@@ -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<ResultPtr> aResults = aFeature->results();
+    std::list<ResultPtr>::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<ResultPtr> aResults = aFeature->results();
+    std::list<ResultPtr>::const_iterator aIt;
+    for (aIt = aResults.cbegin(); aIt != aResults.cend(); ++aIt) {
+      aDisplayer->deactivate(*aIt);
+    }
   }
   sendOperation(anOperation);
   myWorkshop->actionsMgr()->updateCheckState();
index f51afd3a9f7d435710212174467574bdc2d1a13f..bc349421974a2661d0e9e0dd8ed8959b63652773 100644 (file)
@@ -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<GeomAPI_AISObject> anObj = myResult2AISObjectMap[theObject];
+     Handle(AIS_InteractiveObject) anAIS = anObj->impl<Handle(AIS_InteractiveObject)>();
+     aContext->Activate(anAIS);
+  }
+}
+
 void XGUI_Displayer::stopSelection(const QList<ObjectPtr>& theResults, const bool isStop,
                                    const bool isUpdateViewer)
 {
index af80496e1911dad066b078c9f2568db786e9b4af..ebbfad740e3d8af48abea97a51b512ed638236f8 100644 (file)
@@ -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