]> SALOME platform Git repositories - modules/shaper.git/blob - src/PartSet/PartSet_OverconstraintListener.h
Salome HOME
2.17. Improved management of overconstraint situation: dimension constraints are...
[modules/shaper.git] / src / PartSet / PartSet_OverconstraintListener.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:        PartSet_OverconstraintListener.h
4 // Created:     8 Feb 2016
5 // Author:      Natalia ERMOLAEVA
6
7
8 #ifndef PartSet_OverconstraintListener_H
9 #define PartSet_OverconstraintListener_H
10
11 #include <Events_Listener.h>
12 #include <ModelAPI_Object.h>
13
14 class ModuleBase_IWorkshop;
15 class XGUI_Workshop;
16
17 #include <vector>
18 #include <set>
19
20 /**
21 * \ingroup GUI
22 * A class for processing overconstraint situation. It contains is a list of sketch constraints with
23 * conflicts.
24 */
25 class PartSet_OverconstraintListener : public Events_Listener
26 {
27 public:
28   /// Constructor
29   /// \param theWorkshop a current workshop to obtain AIS presentation from displayer
30   PartSet_OverconstraintListener(ModuleBase_IWorkshop* theWorkshop);
31
32   virtual ~PartSet_OverconstraintListener() {};
33
34   /// Set erroneous color for the presentation of object if the object is in the conflicting list
35   /// \param theObject an object to be settled
36   /// \param theUpdateViewer a boolean state whether the current viewer should be updated
37   //bool customizeObject(ObjectPtr theObject, const bool theUpdateViewer);
38
39   /// Returns true if the object belongs to internal container of conflicting objects
40   /// \param theObject an object to be checked
41   /// \return boolean result
42   bool isConflictingObject(const ObjectPtr& theObject);
43   
44   /// Returns values of conflicting color
45   /// \param theColor the output container to be filled in [red, green, blue] values
46   void getConflictingColor(std::vector<int>& theColor);
47
48   /// Redefinition of Events_Listener method
49   virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
50
51 protected:
52   /// Updates the internal container of conflicting object, redisplay necessary objects
53   /// \param theObjects a list of new conflicting objects
54   /// \return boolean value whether the list differs from the internal list
55   bool updateConflictingObjects(const std::set<ObjectPtr>& theObjects);
56
57   /// Obtains the object custom AIS presentation and change conflicting state if it exists
58   /// \param theObject the object which presentation error state should be changed
59   /// \param theConflicting if true, the object state is erroneous, else correct
60   void setConflictingObject(const ObjectPtr& theObject, const bool theConflicting);
61
62   /// Sends update object signal for each object in the container and flush it.
63   /// \param theObjects a list of object to be redisplayed
64   void redisplayObjects(const std::set<ObjectPtr>& theObjects);
65
66 private:
67   //! Returns workshop
68   XGUI_Workshop* workshop() const;
69
70 private:
71   std::set<ObjectPtr> myConflictingObjects;
72   ModuleBase_IWorkshop* myWorkshop;
73 };
74
75 #endif