Salome HOME
Issue #1303 Re-ordering of Sketcher menus: Delete to be the last
[modules/shaper.git] / src / ModuleBase / ModuleBase_WidgetSelector.cpp
index 9d5b50a0ad9884363fa7960114d953c8cfc85b00..b9fe6ef9c9db8f643c71abfe33d7cce5514e4e31 100755 (executable)
@@ -14,6 +14,7 @@
 #include <ModuleBase_WidgetFactory.h>
 #include <ModuleBase_IModule.h>
 #include <ModuleBase_ResultPrs.h>
+#include <ModuleBase_ViewerPrs.h>
 
 #include <ModelAPI_ResultConstruction.h>
 
@@ -32,7 +33,7 @@ ModuleBase_WidgetSelector::~ModuleBase_WidgetSelector()
 }
 
 //********************************************************************
-void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrs& thePrs,
+void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrsPtr& thePrs,
                                                       ObjectPtr& theObject,
                                                       GeomShapePtr& theShape)
 {
@@ -44,11 +45,9 @@ void ModuleBase_WidgetSelector::getGeomSelection(const ModuleBase_ViewerPrs& the
 //********************************************************************
 void ModuleBase_WidgetSelector::onSelectionChanged()
 {
-  QList<ModuleBase_ViewerPrs> aSelected = getFilteredSelected();
+  QList<ModuleBase_ViewerPrsPtr> aSelected = getFilteredSelected();
   bool isDone = setSelection(aSelected, true/*false*/);
-
-  if (isDone)
-   updateOnSelectionChanged(isDone);
+  updateOnSelectionChanged(isDone);
 }
 
 //********************************************************************
@@ -71,9 +70,9 @@ void ModuleBase_WidgetSelector::updateOnSelectionChanged(const bool theDone)
 }
 
 //********************************************************************
-QList<ModuleBase_ViewerPrs> ModuleBase_WidgetSelector::getAttributeSelection() const
+QList<ModuleBase_ViewerPrsPtr> ModuleBase_WidgetSelector::getAttributeSelection() const
 {
-  return QList<ModuleBase_ViewerPrs>();
+  return QList<ModuleBase_ViewerPrsPtr>();
 }
 
 //********************************************************************
@@ -142,15 +141,6 @@ bool ModuleBase_WidgetSelector::activateSelectionAndFilters(bool toActivate)
   return activateFilters(toActivate);
 }
 
-//********************************************************************
-void ModuleBase_WidgetSelector::setObject(ObjectPtr theObject,
-                                          GeomShapePtr theShape)
-{
-  DataPtr aData = myFeature->data();
-  ModuleBase_Tools::setObject(aData->attribute(attributeID()), theObject, theShape,
-                              myWorkshop, myIsInValidate);
-}
-
 //********************************************************************
 void ModuleBase_WidgetSelector::activateCustom()
 {
@@ -164,7 +154,7 @@ void ModuleBase_WidgetSelector::activateCustom()
 }
 
 //********************************************************************
-bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   GeomShapePtr aShape = myWorkshop->selection()->getShape(thePrs);
   ResultPtr aResult = myWorkshop->selection()->getResult(thePrs);
@@ -180,13 +170,13 @@ bool ModuleBase_WidgetSelector::isValidSelectionCustom(const ModuleBase_ViewerPr
 }
 
 //********************************************************************
-bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrs& thePrs)
+bool ModuleBase_WidgetSelector::setSelectionCustom(const ModuleBase_ViewerPrsPtr& thePrs)
 {
   ObjectPtr anObject;
   GeomShapePtr aShape;
   getGeomSelection(thePrs, anObject, aShape);
 
-  setObject(anObject, aShape);
+  ModuleBase_Tools::setObject(attribute(), anObject, aShape, myWorkshop, myIsInValidate);
   return true;
 }