1 // Copyright (C) 2017-20xx CEA/DEN, EDF R&D
3 // File: PlaneGCSSolver_UpdateCoincidence.h
4 // Created: 17 Feb 2017
5 // Author: Artem ZHIDKOV
7 #ifndef PlaneGCSSolver_UpdateCoincidence_H_
8 #define PlaneGCSSolver_UpdateCoincidence_H_
10 #include <PlaneGCSSolver_Update.h>
11 #include <SketchSolver_IEntityWrapper.h>
15 /** \class PlaneGCSSolver_UpdateCoincidence
17 * \brief Send events to listeners about changing a constraint
19 class PlaneGCSSolver_UpdateCoincidence : public PlaneGCSSolver_Update
22 PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr())
23 : PlaneGCSSolver_Update(theNext)
26 virtual ~PlaneGCSSolver_UpdateCoincidence() {}
28 /// \brief Group of entities, processed by this kind of updater
29 static const std::string& GROUP()
31 static const std::string TYPE("Coincidence");
35 /// \brief Attach listener
36 /// \param theObserver [in] object which want to receive notifications
37 /// \param theType [in] receive notifications about changing objects
38 /// of theType and their derivatives
39 virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType);
41 /// \brief Send notification about update of the feature to all interested
42 virtual void update(const FeaturePtr& theFeature);
44 /// \brief Verifies the entities are not coincident yet
45 /// \return \c true if the entities does not coincident
46 bool checkCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2);
49 /// \brief Container for collecting and operating coincident entities
50 class CoincidentEntities
53 CoincidentEntities(const EntityWrapperPtr& theEntity1,
54 const EntityWrapperPtr& theEntity2);
56 /// Verify the entity is already in the list
57 bool isExist(const EntityWrapperPtr& theEntity) const;
58 /// Check the coincidence is not in list yet
59 bool isNewCoincidence(const EntityWrapperPtr& theEntityExist,
60 const EntityWrapperPtr& theOtherEntity);
61 bool isNewCoincidence(const EntityWrapperPtr& theEntityExist,
62 const CoincidentEntities& theOtherGroup,
63 const EntityWrapperPtr& theEntityInOtherGroup);
66 bool hasExternal() const;
69 /// external entity and set of entities connected to it
70 std::map<EntityWrapperPtr, std::set<EntityWrapperPtr> > myExternalAndConnected;
73 std::list<CoincidentEntities> myCoincident; ///< list of coincidences