X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FPlaneGCSSolver%2FPlaneGCSSolver_UpdateCoincidence.h;h=29247709f45053988ffbcf07bfa5091a09a0c45c;hb=97917d3698f5a2f7fc9596e7c755ff8f6751e373;hp=44f36c4653289d989b2bc9d5fe20cf1b096d6804;hpb=06c0edf62e2731aa86b4ea0fac9f99a6b685f2ac;p=modules%2Fshaper.git diff --git a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h index 44f36c465..29247709f 100644 --- a/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h +++ b/src/SketchSolver/PlaneGCSSolver/PlaneGCSSolver_UpdateCoincidence.h @@ -1,14 +1,31 @@ -// Copyright (C) 2017-20xx CEA/DEN, EDF R&D - -// File: PlaneGCSSolver_UpdateCoincidence.h -// Created: 17 Feb 2017 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef PlaneGCSSolver_UpdateCoincidence_H_ #define PlaneGCSSolver_UpdateCoincidence_H_ #include -#include +#include + +#include + +#include /** \class PlaneGCSSolver_UpdateCoincidence * \ingroup Plugins @@ -39,12 +56,55 @@ public: /// \brief Send notification about update of the feature to all interested virtual void update(const FeaturePtr& theFeature); - /// \brief Verifies the entities are not coincident yet - /// \return \c true if the entities does not coincident - bool checkCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2); + /// \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 myPoints; ///< coincident points + std::set myExternalPoints; //< external points coincident to other points + std::set myFeatures; ///< other entities containing points + }; + + /// \brief Search the group of coincidences containing given entity. + /// Searches points only. + std::list::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); private: - std::list > myCoincident; ///< list of coincidences + std::list myCoincident; ///< list of coincidences }; #endif