1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PartSet_OverconstraintListener.h
5 // Author: Natalia ERMOLAEVA
8 #ifndef PartSet_OverconstraintListener_H
9 #define PartSet_OverconstraintListener_H
11 #include <Events_Listener.h>
12 #include <ModelAPI_Object.h>
14 class ModuleBase_IWorkshop;
24 * A class for processing overconstraint situation. It contains is a list of sketch constraints with
27 class PartSet_OverconstraintListener : public Events_Listener
31 /// \param theWorkshop a current workshop to obtain AIS presentation from displayer
32 PartSet_OverconstraintListener(ModuleBase_IWorkshop* theWorkshop);
34 virtual ~PartSet_OverconstraintListener() {};
36 // Set erroneous color for the presentation of object if the object is in the conflicting list
37 // \param theObject an object to be settled
38 // \param theUpdateViewer a boolean state whether the current viewer should be updated
39 //bool customizeObject(ObjectPtr theObject, const bool theUpdateViewer);
41 /// Returns true if the object belongs to internal container of conflicting objects
42 /// \param theObject an object to be checked
43 /// \param theColor the output container to be filled in [red, green, blue] values
44 /// \return boolean result
45 void getCustomColor(const ObjectPtr& theObject, std::vector<int>& theColor);
47 /// Returns true if custom color of presentations is changed and it should be redisplayed
48 /// \return boolean value
49 bool isNeedUpdateCustomColor() const { return true;/*myIsNeedUpdateCustomColor;*/ }
51 /// Redefinition of Events_Listener method
52 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
55 /// Append objects to the internal container of conflicting object, redisplay necessary objects
56 /// \param theObjects a list of new conflicting objects
57 /// \return boolean value whether the list differs from the internal list
58 bool appendConflictingObjects(const std::set<ObjectPtr>& theObjects);
60 /// Removes objects from internal container of conflicting object, redisplay necessary objects
61 /// \param theObjects a list of repaired objects
62 /// \return boolean value whether the list differs from the internal list
63 bool repairConflictingObjects(const std::set<ObjectPtr>& theObjects);
65 /// Sends update object signal for each object in the container and flush it.
66 /// \param theObjects a list of object to be redisplayed
67 void redisplayObjects(const std::set<ObjectPtr>& theObjects);
71 XGUI_Workshop* workshop() const;
74 /// Unite objects in one string information
75 /// \param theObjects a list of objects
76 /// \return a string info
77 static QString getObjectsInfo(const std::set<ObjectPtr>& theObjects);
81 std::set<ObjectPtr> myConflictingObjects;
82 ModuleBase_IWorkshop* myWorkshop;
83 bool myIsFullyConstrained; /// state if Solver is fully constrained, DOF = 0
84 bool myIsNeedUpdateCustomColor;