1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef PartSet_OverconstraintListener_H
22 #define PartSet_OverconstraintListener_H
24 #include <Events_Listener.h>
25 #include <ModelAPI_Object.h>
27 class ModuleBase_IWorkshop;
37 * A class for processing overconstraint situation. It contains is a list of sketch constraints with
40 class PartSet_OverconstraintListener : public Events_Listener
44 /// \param theWorkshop a current workshop to obtain AIS presentation from displayer
45 PartSet_OverconstraintListener(ModuleBase_IWorkshop* theWorkshop);
47 virtual ~PartSet_OverconstraintListener() {};
49 /// If active state is changed, update fully defined state and sketch sub-entities color
50 /// \param theActive a state
51 void setActive(const bool& theActive);
53 /// Returns true if the object belongs to internal container of conflicting objects
54 /// \param theObject an object to be checked
55 /// \param theColor the output container to be filled in [red, green, blue] values
56 /// \return boolean result
57 void getCustomColor(const ObjectPtr& theObject, std::vector<int>& theColor);
59 /// Redefinition of Events_Listener method
60 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
63 /// Append objects to the internal container of conflicting object, redisplay necessary objects
64 /// \param theObjects a list of new conflicting objects
65 /// \return boolean value whether the list differs from the internal list
66 bool appendConflictingObjects(const std::set<ObjectPtr>& theObjects);
68 /// Removes objects from internal container of conflicting object, redisplay necessary objects
69 /// \param theObjects a list of repaired objects
70 /// \return boolean value whether the list differs from the internal list
71 bool repairConflictingObjects(const std::set<ObjectPtr>& theObjects);
73 /// Sends update object signal for each object in the container and flush it.
74 /// \param theObjects a list of object to be redisplayed
75 void redisplayObjects(const std::set<ObjectPtr>& theObjects);
79 PartSet_Module* module() const;
82 /// Unite objects in one string information
83 /// \param theObjects a list of objects
84 /// \return a string info
85 static QString getObjectsInfo(const std::set<ObjectPtr>& theObjects);
89 ModuleBase_IWorkshop* myWorkshop;
90 bool myIsActive; /// state if sketch is active
91 std::set<ObjectPtr> myConflictingObjects;
92 bool myIsFullyConstrained; /// state if Solver is fully constrained, DOF = 0