Salome HOME
An improvement to deselect a value in a shape selector control in the same way as...
[modules/shaper.git] / src / XGUI / XGUI_Displayer.h
index bfdf8a5d58dfc26824948896719e6dc78ec70907..7c66603442255abb3fcad566f4401481cd81f92b 100644 (file)
@@ -19,7 +19,6 @@
 
 #include <ModuleBase_Definitions.h>
 #include <ModuleBase_ViewerPrs.h>
-#include <ModuleBase_FilterValidated.h>
 
 #include <GeomAPI_ICustomPrs.h>
 
@@ -27,6 +26,8 @@
 
 #include <QString>
 #include <QMap>
+#include <QObject>
+#include <QColor>
 
 class ModelAPI_Feature;
 class XGUI_Workshop;
@@ -35,8 +36,9 @@ class XGUI_Workshop;
  * \ingroup GUI
  * \brief Displayer. Provides mechanizm of display/erase of objects in the viewer
  */
-class XGUI_EXPORT XGUI_Displayer
+class XGUI_EXPORT XGUI_Displayer: public QObject
 {
+  Q_OBJECT
  public:
    /// \enum DisplayMode display mode
    enum DisplayMode { 
@@ -70,6 +72,12 @@ class XGUI_EXPORT XGUI_Displayer
   /// \param isUpdate the parameter whether the viewer should be update immediatelly
   void displayAIS(AISObjectPtr theAIS, bool isUpdate = true);
 
+  /** Redisplay the shape if it was displayed
+   * \param theObject an object instance
+   * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
+   */
+  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
@@ -77,6 +85,8 @@ class XGUI_EXPORT XGUI_Displayer
    */
   void setSelected(const QObjectPtrList& theFeatures, bool isUpdateViewer = true);
 
+  void setSelected(const  QList<ModuleBase_ViewerPrs>& theValues, bool isUpdateViewer = true);
+
 
   /// Unselect all objects
   void clearSelected();
@@ -118,7 +128,7 @@ class XGUI_EXPORT XGUI_Displayer
   bool enableUpdateViewer(const bool isEnabled);
 
   /// Updates the viewer
-  void updateViewer();
+  void updateViewer() const;
 
   /// Searches the interactive object by feature
   /// \param theObject the object or presentable feature
@@ -182,10 +192,31 @@ class XGUI_EXPORT XGUI_Displayer
   /// Returns list of displayed objects
   QObjectPtrList displayedObjects() const { return myResult2AISObjectMap.keys(); }
 
+  /// Returns list of displayed objects
+  QList<AISObjectPtr> displayedPresentations() const { return myResult2AISObjectMap.values(); }
+
   /// Returns true if the given object can be shown in shaded mode
   /// \param theObject object to check
   bool canBeShaded(ObjectPtr theObject) const;
 
+  /// Set color on presentation of an object if it is displayed
+  /// \param theObject an object 
+  /// \param theColor a color which has to be set
+  /// \param toUpdate update viewer flag
+  /// \return previously defined color on the object
+  QColor setObjectColor(ObjectPtr theObject, const QColor& theColor, bool toUpdate = true);
+
+signals:
+  /// Signal on object display
+  /// \param theObject a data object
+  /// \param theAIS a presentation object
+  void objectDisplayed(ObjectPtr theObject, AISObjectPtr theAIS);
+
+  /// Signal on before object erase
+  /// \param theObject a data object
+  /// \param theAIS a presentation object
+  void beforeObjectErase(ObjectPtr theObject, AISObjectPtr theAIS);
+
  protected:
   /// Returns currently installed AIS_InteractiveContext
   Handle(AIS_InteractiveContext) AISContext() const;
@@ -203,12 +234,7 @@ class XGUI_EXPORT XGUI_Displayer
   void display(ObjectPtr theObject, AISObjectPtr theAIS, bool isShading,
                bool isUpdateViewer = true);
 
-  /** Redisplay the shape if it was displayed
-   * \param theObject an object instance
-   * \param isUpdateViewer the parameter whether the viewer should be update immediatelly
-   */
-  void redisplay(ObjectPtr theObject, bool isUpdateViewer = true);
-
+private:
   /// Activates the interactive object in the local context.
   /// \param theIO an interactive object
   /// \param theModes - modes on which it has to be activated (can be empty)
@@ -232,8 +258,6 @@ class XGUI_EXPORT XGUI_Displayer
   /// A container for selection filters
   Handle(SelectMgr_AndFilter) myAndFilter;
 
-  Handle(ModuleBase_FilterValidated) myFilterValidated;
-
   /// A default custom presentation, which is used if the displayed feature is not a custom presentation
   GeomCustomPrsPtr myCustomPrs;