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 /// If active state is changed, update fully defined state and sketch sub-entities color
37 /// \param theActive a state
38 void setActive(const bool& theActive);
40 /// Returns true if the object belongs to internal container of conflicting objects
41 /// \param theObject an object to be checked
42 /// \param theColor the output container to be filled in [red, green, blue] values
43 /// \return boolean result
44 void getCustomColor(const ObjectPtr& theObject, std::vector<int>& theColor);
46 /// Redefinition of Events_Listener method
47 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
50 /// Append objects to the internal container of conflicting object, redisplay necessary objects
51 /// \param theObjects a list of new conflicting objects
52 /// \return boolean value whether the list differs from the internal list
53 bool appendConflictingObjects(const std::set<ObjectPtr>& theObjects);
55 /// Removes objects from internal container of conflicting object, redisplay necessary objects
56 /// \param theObjects a list of repaired objects
57 /// \return boolean value whether the list differs from the internal list
58 bool repairConflictingObjects(const std::set<ObjectPtr>& theObjects);
60 /// Sends update object signal for each object in the container and flush it.
61 /// \param theObjects a list of object to be redisplayed
62 void redisplayObjects(const std::set<ObjectPtr>& theObjects);
66 PartSet_Module* module() const;
69 /// Unite objects in one string information
70 /// \param theObjects a list of objects
71 /// \return a string info
72 static QString getObjectsInfo(const std::set<ObjectPtr>& theObjects);
76 ModuleBase_IWorkshop* myWorkshop;
77 bool myIsActive; /// state if sketch is active
78 std::set<ObjectPtr> myConflictingObjects;
79 bool myIsFullyConstrained; /// state if Solver is fully constrained, DOF = 0