]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Create selection validator and selection object
authorvsv <vitaly.smetannikov@opencascade.com>
Wed, 9 Jul 2014 08:38:38 +0000 (12:38 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Wed, 9 Jul 2014 08:38:38 +0000 (12:38 +0400)
33 files changed:
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_ISelection.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_SelectionValidator.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_ViewSelectionValidator.h [deleted file]
src/ModuleBase/ModuleBase_ViewerPrs.h [new file with mode: 0644]
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_OperationFeatureCreate.cpp
src/PartSet/PartSet_OperationFeatureCreate.h
src/PartSet/PartSet_OperationFeatureEdit.cpp
src/PartSet/PartSet_OperationFeatureEdit.h
src/PartSet/PartSet_OperationFeatureEditMulti.cpp
src/PartSet/PartSet_OperationFeatureEditMulti.h
src/PartSet/PartSet_OperationSketch.cpp
src/PartSet/PartSet_OperationSketch.h
src/PartSet/PartSet_OperationSketchBase.cpp
src/PartSet/PartSet_OperationSketchBase.h
src/PartSet/PartSet_TestOCC.cpp
src/PartSet/PartSet_Tools.cpp
src/PartSet/PartSet_Tools.h
src/PartSet/PartSet_WidgetSketchLabel.cpp
src/PartSet/PartSet_WidgetSketchLabel.h
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_Displayer.cpp
src/XGUI/XGUI_Displayer.h
src/XGUI/XGUI_ModuleConnector.cpp
src/XGUI/XGUI_Selection.cpp [new file with mode: 0644]
src/XGUI/XGUI_Selection.h [new file with mode: 0644]
src/XGUI/XGUI_SelectionMgr.cpp
src/XGUI/XGUI_SelectionMgr.h
src/XGUI/XGUI_ViewerPrs.cpp [deleted file]
src/XGUI/XGUI_ViewerPrs.h [deleted file]
src/XGUI/XGUI_Workshop.cpp

index 4f34faab863a27a95492ae39e1705b2fa8207e76..b21756a5c39ff3dc9c72c13d5cbfd6696a9308cc 100644 (file)
@@ -22,7 +22,9 @@ SET(PROJECT_HEADERS
        ModuleBase_WidgetValue.h
        ModuleBase_WidgetValueFeature.h
        ModuleBase_Definitions.h
-       ModuleBase_ViewSelectionValidator.h
+       ModuleBase_SelectionValidator.h
+       ModuleBase_ISelection.h
+       ModuleBase_ViewerPrs.h
 )
 
 SET(PROJECT_SOURCES
diff --git a/src/ModuleBase/ModuleBase_ISelection.h b/src/ModuleBase/ModuleBase_ISelection.h
new file mode 100644 (file)
index 0000000..0519985
--- /dev/null
@@ -0,0 +1,49 @@
+// File:        ModuleBase_ISelection.h
+// Created:     2 June 2014
+// Author:      Vitaly Smetannikov
+
+#ifndef ModuleBase_ISelection_H
+#define ModuleBase_ISelection_H
+
+#include "ModuleBase.h"
+#include "ModuleBase_Definitions.h"
+#include "ModuleBase_ViewerPrs.h"
+
+#include <QModelIndexList>
+#include <AIS_ListOfInteractive.hxx>
+#include <NCollection_List.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <list>
+
+class ModuleBase_ISelection
+{
+public:
+
+  /// Returns a list of viewer selected presentations
+  /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
+  /// \return list of presentations
+  virtual std::list<ModuleBase_ViewerPrs> getSelected(int theShapeTypeToSkip = -1) const = 0;
+
+  /// Returns a list of viewer highlited presentations
+  /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
+  /// \return list of presentations
+  virtual std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const = 0;
+
+  /**
+  * Returns list of features currently selected in 3d viewer
+  */
+  virtual QFeatureList selectedFeatures() const = 0;
+  
+  //! Returns list of currently selected QModelIndexes
+  virtual QModelIndexList selectedIndexes() const = 0;
+
+  //! Returns list of currently selected AIS objects
+  virtual void selectedAISObjects(AIS_ListOfInteractive& theList) const = 0;
+
+  //! Returns list of currently selected shapes
+  virtual void selectedShapes(NCollection_List<TopoDS_Shape>& theList) const = 0;
+
+};
+
+#endif
\ No newline at end of file
diff --git a/src/ModuleBase/ModuleBase_SelectionValidator.h b/src/ModuleBase/ModuleBase_SelectionValidator.h
new file mode 100644 (file)
index 0000000..ff0c0a6
--- /dev/null
@@ -0,0 +1,20 @@
+// File:        ModuleBase_SelectionValidator.h
+// Created:     8 Jul 2014
+// Author:      Vitaly SMETANNIKOV
+
+#ifndef ModuleBase_SelectionValidator_H
+#define ModuleBase_SelectionValidator_H
+
+#include "ModuleBase.h"
+#include "ModuleBase_ISelection.h"
+
+#include <ModelAPI_Validator.h>
+
+
+class MODULEBASE_EXPORT ModuleBase_SelectionValidator: public ModelAPI_Validator
+{
+public:
+  virtual bool isValid(const ModuleBase_ISelection* theSelection) const = 0;
+};
+
+#endif
diff --git a/src/ModuleBase/ModuleBase_ViewSelectionValidator.h b/src/ModuleBase/ModuleBase_ViewSelectionValidator.h
deleted file mode 100644 (file)
index 9dcc910..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-// File:        ModuleBase_ViewSelectionValidator.h
-// Created:     8 Jul 2014
-// Author:      Vitaly SMETANNIKOV
-
-#ifndef ModuleBase_ViewSelectionValidator_H
-#define ModuleBase_ViewSelectionValidator_H
-
-#include "ModuleBase.h"
-
-#include <ModelAPI_Validator.h>
-
-class MODULEBASE_EXPORT ModuleBase_ViewSelectionValidator: public ModelAPI_Validator
-{
-public:
-  virtual bool isValid(const Handle(AIS_InteractiveContext)& theContext) const = 0;
-};
-
-#endif
diff --git a/src/ModuleBase/ModuleBase_ViewerPrs.h b/src/ModuleBase/ModuleBase_ViewerPrs.h
new file mode 100644 (file)
index 0000000..b595ac1
--- /dev/null
@@ -0,0 +1,76 @@
+// File:        ModuleBase_ViewerPrs.h
+// Created:     20 Apr 2014
+// Author:      Natalia ERMOLAEVA
+
+#ifndef ModuleBase_ViewerPrs_H
+#define ModuleBase_ViewerPrs_H
+
+#include "ModuleBase.h"
+
+#include <boost/shared_ptr.hpp>
+#include <TopoDS_Shape.hxx>
+#include <SelectMgr_EntityOwner.hxx>
+
+#include <ModelAPI_Feature.h>
+
+/**\class ModuleBase_ViewerPrs
+ * \ingroup Module base
+ * \brief Presentation. Provides container to have feature, shape and/or selection owner.
+ */
+class ModuleBase_ViewerPrs
+{
+public:
+  /// Constructor
+  ModuleBase_ViewerPrs() {}
+  
+  /// Constructor
+  /// \param theFeature a model feature
+  /// \param theShape a viewer shape
+  /// \param theOwner a selection owner
+  ModuleBase_ViewerPrs(FeaturePtr theFeature,
+                 const TopoDS_Shape& theShape,
+                 Handle_SelectMgr_EntityOwner theOwner)
+  : myFeature(theFeature), myShape(theShape), myOwner(theOwner) {}
+  
+  /// Destructor
+  virtual ~ModuleBase_ViewerPrs() {}
+
+  /// Sets the feature.
+  /// \param theFeature a feature instance
+  void setFeature(FeaturePtr theFeature) { myFeature = theFeature; }
+
+  /// Returns the feature.
+  /// \return a feature instance
+  FeaturePtr feature() const { return myFeature; }
+
+  /// Returns the presentation owner
+  /// \param the owner
+  void setOwner(Handle_SelectMgr_EntityOwner theOwner) { myOwner = theOwner; }
+
+  /// Returns the presentation owner
+  /// \return an owner
+  Handle_SelectMgr_EntityOwner owner() const { return myOwner; }
+
+  /// Sets the shape
+  /// \param theShape a shape instance
+  void setShape(const TopoDS_Shape& theShape) { myShape = theShape; }
+
+  /// Returns the shape
+  /// \return a shape instance
+  const TopoDS_Shape& shape() const { return myShape; }
+
+  bool operator==(const ModuleBase_ViewerPrs& thePrs)
+  {
+    bool aFeature = (myFeature.get() == thePrs.feature().get());
+    bool aOwner = (myOwner.Access() == thePrs.owner().Access());
+    bool aShape = myShape.IsEqual(thePrs.shape());
+    return aFeature && aOwner && aShape;
+  }
+
+private:
+  FeaturePtr myFeature; /// the feature
+  Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
+  TopoDS_Shape myShape; /// the shape
+};
+
+#endif
index 8d40a07f7dc53673d683511b40f71d088e87066d..3114ef9449e2f914f26712c5e8c9a891e2bf1c90 100644 (file)
@@ -24,6 +24,7 @@
 #include <XGUI_Workshop.h>
 #include <XGUI_OperationMgr.h>
 #include <XGUI_SelectionMgr.h>
+#include <XGUI_Selection.h>
 #include <XGUI_ViewPort.h>
 #include <XGUI_ActionsMgr.h>
 #include <XGUI_ViewerProxy.h>
@@ -140,10 +141,10 @@ void PartSet_Module::launchOperation(const QString& theCmdId)
   ModuleBase_Operation* anOperation = createOperation(theCmdId.toStdString());
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp) {
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
+    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
     // Initialise operation with preliminary selection
-    std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
-    std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
+    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
     aPreviewOp->initSelection(aSelected, aHighlighted);
   } 
   sendOperation(anOperation);
@@ -174,7 +175,7 @@ void PartSet_Module::onOperationStopped(ModuleBase_Operation* theOperation)
 
 void PartSet_Module::onContextMenuCommand(const QString& theId, bool isChecked)
 {
-  QFeatureList aFeatures = myWorkshop->selector()->selectedFeatures();
+  QFeatureList aFeatures = myWorkshop->selector()->selection()->selectedFeatures();
   if (theId == "EDIT_CMD" && (aFeatures.size() > 0)) {
     editFeature(aFeatures.first());
   }
@@ -185,9 +186,10 @@ void PartSet_Module::onMousePressed(QMouseEvent* theEvent)
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(
                                        myWorkshop->operationMgr()->currentOperation());
   if (aPreviewOp) {
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
-    std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
+    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    // Initialise operation with preliminary selection
+    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
 
     aPreviewOp->mousePressed(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
   }
@@ -199,9 +201,10 @@ void PartSet_Module::onMouseReleased(QMouseEvent* theEvent)
                                        myWorkshop->operationMgr()->currentOperation());
   if (aPreviewOp)
   {
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
-    std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
+    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    // Initialise operation with preliminary selection
+    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
 
     aPreviewOp->mouseReleased(theEvent, myWorkshop->viewer()->activeView(), aSelected, aHighlighted);
   }
@@ -230,9 +233,10 @@ void PartSet_Module::onMouseDoubleClick(QMouseEvent* theEvent)
                                        myWorkshop->operationMgr()->currentOperation());
   if (aPreviewOp)
   {
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
-    std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
+    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    // Initialise operation with preliminary selection
+    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
     aPreviewOp->mouseDoubleClick(theEvent, myWorkshop->viewer()->activeView(), aSelected,
                                  aHighlighted);
   }
@@ -258,10 +262,10 @@ void PartSet_Module::onLaunchOperation(std::string theName, FeaturePtr theFeatur
   PartSet_OperationSketchBase* aPreviewOp = dynamic_cast<PartSet_OperationSketchBase*>(anOperation);
   if (aPreviewOp)
   {
-    XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-    // refill the features list with avoiding of the features, obtained only by vertex shape (TODO)
-    std::list<XGUI_ViewerPrs> aSelected = aDisplayer->getSelected();
-    std::list<XGUI_ViewerPrs> aHighlighted = aDisplayer->getHighlighted();
+    XGUI_Selection* aSelection = myWorkshop->selector()->selection();
+    // Initialise operation with preliminary selection
+    std::list<ModuleBase_ViewerPrs> aSelected = aSelection->getSelected();
+    std::list<ModuleBase_ViewerPrs> aHighlighted = aSelection->getHighlighted();
     aPreviewOp->initFeature(theFeature);
     aPreviewOp->initSelection(aSelected, aHighlighted);
   } else {
index b2f445505d96762b2a7b2e9e214c46bc433ab823..d1d5d409b42d33d6fef7bc2c638862227450ed61 100644 (file)
@@ -24,8 +24,8 @@
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_WidgetPoint2D.h>
 #include <ModuleBase_WidgetValueFeature.h>
+#include <ModuleBase_ViewerPrs.h>
 
-#include <XGUI_ViewerPrs.h>
 #include <XGUI_Constants.h>
 
 #include <V3d_View.hxx>
@@ -83,8 +83,8 @@ std::list<int> PartSet_OperationFeatureCreate::getSelectionModes(FeaturePtr theF
   return aModes;
 }
 
-void PartSet_OperationFeatureCreate::initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-                                                   const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+void PartSet_OperationFeatureCreate::initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                   const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   myPreSelection = theSelected;
 }
@@ -101,8 +101,8 @@ FeaturePtr PartSet_OperationFeatureCreate::sketch() const
 }
 
 void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                                const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   if (canBeCommitted())
   {
@@ -120,7 +120,7 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
     PartSet_Tools::convertTo2D(aPoint, sketch(), theView, aX, anY);
   }
   else {
-    XGUI_ViewerPrs aPrs = theSelected.front();
+    ModuleBase_ViewerPrs aPrs = theSelected.front();
     const TopoDS_Shape& aShape = aPrs.shape();
     if (!aShape.IsNull()) // the point is selected
     {
@@ -147,7 +147,7 @@ void PartSet_OperationFeatureCreate::mouseReleased(QMouseEvent* theEvent, Handle
   }
   FeaturePtr aFeature;
   if (!theSelected.empty()) {
-    XGUI_ViewerPrs aPrs = theSelected.front();
+    ModuleBase_ViewerPrs aPrs = theSelected.front();
     aFeature = aPrs.feature();
   }
   else
@@ -190,7 +190,7 @@ void PartSet_OperationFeatureCreate::onWidgetActivated(ModuleBase_ModelWidget* t
 {
   myActiveWidget = theWidget;
   if ((myPreSelection.size() > 0) && myActiveWidget) {
-    const XGUI_ViewerPrs& aPrs = myPreSelection.front();
+    const ModuleBase_ViewerPrs& aPrs = myPreSelection.front();
     ModuleBase_WidgetValueFeature aValue;
     aValue.setFeature(aPrs.feature());
     if (myActiveWidget->setValue(&aValue)) {
index ee711b1bc02fb3818f7cc4d3242413a0fa3add0f..f5823d6c1de244d119f8b23a423cd7f192509719 100644 (file)
@@ -60,8 +60,8 @@ public:
   /// Initialisation of operation with preliminary selection
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-    const std::list<XGUI_ViewerPrs>& theHighlighted);
+  virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -73,8 +73,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
   /// \param theEvent the mouse event
@@ -128,7 +128,7 @@ private:
 
   ModuleBase_ModelWidget* myActiveWidget; ///< the active widget
 
-  std::list<XGUI_ViewerPrs> myPreSelection;
+  std::list<ModuleBase_ViewerPrs> myPreSelection;
 };
 
 #endif
index 07f077d2bf04e76cf9a7a33b8ab8ce9319c4a5a4..c6ad6130ecb2902f917ec9247192110e79d12a93 100644 (file)
@@ -10,9 +10,9 @@
 
 #include <ModuleBase_OperationDescription.h>
 #include <ModuleBase_WidgetEditor.h>
-#include <ModelAPI_Events.h>
+#include <ModuleBase_ViewerPrs.h>
 
-#include <XGUI_ViewerPrs.h>
+#include <ModelAPI_Events.h>
 
 #include <SketchPlugin_Feature.h>
 #include <GeomDataAPI_Point2D.h>
@@ -70,8 +70,8 @@ FeaturePtr PartSet_OperationFeatureEdit::sketch() const
 }
 
 void PartSet_OperationFeatureEdit::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<XGUI_ViewerPrs>& theSelected,
-                                             const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                             const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   FeaturePtr aFeature;
   if (!theHighlighted.empty())
@@ -125,19 +125,19 @@ void PartSet_OperationFeatureEdit::mouseMoved(QMouseEvent* theEvent, Handle(V3d_
 }
 
 void PartSet_OperationFeatureEdit::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                              const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                              const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+                                              const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+                                              const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
   blockSelection(false);
 }
 
 void PartSet_OperationFeatureEdit::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                                    const std::list<XGUI_ViewerPrs>& theSelected,
-                                                    const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                                    const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                    const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   // TODO the functionality is important only for constraint feature. Should be moved in another place
   if (!theSelected.empty()) {
-    XGUI_ViewerPrs aFeaturePrs = theSelected.front();
+    ModuleBase_ViewerPrs aFeaturePrs = theSelected.front();
     if (!aFeaturePrs.owner().IsNull()) {
       Handle(AIS_DimensionOwner) anOwner = Handle(AIS_DimensionOwner)::DownCast(aFeaturePrs.owner());
       if (!anOwner.IsNull() && anOwner->SelectionMode() == AIS_DSM_Text) {
index a750cf9f77e9124b4a3fde5e4f9d7b94baa21491..f64e25ab11c1b213b0e8431e8e3ed334d378b009 100644 (file)
@@ -83,8 +83,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
   /// Gives the current mouse point in the viewer
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
@@ -95,8 +95,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Processes the mouse double click in the point
   /// \param theEvent the mouse event
@@ -104,8 +104,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                const std::list<XGUI_ViewerPrs>& theHighlighted);
+                                const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
index e5feef62d5a40f3a02fa2435625a4311793d7078..ac2cd698268690709d071e4cea9565324222ddf2 100644 (file)
@@ -7,9 +7,9 @@
 #include <PartSet_OperationSketch.h>
 
 #include <ModuleBase_OperationDescription.h>
-#include <ModelAPI_Events.h>
+#include <ModuleBase_ViewerPrs.h>
 
-#include <XGUI_ViewerPrs.h>
+#include <ModelAPI_Events.h>
 
 #include <SketchPlugin_Feature.h>
 #include <GeomDataAPI_Point2D.h>
@@ -48,8 +48,8 @@ bool PartSet_OperationFeatureEditMulti::isGranted(ModuleBase_IOperation* theOper
   return theOperation->getDescription()->operationId().toStdString() == PartSet_OperationSketch::Type();
 }
 
-void PartSet_OperationFeatureEditMulti::initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-                                                      const std::list<XGUI_ViewerPrs>& theHighlighted)
+void PartSet_OperationFeatureEditMulti::initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                      const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   if (!theHighlighted.empty()) {
     // if there is highlighted object, we check whether it is in the list of selected objects
@@ -57,7 +57,7 @@ void PartSet_OperationFeatureEditMulti::initSelection(const std::list<XGUI_Viewe
     // the hightlighted object should moved and the selection is skipped. The skipped selection will be
     // deselected in the viewer by blockSelection signal in the startOperation method.
     bool isSelected = false;
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theSelected.begin(), aLast = theSelected.end();
     for (; anIt != aLast && !isSelected; anIt++) {
       isSelected = (*anIt).feature() == feature();
     }
@@ -81,8 +81,8 @@ FeaturePtr PartSet_OperationFeatureEditMulti::sketch() const
 }
 
 void PartSet_OperationFeatureEditMulti::mousePressed(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                             const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                             const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                             const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+                                             const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 
@@ -108,7 +108,7 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
                            boost::dynamic_pointer_cast<SketchPlugin_Feature>(feature());
     aSketchFeature->move(aDeltaX, aDeltaY);
 
-    std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+    std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
     for (; anIt != aLast; anIt++) {
       FeaturePtr aFeature = (*anIt).feature();
       if (!aFeature || aFeature == feature())
@@ -123,12 +123,12 @@ void PartSet_OperationFeatureEditMulti::mouseMoved(QMouseEvent* theEvent, Handle
 }
 
 void PartSet_OperationFeatureEditMulti::mouseReleased(QMouseEvent* theEvent, Handle(V3d_View) theView,
-                                              const std::list<XGUI_ViewerPrs>& /*theSelected*/,
-                                              const std::list<XGUI_ViewerPrs>& /*theHighlighted*/)
+                                              const std::list<ModuleBase_ViewerPrs>& /*theSelected*/,
+                                              const std::list<ModuleBase_ViewerPrs>& /*theHighlighted*/)
 {
-  std::list<XGUI_ViewerPrs> aFeatures = myFeatures;
+  std::list<ModuleBase_ViewerPrs> aFeatures = myFeatures;
   commit();
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = aFeatures.begin(), aLast = aFeatures.end();
   for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = (*anIt).feature();
     if (aFeature) {
@@ -163,7 +163,7 @@ void PartSet_OperationFeatureEditMulti::blockSelection(bool isBlocked, const boo
 
   myIsBlockedSelection = isBlocked;
   QFeatureList aFeatureList;
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(),
                                             aLast = myFeatures.end();
   for(; anIt != aLast; anIt++)
     aFeatureList.append((*anIt).feature());
@@ -184,7 +184,7 @@ void PartSet_OperationFeatureEditMulti::sendFeatures()
   static Events_ID anEvent = Events_Loop::eventByName(EVENT_FEATURE_MOVED);
 
   std::list<FeaturePtr > aFeatures;
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = myFeatures.begin(), aLast = myFeatures.end();
   for (; anIt != aLast; anIt++) {
     FeaturePtr aFeature = (*anIt).feature();
     if (!aFeature)
index a431a1d85f7b3176a0b5d66ad6c446c09419850b..7f018618b215499bb6280d266212cfdb985133f8 100644 (file)
@@ -71,8 +71,8 @@ public:
   /// Initialisation of operation with preliminary selection
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-    const std::list<XGUI_ViewerPrs>& theHighlighted);
+  virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -84,8 +84,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
   /// Gives the current mouse point in the viewer
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
@@ -96,8 +96,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
  virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 protected:
   /// \brief Virtual method called when operation is started
   /// Virtual method called when operation started (see start() method for more description)
@@ -121,7 +121,7 @@ protected:
 
 private:
   FeaturePtr mySketch; ///< the sketch feature
-  std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
+  std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
   Point myCurPoint; ///< the current 3D point clicked or moved
   bool myIsBlockedSelection; ///< the state of the last state of selection blocked signal
 };
index eff5a65ee5c3ef40a63277311a59cf5652958fc2..563caf21ca286697d7714ca8ac94f12cfcc2e13e 100644 (file)
@@ -20,7 +20,7 @@
 #include <GeomDataAPI_Dir.h>
 #include <GeomAPI_XYZ.h>
 
-#include <XGUI_ViewerPrs.h>
+#include <ModuleBase_ViewerPrs.h>
 
 #include <AIS_Shape.hxx>
 #include <AIS_ListOfInteractive.hxx>
@@ -72,12 +72,12 @@ FeaturePtr PartSet_OperationSketch::sketch() const
 }
 
 void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                           const std::list<XGUI_ViewerPrs>& theSelected,
-                                           const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                           const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                           const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   if (!hasSketchPlane()) {
     if (!theHighlighted.empty()) {
-      XGUI_ViewerPrs aPrs = theHighlighted.front();
+      ModuleBase_ViewerPrs aPrs = theHighlighted.front();
       const TopoDS_Shape& aShape = aPrs.shape();
       if (!aShape.IsNull())
         setSketchPlane(aShape);
@@ -106,8 +106,8 @@ void PartSet_OperationSketch::mousePressed(QMouseEvent* theEvent, Handle_V3d_Vie
 }
 
 void PartSet_OperationSketch::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                            const std::list<XGUI_ViewerPrs>& theSelected,
-                                            const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                            const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
   if (!hasSketchPlane()) {
   }
index 0f0b0ead0cbef3d4aa5e6d99f4db149d72716e2d..eb0c8477542a5aaeb8e295da6ed4d3f8ced79c9a 100644 (file)
@@ -52,16 +52,16 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
   /// Processes the mouse release in the point
   /// \param theEvent the mouse event
   /// \param theView a viewer to have the viewer the eye position
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<XGUI_ViewerPrs>& theSelected,
-                             const std::list<XGUI_ViewerPrs>& theHighlighted);
+                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Gives the current mouse point in the viewer
   /// \param thePoint a point clicked in the viewer
@@ -105,7 +105,7 @@ protected:
   void setSketchPlane(const TopoDS_Shape& theShape);
 
 private:
-  std::list<XGUI_ViewerPrs> myFeatures; ///< the features to apply the edit operation
+  std::list<ModuleBase_ViewerPrs> myFeatures; ///< the features to apply the edit operation
 };
 
 #endif
index dd66393219a8f95dafba59a4bb06944551b843fb..bef1dfde5cde9d2d426d81de989e99b2c5cb228c 100644 (file)
@@ -69,21 +69,21 @@ FeaturePtr PartSet_OperationSketchBase::createFeature(const bool theFlushMessage
 
 
 void PartSet_OperationSketchBase::mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                               const std::list<XGUI_ViewerPrs>& theSelected,
-                                               const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                               const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                               const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 void PartSet_OperationSketchBase::mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                                const std::list<XGUI_ViewerPrs>& theSelected,
-                                                const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                                const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 void PartSet_OperationSketchBase::mouseMoved(QMouseEvent* theEvent, Handle(V3d_View) theView)
 {
 }
 void PartSet_OperationSketchBase::mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                                                   const std::list<XGUI_ViewerPrs>& theSelected,
-                                                   const std::list<XGUI_ViewerPrs>& theHighlighted)
+                                                   const std::list<ModuleBase_ViewerPrs>& theSelected,
+                                                   const std::list<ModuleBase_ViewerPrs>& theHighlighted)
 {
 }
 
index 8fa6439d7ff636505e4aa484783f1eaaf3848717..449d65834959d8753fec95e39627694f9d30261f 100644 (file)
@@ -26,7 +26,7 @@
 class Handle_V3d_View;
 class QMouseEvent;
 class GeomAPI_Shape;
-class XGUI_ViewerPrs;
+class ModuleBase_ViewerPrs;
 
 /*!
   \class PartSet_OperationSketchBase
@@ -66,8 +66,8 @@ public:
   /// Initialisation of operation with preliminary selection
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
-  virtual void initSelection(const std::list<XGUI_ViewerPrs>& theSelected,
-    const std::list<XGUI_ViewerPrs>& theHighlighted) {}
+  virtual void initSelection(const std::list<ModuleBase_ViewerPrs>& theSelected,
+    const std::list<ModuleBase_ViewerPrs>& theHighlighted) {}
 
   /// Returns the operation sketch feature
   /// \returns the sketch instance
@@ -79,8 +79,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mousePressed(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Processes the mouse release in the point
   /// \param theEvent the mouse event
@@ -88,8 +88,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseReleased(QMouseEvent* theEvent, Handle_V3d_View theView,
-                             const std::list<XGUI_ViewerPrs>& theSelected,
-                             const std::list<XGUI_ViewerPrs>& theHighlighted);
+                             const std::list<ModuleBase_ViewerPrs>& theSelected,
+                             const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Processes the mouse move in the point
   /// \param theEvent the mouse event
@@ -102,8 +102,8 @@ public:
   /// \param theSelected the list of selected presentations
   /// \param theHighlighted the list of highlighted presentations
   virtual void mouseDoubleClick(QMouseEvent* theEvent, Handle_V3d_View theView,
-                            const std::list<XGUI_ViewerPrs>& theSelected,
-                            const std::list<XGUI_ViewerPrs>& theHighlighted);
+                            const std::list<ModuleBase_ViewerPrs>& theSelected,
+                            const std::list<ModuleBase_ViewerPrs>& theHighlighted);
 
   /// Processes the key pressed in the view
   /// \param theKey a key value
@@ -130,7 +130,7 @@ signals:
                           int theMode);
   /// Signal about the features should be selected
   /// \param theSelected the list of selected presentations
-  void featureSelected(const std::list<XGUI_ViewerPrs>& theSelected);
+  void featureSelected(const std::list<ModuleBase_ViewerPrs>& theSelected);
   /// signal to enable/disable multi selection in the viewer
   /// \param theEnabled the boolean state
   void multiSelectionEnabled(bool theEnabled);
index 00ff7cef268779659b4f9f56ba623a9837172229..f447f59660f3a1bd4894326893b3271874e5d482 100644 (file)
@@ -7,11 +7,11 @@
 #include <XGUI_Workshop.h>
 #include <XGUI_OperationMgr.h>
 #include <XGUI_Displayer.h>
-#include <XGUI_ViewerPrs.h>
 #include <XGUI_ViewerProxy.h>
 #include <PartSet_Tools.h>
 #include <PartSet_OperationSketchBase.h>
 
+#include <ModuleBase_ViewerPrs.h>
 #include <ModelAPI_Feature.h>
 
 #include <SketchPlugin_Line.h>
index ca6b10adbdb8d105719c93f9674978e34d4c982c..aa3ac235adbfa32483ccfc0b404d306195136c0b 100644 (file)
@@ -27,7 +27,7 @@
 #include <SketchPlugin_ConstraintRadius.h>
 #include <SketchPlugin_Constraint.h>
 
-#include <XGUI_ViewerPrs.h>
+#include <ModuleBase_ViewerPrs.h>
 
 #include <V3d_View.hxx>
 #include <gp_Pln.hxx>
@@ -138,18 +138,18 @@ void PartSet_Tools::convertTo3D(const double theX, const double theY,
 
 FeaturePtr PartSet_Tools::nearestFeature(QPoint thePoint, Handle_V3d_View theView,
                                          FeaturePtr theSketch,
-                                         const std::list<XGUI_ViewerPrs>& theFeatures)
+                                         const std::list<ModuleBase_ViewerPrs>& theFeatures)
 {
   double aX, anY;
   gp_Pnt aPoint = PartSet_Tools::convertClickToPoint(thePoint, theView);
   PartSet_Tools::convertTo2D(aPoint, theSketch, theView, aX, anY);
 
   FeaturePtr aFeature;
-  std::list<XGUI_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
+  std::list<ModuleBase_ViewerPrs>::const_iterator anIt = theFeatures.begin(), aLast = theFeatures.end();
 
   FeaturePtr aDeltaFeature;   
   double aMinDelta = -1;
-  XGUI_ViewerPrs aPrs;
+  ModuleBase_ViewerPrs aPrs;
   for (; anIt != aLast; anIt++) {
     aPrs = *anIt;
     if (!aPrs.feature())
index fa1f31f9d765b53dedc062dfef20dbe641592787..1cd763ca0e9af86623bf246e7b675d7dfd61afc1 100644 (file)
@@ -18,7 +18,7 @@
 #include <list>
 
 class Handle_V3d_View;
-class XGUI_ViewerPrs;
+class ModuleBase_ViewerPrs;
 class GeomDataAPI_Point2D;
 class GeomAPI_Pln;
 class GeomAPI_Pnt2d;
@@ -58,7 +58,7 @@ public:
   /// \param theSketch the sketch feature
   /// \param theFeatures the list of selected presentations
   static FeaturePtr nearestFeature(QPoint thePoint, Handle_V3d_View theView, FeaturePtr theSketch,
-                                   const std::list<XGUI_ViewerPrs>& theFeatures);
+                                   const std::list<ModuleBase_ViewerPrs>& theFeatures);
 
   /// Returns pointer to the root document.
   static boost::shared_ptr<ModelAPI_Document> document();
index de9c411c1db1c02b3ec647871f88fb99f9493646..4b39dc60e9362641af45ec564a40f45754d0ee54 100644 (file)
@@ -42,6 +42,7 @@ void PartSet_WidgetSketchLabel::setOperationsMgr(XGUI_OperationMgr* theMgr)
   ModuleBase_Operation* aOperation = theMgr->currentOperation();
   if (aOperation->inherits("PartSet_OperationSketch")) {
     PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(aOperation);
+    updateLabel(aSketchOpe);
     connect(aSketchOpe, SIGNAL(planeSelected(double, double, double)), 
             this, SLOT(onPlaneSelected()));
   }
@@ -50,11 +51,16 @@ void PartSet_WidgetSketchLabel::setOperationsMgr(XGUI_OperationMgr* theMgr)
 void PartSet_WidgetSketchLabel::onPlaneSelected()
 {
   PartSet_OperationSketch* aSketchOpe = static_cast<PartSet_OperationSketch*>(sender());
-  if (aSketchOpe->hasSketchPlane()) {
+  updateLabel(aSketchOpe);
+}
+
+void PartSet_WidgetSketchLabel::updateLabel(PartSet_OperationSketch* theSketchOpe)
+{
+  if (theSketchOpe->hasSketchPlane()) {
     myLabel->setText("");
     myLabel->setToolTip("");
   } else {
     myLabel->setText(myText);
     myLabel->setToolTip(myTooltip);
   }
-}
+}
\ No newline at end of file
index 1419cc6670cb1e7d5a4737f1064211fb27240b80..30cdaace39917bcbd8e9d58be4c8b06352435198 100644 (file)
@@ -11,6 +11,7 @@
 
 class QLabel;
 class XGUI_OperationMgr; 
+class PartSet_OperationSketch;
 
 class PARTSET_EXPORT PartSet_WidgetSketchLabel : public ModuleBase_ModelWidget
 {
@@ -38,6 +39,8 @@ private slots:
   void onPlaneSelected();
 
 private:
+  void updateLabel(PartSet_OperationSketch* theSketchOpe);
+
   QLabel* myLabel;
   QString myText;
   QString myTooltip;
index 450954322a3bb50d4a0cc8dd99a85a1745dd210d..4380786974b39ccc470174b26c01fd4a8e9236d7 100644 (file)
@@ -28,10 +28,10 @@ SET(PROJECT_HEADERS
     XGUI_ErrorDialog.h
     XGUI_SalomeViewer.h
     XGUI_ViewerProxy.h
-    XGUI_ViewerPrs.h
     XGUI_PropertyPanel.h
     XGUI_ContextMenuMgr.h
     XGUI_ModuleConnector.h
+       XGUI_Selection.h
 )
 
 SET(PROJECT_AUTOMOC 
@@ -60,10 +60,10 @@ SET(PROJECT_SOURCES
     XGUI_ActionsMgr.cpp
     XGUI_ErrorDialog.cpp
     XGUI_ViewerProxy.cpp
-    XGUI_ViewerPrs.cpp
     XGUI_PropertyPanel.cpp
     XGUI_ContextMenuMgr.cpp
     XGUI_ModuleConnector.cpp
+       XGUI_Selection.cpp
 )
 
 SET(PROJECT_RESOURCES 
index efe3c9c127763939cb292274e67a4ae5d6b45ac6..8ecb179b3d1b77a46503126208ead9d91469b882 100644 (file)
@@ -6,6 +6,7 @@
 #include "XGUI_Displayer.h"
 #include "XGUI_MainWindow.h"
 #include "XGUI_ViewerProxy.h"
+#include "XGUI_Selection.h"
 
 #include "PartSetPlugin_Part.h"
 
@@ -98,7 +99,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
 {
   QMenu* aMenu = new QMenu();
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
-  QFeatureList aFeatures = aSelMgr->selectedFeatures();
+  QFeatureList aFeatures = aSelMgr->selection()->selectedFeatures();
   if (aFeatures.size() == 1) {
     PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
     FeaturePtr aFeature = aFeatures.first();
@@ -152,7 +153,7 @@ QMenu* XGUI_ContextMenuMgr::viewerMenu() const
 void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
 {
   XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
-  QFeatureList aFeatures = aSelMgr->selectedFeatures();
+  QFeatureList aFeatures = aSelMgr->selection()->selectedFeatures();
   if (aFeatures.size() > 0) {
     if (aFeatures.size() == 1)
       theMenu->addAction(action("EDIT_CMD"));
index fc9159a91a8f417dbbefa65184d37493ebae7660..83f70bf14547149dfb23246cc61dce5aef25c2f1 100644 (file)
@@ -69,65 +69,6 @@ bool XGUI_Displayer::display(FeaturePtr theFeature,
 }
 
 
-std::list<XGUI_ViewerPrs> XGUI_Displayer::getSelected(const int theShapeTypeToSkip)
-{
-  std::set<FeaturePtr > aPrsFeatures;
-  std::list<XGUI_ViewerPrs> aPresentations;
-
-  Handle(AIS_InteractiveContext) aContext = AISContext();
-  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
-    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
-    TopoDS_Shape aShape = aContext->SelectedShape();
-
-    if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
-      continue;
-
-    FeaturePtr aFeature = getFeature(anIO);
-    if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
-      continue;
-    Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
-    aPresentations.push_back(XGUI_ViewerPrs(aFeature, aShape, anOwner));
-    aPrsFeatures.insert(aFeature);
-  }
-  return aPresentations;
-}
-
-QFeatureList XGUI_Displayer::selectedFeatures() const
-{
-  QFeatureList aSelectedList;
-
-  Handle(AIS_InteractiveContext) aContext = AISContext();
-  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
-    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
-    FeaturePtr aFeature = getFeature(anIO);
-    if (aFeature)
-      aSelectedList.append(aFeature);
-  }
-  return aSelectedList;
-}
-
-
-std::list<XGUI_ViewerPrs> XGUI_Displayer::getHighlighted(const int theShapeTypeToSkip)
-{
-  std::set<FeaturePtr > aPrsFeatures;
-  std::list<XGUI_ViewerPrs> aPresentations;
-
-  Handle(AIS_InteractiveContext) aContext = AISContext();
-  for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
-    Handle(AIS_InteractiveObject) anIO = aContext->DetectedInteractive();
-    TopoDS_Shape aShape = aContext->DetectedShape();
-    if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
-      continue;
-
-    FeaturePtr aFeature = getFeature(anIO);
-    if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
-      continue;
-    aPresentations.push_back(XGUI_ViewerPrs(aFeature, aShape, NULL));
-    aPrsFeatures.insert(aFeature);
-  }
-
-  return aPresentations;
-}
 
 void XGUI_Displayer::erase(FeaturePtr theFeature,
                            const bool isUpdateViewer)
index a9a7fb36f744b652492889f93a20d015be5ca38d..2c730c9e8b01ee60ef8b9a119512dd912bcc69e0 100644 (file)
@@ -6,7 +6,6 @@
 #define XGUI_Displayer_H
 
 #include "XGUI.h"
-#include <ModuleBase_Definitions.h>
 
 #include <QString>
 #include <boost/shared_ptr.hpp>
@@ -20,7 +19,8 @@
 
 #include <ModelAPI_Feature.h>
 
-#include <XGUI_ViewerPrs.h>
+#include <ModuleBase_Definitions.h>
+#include <ModuleBase_ViewerPrs.h>
 
 #include <map>
 #include <vector>
@@ -64,21 +64,6 @@ public:
   /// Returns true if the Feature succesfully displayed
   bool display(FeaturePtr theFeature, boost::shared_ptr<GeomAPI_AISObject> theAIS, bool isUpdateViewer = true);
   
-  /// Returns a list of viewer selected presentations
-  /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
-  /// \return list of presentations
-  std::list<XGUI_ViewerPrs> getSelected(const int theShapeTypeToSkip = -1);
-
-  /**
-  * Returns list of features currently selected in 3d viewer
-  */
-  QFeatureList selectedFeatures() const;
-
-  /// Returns a list of viewer highlited presentations
-  /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
-  /// \return list of presentations
-  std::list<XGUI_ViewerPrs> getHighlighted(const int theShapeTypeToSkip = -1);
-
   /// Display the shape and activate selection of sub-shapes
   /// \param theFeature a feature instance
   /// \param theAIS an AIS object
@@ -146,11 +131,12 @@ public:
   /// \return theIO an interactive object
   boost::shared_ptr<GeomAPI_AISObject> getAISObject(FeaturePtr theFeature) const;
 
-protected:
   /// Searches the feature by interactive object
   /// \param theIO an interactive object
   /// \return feature the feature or NULL if it not visualized
   FeaturePtr getFeature(Handle(AIS_InteractiveObject) theIO) const;
+
+protected:
   /// Deactivate local selection
   /// \param isUpdateViewer the state wether the viewer should be updated immediatelly
   void closeAllContexts(const bool isUpdateViewer);
index c00253fa7e1d89feef7ad9adfaa7826936c034de..9cb80fa224e46d212bd1fd4524d198df0f976934 100644 (file)
@@ -7,6 +7,7 @@
 #include "XGUI_Workshop.h"
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_SelectionMgr.h"
+#include "XGUI_Selection.h"
 
 
 
@@ -29,7 +30,7 @@ Handle(AIS_InteractiveContext) XGUI_ModuleConnector::AISContext() const
 
 QFeatureList XGUI_ModuleConnector::selectedFeatures() const
 {
-  return myWorkshop->selector()->selectedFeatures();
+  return myWorkshop->selector()->selection()->selectedFeatures();
 }
 
 ModuleBase_IModule* XGUI_ModuleConnector::module() const
diff --git a/src/XGUI/XGUI_Selection.cpp b/src/XGUI/XGUI_Selection.cpp
new file mode 100644 (file)
index 0000000..5900aef
--- /dev/null
@@ -0,0 +1,109 @@
+// File:        XGUI_Selection.cpp
+// Created:     8 July 2014
+// Author:      Vitaly SMETANNIKOV
+
+#include "XGUI_Selection.h"
+#include "XGUI_Workshop.h"
+#include "XGUI_Displayer.h"
+#include "XGUI_ViewerProxy.h"
+#include "XGUI_ObjectsBrowser.h"
+
+#include <ModelAPI_Feature.h>
+
+#include <AIS_InteractiveContext.hxx>
+
+#include <set>
+
+
+XGUI_Selection::XGUI_Selection(XGUI_Workshop* theWorkshop)
+: myWorkshop(theWorkshop)
+{
+}
+
+std::list<ModuleBase_ViewerPrs> XGUI_Selection::getSelected(int theShapeTypeToSkip) const
+{
+  std::set<FeaturePtr> aPrsFeatures;
+  std::list<ModuleBase_ViewerPrs> aPresentations;
+
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
+    TopoDS_Shape aShape = aContext->SelectedShape();
+
+    if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
+      continue;
+
+    FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
+    if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
+      continue;
+    Handle(SelectMgr_EntityOwner) anOwner = aContext->SelectedOwner();
+    aPresentations.push_back(ModuleBase_ViewerPrs(aFeature, aShape, anOwner));
+    aPrsFeatures.insert(aFeature);
+  }
+  return aPresentations;
+}
+
+std::list<ModuleBase_ViewerPrs> XGUI_Selection::getHighlighted(int theShapeTypeToSkip) const
+{
+  std::set<FeaturePtr > aPrsFeatures;
+  std::list<ModuleBase_ViewerPrs> aPresentations;
+
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  for (aContext->InitDetected(); aContext->MoreDetected(); aContext->NextDetected()) {
+    Handle(AIS_InteractiveObject) anIO = aContext->DetectedInteractive();
+    TopoDS_Shape aShape = aContext->DetectedShape();
+    if (theShapeTypeToSkip >= 0 && !aShape.IsNull() && aShape.ShapeType() == theShapeTypeToSkip)
+      continue;
+
+    FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
+    if (aPrsFeatures.find(aFeature) != aPrsFeatures.end())
+      continue;
+    aPresentations.push_back(ModuleBase_ViewerPrs(aFeature, aShape, NULL));
+    aPrsFeatures.insert(aFeature);
+  }
+
+  return aPresentations;
+}
+
+QFeatureList XGUI_Selection::selectedFeatures() const
+{
+  return myWorkshop->objectBrowser()->selectedFeatures();
+  //QFeatureList aSelectedList;
+
+  //Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  //for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+  //  Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
+  //  FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
+  //  if (aFeature)
+  //    aSelectedList.append(aFeature);
+  //}
+  //return aSelectedList;
+}
+
+
+//**************************************************************
+QModelIndexList XGUI_Selection::selectedIndexes() const 
+{ 
+  return myWorkshop->objectBrowser()->selectedIndexes();
+}
+
+//**************************************************************
+void XGUI_Selection::selectedAISObjects(AIS_ListOfInteractive& theList) const
+{
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  theList.Clear();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected())
+    theList.Append(aContext->SelectedInteractive());
+}
+
+//**************************************************************
+void XGUI_Selection::selectedShapes(NCollection_List<TopoDS_Shape>& theList) const
+{
+  theList.Clear();
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+    TopoDS_Shape aShape = aContext->SelectedShape();
+    if (!aShape.IsNull())
+      theList.Append(aShape);
+  }
+}
diff --git a/src/XGUI/XGUI_Selection.h b/src/XGUI/XGUI_Selection.h
new file mode 100644 (file)
index 0000000..c6f92f5
--- /dev/null
@@ -0,0 +1,56 @@
+// File:        XGUI_Selection.h
+// Created:     8 July 2014
+// Author:      Vitaly SMETANNIKOV
+
+#ifndef XGUI_Selection_H
+#define XGUI_Selection_H
+
+#include "XGUI.h"
+
+#include <ModuleBase_ViewerPrs.h>
+#include <ModuleBase_Definitions.h>
+#include <ModuleBase_ISelection.h>
+
+#include <QModelIndexList>
+#include <AIS_ListOfInteractive.hxx>
+#include <NCollection_List.hxx>
+#include <TopoDS_Shape.hxx>
+
+#include <list>
+
+class XGUI_Workshop;
+
+class XGUI_EXPORT XGUI_Selection: public ModuleBase_ISelection
+{
+public:
+  XGUI_Selection(XGUI_Workshop* theWorkshop);
+
+  /// Returns a list of viewer selected presentations
+  /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
+  /// \return list of presentations
+  std::list<ModuleBase_ViewerPrs> getSelected(int theShapeTypeToSkip = -1) const;
+
+  /// Returns a list of viewer highlited presentations
+  /// \param theShapeTypeToSkip the shapes with this type will be skipped during the result list build
+  /// \return list of presentations
+  std::list<ModuleBase_ViewerPrs> getHighlighted(int theShapeTypeToSkip = -1) const;
+
+  /**
+  * Returns list of features currently selected in 3d viewer
+  */
+  QFeatureList selectedFeatures() const;
+  
+  //! Returns list of currently selected QModelIndexes
+  QModelIndexList selectedIndexes() const;
+
+  //! Returns list of currently selected AIS objects
+  void selectedAISObjects(AIS_ListOfInteractive& theList) const;
+
+  //! Returns list of currently selected shapes
+  void selectedShapes(NCollection_List<TopoDS_Shape>& theList) const;
+
+private:
+  XGUI_Workshop* myWorkshop;
+};
+
+#endif
\ No newline at end of file
index 9f830a74ec5757257915168ab59afcb277ad6e58..d1d9f83a0a008f3c01f825b84c7dcd43ca1c84c1 100644 (file)
@@ -6,6 +6,7 @@
 #include "XGUI_SalomeConnector.h"
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_Displayer.h"
+#include "XGUI_Selection.h"
 
 #include <ModelAPI_Feature.h>
 #include <ModelAPI_PluginManager.h>
 XGUI_SelectionMgr::XGUI_SelectionMgr(XGUI_Workshop* theParent) :
   QObject(theParent), myWorkshop(theParent)
 {
+  mySelection = new XGUI_Selection(myWorkshop);
 }
 
 XGUI_SelectionMgr::~XGUI_SelectionMgr()
 {
+  delete mySelection;
 }
 
 //**************************************************************
@@ -37,24 +40,29 @@ void XGUI_SelectionMgr::connectViewers()
 //**************************************************************
 void XGUI_SelectionMgr::onObjectBrowserSelection()
 {
-  QFeatureList aFeatures = selectedFeatures();
+  QFeatureList aFeatures = myWorkshop->objectBrowser()->selectedFeatures();
   XGUI_Displayer* aDisplayer = myWorkshop->displayer();
   aDisplayer->setSelected(aFeatures);
-
   emit selectionChanged();
 }
 
 //**************************************************************
 void XGUI_SelectionMgr::onViewerSelection()
 {
-  XGUI_Displayer* aDisplayer = myWorkshop->displayer();
-  QFeatureList aFeatures = aDisplayer->selectedFeatures();
+  QFeatureList aFeatures;
+  Handle(AIS_InteractiveContext) aContext = myWorkshop->viewer()->AISContext();
+  for (aContext->InitSelected(); aContext->MoreSelected(); aContext->NextSelected()) {
+    Handle(AIS_InteractiveObject) anIO = aContext->SelectedInteractive();
+    FeaturePtr aFeature = myWorkshop->displayer()->getFeature(anIO);
+    if (aFeature)
+      aFeatures.append(aFeature);
+  }
   myWorkshop->objectBrowser()->setFeaturesSelected(aFeatures);
   emit selectionChanged();
 }
 
 //**************************************************************
-QFeatureList XGUI_SelectionMgr::selectedFeatures() const 
+/*QFeatureList XGUI_SelectionMgr::selectedFeatures() const 
 { 
   return myWorkshop->objectBrowser()->selectedFeatures(); 
 }
@@ -84,4 +92,4 @@ void XGUI_SelectionMgr::selectedShapes(NCollection_List<TopoDS_Shape>& theList)
     if (!aShape.IsNull())
       theList.Append(aShape);
   }
-}
+}*/
index e98b52841fb76fb321e910d51a52e1ebdbfb7b76..93f19284c72f34fdfe66899494b2933a578c6c86 100644 (file)
@@ -12,6 +12,7 @@
 
 class XGUI_Workshop;
 class XGUI_ObjectsBrowser;
+class XGUI_Selection;
 
 /**\class XGUI_SelectionMgr
  * \ingroup GUI
@@ -25,17 +26,19 @@ public:
   XGUI_SelectionMgr(XGUI_Workshop* theParent);
   virtual ~XGUI_SelectionMgr();
 
+  XGUI_Selection* selection() const { return mySelection; }
+
   //! Returns list of currently selected data objects
-  QFeatureList selectedFeatures() const; 
+  //QFeatureList selectedFeatures() const; 
   
   //! Returns list of currently selected QModelIndexes
-  QModelIndexList selectedIndexes() const;
+  //QModelIndexList selectedIndexes() const;
 
   //! Returns list of currently selected AIS objects
-  void selectedAISObjects(AIS_ListOfInteractive& theList) const;
+  //void selectedAISObjects(AIS_ListOfInteractive& theList) const;
 
   //! Returns list of currently selected shapes
-  void selectedShapes(NCollection_List<TopoDS_Shape>& theList) const;
+  //void selectedShapes(NCollection_List<TopoDS_Shape>& theList) const;
 
   //! Connects the manager to all viewers accessible by Workshop
   void connectViewers();
@@ -49,8 +52,8 @@ private slots:
   void onViewerSelection();
 
 private:
-
   XGUI_Workshop* myWorkshop;
+  XGUI_Selection* mySelection;
 };
 
 #endif
diff --git a/src/XGUI/XGUI_ViewerPrs.cpp b/src/XGUI/XGUI_ViewerPrs.cpp
deleted file mode 100644 (file)
index f280905..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-// File:        XGUI_ViewerPrs.cpp
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
-
-#include "XGUI_ViewerPrs.h"
-
-#include "SelectMgr_EntityOwner.hxx"
-
-XGUI_ViewerPrs::XGUI_ViewerPrs()
-{
-}
-
-XGUI_ViewerPrs::XGUI_ViewerPrs(FeaturePtr theFeature,
-                               const TopoDS_Shape& theShape,
-                               Handle(SelectMgr_EntityOwner) theOwner)
-: myFeature(theFeature), myShape(theShape), myOwner(theOwner)
-{
-}
-
-XGUI_ViewerPrs::~XGUI_ViewerPrs()
-{
-}
-
-void XGUI_ViewerPrs::setFeature(FeaturePtr theFeature)
-{
-  myFeature = theFeature;
-}
-
-FeaturePtr XGUI_ViewerPrs::feature() const
-{
-  return myFeature;
-}
-
-void XGUI_ViewerPrs::setOwner(Handle(SelectMgr_EntityOwner) theOwner)
-{
-  myOwner = theOwner;
-}
-
-Handle(SelectMgr_EntityOwner) XGUI_ViewerPrs::owner() const
-{
-  return myOwner;
-}
-
-void XGUI_ViewerPrs::setShape(const TopoDS_Shape& theShape)
-{
-  myShape = theShape;
-}
-
-const TopoDS_Shape& XGUI_ViewerPrs::shape() const
-{
-  return myShape;
-}
-
-bool XGUI_ViewerPrs::operator==(const XGUI_ViewerPrs& thePrs)
-{
-  bool aFeature = (myFeature.get() == thePrs.feature().get());
-  bool aOwner = (myOwner.Access() == thePrs.owner().Access());
-  bool aShape = myShape.IsEqual(thePrs.shape());
-  return aFeature && aOwner && aShape;
-}
diff --git a/src/XGUI/XGUI_ViewerPrs.h b/src/XGUI/XGUI_ViewerPrs.h
deleted file mode 100644 (file)
index 808640c..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-// File:        XGUI_ViewerPrs.h
-// Created:     20 Apr 2014
-// Author:      Natalia ERMOLAEVA
-
-#ifndef XGUI_ViewerPrs_H
-#define XGUI_ViewerPrs_H
-
-#include "XGUI.h"
-
-#include <boost/shared_ptr.hpp>
-#include <TopoDS_Shape.hxx>
-#include <SelectMgr_EntityOwner.hxx>
-
-#include <ModelAPI_Feature.h>
-
-/**\class XGUI_ViewerPrs
- * \ingroup GUI
- * \brief Presentation. Provides container to have feature, shape and/or selection owner.
- */
-class XGUI_EXPORT XGUI_ViewerPrs
-{
-public:
-  /// Constructor
-  XGUI_ViewerPrs();
-  /// Constructor
-  /// \param theFeature a model feature
-  /// \param theShape a viewer shape
-  /// \param theOwner a selection owner
-  XGUI_ViewerPrs(FeaturePtr theFeature,
-                 const TopoDS_Shape& theShape,
-                 Handle_SelectMgr_EntityOwner theOwner);
-  /// Destructor
-  virtual ~XGUI_ViewerPrs();
-
-  /// Sets the feature.
-  /// \param theFeature a feature instance
-  void setFeature(FeaturePtr theFeature);
-
-  /// Returns the feature.
-  /// \return a feature instance
-  FeaturePtr feature() const;
-
-  /// Returns the presentation owner
-  /// \param the owner
-  void setOwner(Handle_SelectMgr_EntityOwner theOwner);
-
-  /// Returns the presentation owner
-  /// \return an owner
-  Handle_SelectMgr_EntityOwner owner() const;
-
-  /// Sets the shape
-  /// \param theShape a shape instance
-  void setShape(const TopoDS_Shape& theShape);
-
-  /// Returns the shape
-  /// \return a shape instance
-  const TopoDS_Shape& shape() const;
-
-  bool operator==(const XGUI_ViewerPrs&);
-
-private:
-  FeaturePtr myFeature; /// the feature
-  Handle(SelectMgr_EntityOwner) myOwner; /// the selection owner
-  TopoDS_Shape myShape; /// the shape
-};
-
-#endif
index c6b5f55bdba54bdae36878bed97f64a6cbe8613a..b5b0b5f6baeeb50b95d9cd621859c12dd4d9cfdf 100644 (file)
@@ -10,6 +10,7 @@
 #include "XGUI_Viewer.h"
 #include "ModuleBase_WidgetFactory.h"
 #include "XGUI_SelectionMgr.h"
+#include "XGUI_Selection.h"
 #include "XGUI_ObjectsBrowser.h"
 #include "XGUI_Displayer.h"
 #include "XGUI_OperationMgr.h"
@@ -38,7 +39,7 @@
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_OperationDescription.h>
-#include <ModuleBase_ViewSelectionValidator.h>
+#include <ModuleBase_SelectionValidator.h>
 
 #include <Config_Common.h>
 #include <Config_FeatureMessage.h>
@@ -857,7 +858,7 @@ XGUI_SalomeViewer* XGUI_Workshop::salomeViewer() const
 //**************************************************************
 void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
 {
-  QFeatureList aFeatures = mySelector->selectedFeatures();
+  QFeatureList aFeatures = mySelector->selection()->selectedFeatures();
   if ((theId == "ACTIVATE_PART_CMD") && (aFeatures.size() > 0))
     activatePart(aFeatures.first());
   else if (theId == "DEACTIVATE_PART_CMD") 
@@ -964,17 +965,17 @@ void XGUI_Workshop::updateCommandsOnViewSelection()
 {
   PluginManagerPtr aMgr = ModelAPI_PluginManager::get();
   ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
-  Handle(AIS_InteractiveContext) aContext = viewer()->AISContext();
+  XGUI_Selection* aSelection = mySelector->selection();
 
   QList<QAction*> aActions = getModuleCommands();
   foreach(QAction* aAction, aActions) {
     QString aId = aAction->data().toString();
     const ModelAPI_Validator* aValidator = aFactory->validator(aId.toStdString());
     if (aValidator) {
-      const ModuleBase_ViewSelectionValidator* aSelValidator = 
-        dynamic_cast<const ModuleBase_ViewSelectionValidator*>(aValidator);
+      const ModuleBase_SelectionValidator* aSelValidator = 
+        dynamic_cast<const ModuleBase_SelectionValidator*>(aValidator);
       if (aSelValidator) {
-        aAction->setEnabled(aSelValidator->isValid(aContext));
+        aAction->setEnabled(aSelValidator->isValid(aSelection));
       }
     }
   }