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 <PlaneGCSSolver_EntityWrapper.h>
17 /** \class PlaneGCSSolver_UpdateCoincidence
19 * \brief Send events to listeners about changing a constraint
21 class PlaneGCSSolver_UpdateCoincidence : public PlaneGCSSolver_Update
24 PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr())
25 : PlaneGCSSolver_Update(theNext)
28 virtual ~PlaneGCSSolver_UpdateCoincidence() {}
30 /// \brief Group of entities, processed by this kind of updater
31 static const std::string& GROUP()
33 static const std::string TYPE("Coincidence");
37 /// \brief Attach listener
38 /// \param theObserver [in] object which want to receive notifications
39 /// \param theType [in] receive notifications about changing objects
40 /// of theType and their derivatives
41 virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType);
43 /// \brief Send notification about update of the feature to all interested
44 virtual void update(const FeaturePtr& theFeature);
46 /// \brief Verifies the entities are not coincident yet
47 /// \return \c true if the entities does not coincident
48 bool checkCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2);
50 /// \brief Verifies the point is coincident to the feature
51 /// \return \c true if the point is on the feature
52 bool isPointOnEntity(const EntityWrapperPtr& thePoint, const EntityWrapperPtr& theEntity);
55 /// \brief Container for collecting and operating coincident entities
56 class CoincidentEntities
59 CoincidentEntities(const EntityWrapperPtr& theEntity1,
60 const EntityWrapperPtr& theEntity2);
62 /// Verify the entity is already in the list
63 bool isExist(const EntityWrapperPtr& theEntity) const;
64 /// Verify the point is already in the list
65 bool isExist(const GCS::Point& thePoint) const;
66 /// Check the coincidence is not in list yet
67 bool isNewCoincidence(const EntityWrapperPtr& theEntityExist,
68 const EntityWrapperPtr& theOtherEntity);
69 bool isNewCoincidence(const EntityWrapperPtr& theEntityExist,
70 const CoincidentEntities& theOtherGroup,
71 const EntityWrapperPtr& theEntityInOtherGroup);
74 bool hasExternal() const;
77 /// external entity and set of entities connected to it
78 std::map<EntityWrapperPtr, std::set<EntityWrapperPtr> > myExternalAndConnected;
81 std::list<CoincidentEntities> myCoincident; ///< list of coincidences