]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Code improvement: avoid the code duplication for setSelected method in the displayer...
authornds <natalia.donis@opencascade.com>
Thu, 21 May 2015 05:32:41 +0000 (08:32 +0300)
committernds <natalia.donis@opencascade.com>
Thu, 21 May 2015 05:32:41 +0000 (08:32 +0300)
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_SelectionMgr.cpp

index 7c66603442255abb3fcad566f4401481cd81f92b..493a077a204aa1d1c72e1e39530e71322c653faa 100644 (file)
@@ -79,12 +79,12 @@ class XGUI_EXPORT XGUI_Displayer: public QObject
   void redisplay(ObjectPtr theObject, bool isUpdateViewer = true);
 
   /**
-   * Add presentations which corresponds to the given features to current selection
-   * \param theFeatures a list of features to be selected
+   * Add presentations to current selection. It unhighlight and deselect the current selection.
+   * The shape and result components are processed in the values. If the presentation shape is not
+   * empty, select it, otherwise select the result.
+   * \param theValues a list of presentation to be selected
    * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
    */
-  void setSelected(const QObjectPtrList& theFeatures, bool isUpdateViewer = true);
-
   void setSelected(const  QList<ModuleBase_ViewerPrs>& theValues, bool isUpdateViewer = true);
 
 
index 84d03259006a4f449ebae4ce90457ab97101ddd2..517f248668f0d0404773a0af6a2de7d610c0157a 100644 (file)
@@ -87,8 +87,10 @@ void XGUI_SelectionMgr::updateSelectedOwners(bool isUpdateViewer)
 void XGUI_SelectionMgr::onObjectBrowserSelection()
 {
   QObjectPtrList aObjects = myWorkshop->objectBrowser()->selectedObjects();
+  QList<ModuleBase_ViewerPrs> aSelectedPrs = ModuleBase_ISelection::getViewerPrs(aObjects);
+
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-  aDisplayer->setSelected(aObjects);
+  aDisplayer->setSelected(aSelectedPrs);
   emit selectionChanged();
 }
 
@@ -117,9 +119,10 @@ void XGUI_SelectionMgr::clearSelection()
   bool aBlocked = myWorkshop->objectBrowser()->blockSignals(true);
   myWorkshop->objectBrowser()->setObjectsSelected(aFeatures);
   myWorkshop->objectBrowser()->blockSignals(aBlocked);
+  QList<ModuleBase_ViewerPrs> aSelectedPrs = ModuleBase_ISelection::getViewerPrs(aFeatures);
 
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-  aDisplayer->setSelected(aFeatures);
+  aDisplayer->setSelected(aSelectedPrs);
 
   emit selectionChanged();
 }