+ /// \brief Set coincidence between two given entities
+ /// \return \c true if the entities does not coincident yet
+ bool addCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2);
+
+ /// \brief Verifies the point is coincident to the feature
+ /// \return \c true if the point is on the feature
+ bool isPointOnEntity(const EntityWrapperPtr& thePoint, const EntityWrapperPtr& theEntity);
+
+private:
+ /// \brief Container for collecting and operating coincident entities
+ class CoincidentEntities
+ {
+ public:
+ CoincidentEntities(const EntityWrapperPtr& theEntity1,
+ const EntityWrapperPtr& theEntity2);
+
+ /// Verify the entity is already in the list
+ bool isExist(const EntityWrapperPtr& theEntity) const;
+ /// Verify the point is already in the list
+ bool isExist(const GCS::Point& thePoint) const;
+
+ /// Add entity to group
+ bool add(const EntityWrapperPtr& theEntity);
+
+ /// Remove entity from group
+ void remove(const EntityWrapperPtr& theEntity);
+
+ /// Merge two groups
+ void merge(const CoincidentEntities& theOther);
+
+ /// Returns any of external points
+ EntityWrapperPtr externalPoint() const;
+
+ private:
+ std::set<EntityWrapperPtr> myPoints; ///< coincident points
+ std::set<EntityWrapperPtr> myExternalPoints; //< external points coincident to other points
+ std::set<EntityWrapperPtr> myFeatures; ///< other entities containing points
+ };
+
+ /// \brief Search the group of coincidences containing given entity.
+ /// Searches points only.
+ std::list<CoincidentEntities>::iterator findGroupOfCoincidence(const EntityWrapperPtr& theEntity);
+
+ /// \brief Add entity to group of coincidences
+ /// \reutrn \c true if the entity is added, thus the coincidence is new
+ bool addToGroupOfCoincidence(CoincidentEntities& theGroup, const EntityWrapperPtr& theEntity);