Salome HOME
Add copyright header according to request of CEA from 06.06.2017
[modules/shaper.git] / src / XGUI / XGUI_WorkshopListener.h
index cf611cb264680e099968938df799dfa85ffb36c5..486d8f88903f36a150cfd084ab09c4e6abb2e336 100755 (executable)
@@ -1,4 +1,22 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+//
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License, or (at your option) any later version.
+//
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// See http://www.salome-platform.org/ or
+// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+//
 
 #ifndef XGUI_WORKSHOP_LISTENER_H
 #define XGUI_WORKSHOP_LISTENER_H
@@ -8,6 +26,7 @@
 #include <Events_Message.h>
 
 #include <ModelAPI_Feature.h>
+#include <Events_InfoMessage.h>
 
 #include <QObject>
 
@@ -19,6 +38,7 @@ class XGUI_Workshop;
 class ModuleBase_IWorkshop;
 
 class QString;
+class Events_InfoMessage;
 
 /**\class XGUI_WorkshopListener
  * \ingroup GUI
@@ -29,7 +49,7 @@ class XGUI_EXPORT XGUI_WorkshopListener : public QObject, public Events_Listener
   Q_OBJECT
 public:
   /// Constructor. Used only if the workshop is launched in Salome environment
-  /// \param theWorkshop a reference to workshop. 
+  /// \param theWorkshop a reference to workshop.
    XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop);
   virtual ~XGUI_WorkshopListener();
 
@@ -41,35 +61,51 @@ public:
 
 signals:
   /// Emitted when error in applivation happens
-  void errorOccurred(const QString&);
+  void errorOccurred(std::shared_ptr<Events_InfoMessage> theMsg);
 
 protected:
   /// Procedure to process postponed events
   bool event(QEvent * theEvent);
 
-   /// Process event "Add a feature"
-  void addFeature(const std::shared_ptr<Config_FeatureMessage>&);
-
   /// Process feature update message
-  void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
+  /// \param theMsg a message with a container of objects
+  void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
 
   /// Process feature created message
-  void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
+  /// \param theMsg a message with a container of objects
+  void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
 
   /// Process feature redisplay message
-  void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
+  /// \param theMsg a message with a container of objects
+  void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
+
+  /// Process clearing of presentation
+  /// \param theMsg an event message
+  void onFeatureEmptyPresentationMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
 
   /// Displaus object and fit all viewer if the object is first (update viewer will not be called)
   /// Asks the module whether the object can be displayed
   /// \param theObj an object
-  /// \param theFirstVisualizedBody an output state whether there are not object displayed in the view
-  /// and the displayed object is a body
+  /// \param theFirstVisualizedBody an output state whether there are not object displayed in the
+  /// view and the displayed object is a body
   /// \return true if the object is displayed
-  bool displayObject(ObjectPtr theObj, bool& theFirstVisualizedBody);
+  bool displayObject(ObjectPtr theObj);
+
+  /// Answer if the viewer needed to be fit all after the object visualization
+  /// The condition is there is not shown objects and the object is a group or body result
+  /// \param theObject a shown object
+  /// \param theNbOfShownObjects a count of already shown objects in the viewer
+  /// \return true if fit all should be done
+  bool neededFitAll(ObjectPtr theObject, const int theNbOfShownObjects);
 
   /// Calls the module method of cusomize object for the feature of the current operation
+  /// Perform cusomize if the force redisplay flag is true or the list of objects contains the
+  /// current operation feature
+  /// \param theObjects a list of objects to find current operation feature
+  ///                   if forced redisplay is false
+  /// \param theForceRedisplay a flag to customize object even always
   /// \return true if the object is modified
-  bool customizeCurrentObject();
+  bool customizeCurrentObject(const std::set<ObjectPtr>& theObjects, bool theForceRedisplay);
 
   /// Returns the workshop
   XGUI_Workshop* workshop() const;