Salome HOME
SketchSolver Refactoring: Eliminate SolveSpace as a sketch solver.
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_UpdateCoincidence.h
1 // Copyright (C) 2017-20xx CEA/DEN, EDF R&D
2
3 // File:    PlaneGCSSolver_UpdateCoincidence.h
4 // Created: 17 Feb 2017
5 // Author:  Artem ZHIDKOV
6
7 #ifndef PlaneGCSSolver_UpdateCoincidence_H_
8 #define PlaneGCSSolver_UpdateCoincidence_H_
9
10 #include <PlaneGCSSolver_Update.h>
11 #include <SketchSolver_IEntityWrapper.h>
12
13 /** \class   PlaneGCSSolver_UpdateCoincidence
14  *  \ingroup Plugins
15  *  \brief   Send events to listeners about changing a constraint
16  */
17 class PlaneGCSSolver_UpdateCoincidence : public PlaneGCSSolver_Update
18 {
19 public:
20   PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr())
21     : PlaneGCSSolver_Update(theNext)
22   {}
23
24   virtual ~PlaneGCSSolver_UpdateCoincidence() {}
25
26   /// \brief Group of entities, processed by this kind of updater
27   static const std::string& GROUP()
28   {
29     static const std::string TYPE("Coincidence");
30     return TYPE;
31   }
32
33   /// \brief Attach listener
34   /// \param theObserver [in]  object which want to receive notifications
35   /// \param theType     [in]  receive notifications about changing objects
36   ///                          of theType and their derivatives
37   virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType) override;
38
39   /// \brief Send notification about update of the feature to all interested
40   virtual void update(const FeaturePtr& theFeature) override;
41
42   /// \brief Verifies the entities are not coincident yet
43   /// \return \c true if the entities does not coincident
44   bool checkCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2);
45
46 private:
47   std::list<std::set<EntityWrapperPtr> > myCoincident; ///< list of coincidences
48 };
49
50 #endif