]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1330 selection lost correction: rectangle, fillet, select a point(the line...
authornds <nds@opencascade.com>
Fri, 26 Feb 2016 16:17:21 +0000 (19:17 +0300)
committernds <nds@opencascade.com>
Fri, 26 Feb 2016 16:17:21 +0000 (19:17 +0300)
The correction: to store/restore selection if the presentation is only customized.

src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_WidgetMultiSelector.cpp
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_SketcherMgr.cpp
src/XGUI/XGUI_Displayer.cpp

index 75a962dad7abdc0608b485fc8273deb31ad0614a..be36fede6b6475fb67ac8ffa5b4cbe4859e9ca2f 100755 (executable)
@@ -57,6 +57,12 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// Remove default selection filters of the module from the current viewer\r
   virtual void deactivateSelectionFilters() {};\r
 \r
+  // Stores the current selection\r
+  virtual void storeSelection() {};\r
+\r
+  // Restores the current selection\r
+  virtual void restoreSelection() {};\r
+\r
   /// Reads description of features from XML file \r
   virtual void createFeatures();\r
 \r
index 6eff484be7836e8349c231ed9037a91af0744193..88062dbad4ed694a79413d567c1ee62c8e1a20b3 100755 (executable)
@@ -335,9 +335,6 @@ bool ModuleBase_WidgetMultiSelector::setSelection(QList<ModuleBase_ViewerPrs>& t
     //emit valuesChanged();
   //}
 
-  /// remove unused objects from the model attribute
-  //removeUnusedAttributeObjects(theValues);
-
   theValues.clear();
   if (!aSkippedValues.empty())
     theValues.append(aSkippedValues);
index f39331b6270ec89594ad50fb38349e03c71d8cbc..e353cb8a48ed53d0535472e9ed05e906b6d0662c 100644 (file)
@@ -352,8 +352,6 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked)
 
     anOpMgr->startOperation(anOpAction);
   }
-  myModule->sketchMgr()->storeSelection();
-
   if (anObjects.size() > 0) {
     QObjectPtrList::const_iterator anIt = anObjects.begin(), aLast = anObjects.end();
     for (; anIt != aLast; anIt++) {
@@ -376,7 +374,6 @@ void PartSet_MenuMgr::setAuxiliary(const bool isChecked)
     anOpMgr->commitOperation();
 
   Events_Loop::loop()->flush(Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
-  myModule->sketchMgr()->restoreSelection();
 }
 
 bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const
index 297e0ef10301456360b785b2d2ef41857c0878f3..a4e5d07a0bf07592b514e1925bfaf80b824c21fa 100755 (executable)
@@ -193,6 +193,16 @@ void PartSet_Module::deactivateSelectionFilters()
   }
 }
 
+void PartSet_Module::storeSelection()
+{
+  sketchMgr()->storeSelection();
+}
+
+void PartSet_Module::restoreSelection()
+{
+  sketchMgr()->restoreSelection();
+}
+
 void PartSet_Module::registerValidators()
 {
   //Registering of validators
index f6c371f1f13cce9a5b495d52647b5ba2518d5df9..52c677690afe138cbb4ee54a3e4e2bcca63762fc 100755 (executable)
@@ -66,6 +66,12 @@ public:
   // Remove default selection filters of the module from the current viewer
   virtual void deactivateSelectionFilters();
 
+  // Stores the current selection
+  virtual void storeSelection();
+
+  // Restores the current selection
+  virtual void restoreSelection();
+
   /// Creates custom widgets for property panel
   virtual ModuleBase_ModelWidget* createWidgetByType(const std::string& theType, QWidget* theParent,
                                                      Config_WidgetAPI* theWidgetApi, std::string theParentId);
index 4c2b63a6f5f44305823c6c5518be0e9e4faaa240..dcb1a81b57d0dc1990b58e287945e0975e7425d4 100755 (executable)
@@ -1574,6 +1574,9 @@ void PartSet_SketcherMgr::visualizeFeature(const FeaturePtr& theFeature,
 
 void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
 {
+  if (!myCurrentSketch.get())
+    return;
+
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
   ModuleBase_ISelection* aSelect = aWorkshop->selection();
   QList<ModuleBase_ViewerPrs> aHighlighted = aSelect->getHighlighted();
@@ -1600,6 +1603,9 @@ void PartSet_SketcherMgr::storeSelection(const bool theHighlightedOnly)
 
 void PartSet_SketcherMgr::restoreSelection()
 {
+  if (!myCurrentSketch.get())
+    return;
+
   //qDebug(QString("restoreSelection: %1").arg(myCurrentSelection.size()).toStdString().c_str());
   ModuleBase_IWorkshop* aWorkshop = myModule->workshop();
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(aWorkshop);
index d80df1ba40566297de77b1055556906334306953..978d6154936421e9f0332bbd4520b7a4e65fb3b4 100644 (file)
@@ -322,7 +322,16 @@ bool XGUI_Displayer::redisplay(ObjectPtr theObject, bool theUpdateViewer)
         arg(!isEqualShapes || isCustomized).arg(isEqualShapes).arg(isCustomized).toStdString().c_str());
     #endif
     if (!isEqualShapes || isCustomized) {
+      /// if shapes are equal and presentation are customized, selection should be restored
+      bool aNeedToRestoreSelection = isEqualShapes && isCustomized;
+      if (aNeedToRestoreSelection)
+        myWorkshop->module()->storeSelection();
+
       aContext->Redisplay(aAISIO, false);
+
+      if (aNeedToRestoreSelection)
+        myWorkshop->module()->restoreSelection();
+
       aRedisplayed = true;
       #ifdef DEBUG_FEATURE_REDISPLAY
         qDebug("  Redisplay happens");