SHAPER 9.16.0
PlaneGCSSolver_UpdateCoincidence.h
1// Copyright (C) 2014-2026 CEA, EDF
2//
3// This library is free software; you can redistribute it and/or
4// modify it under the terms of the GNU Lesser General Public
5// License as published by the Free Software Foundation; either
6// version 2.1 of the License, or (at your option) any later version.
7//
8// This library is distributed in the hope that it will be useful,
9// but WITHOUT ANY WARRANTY; without even the implied warranty of
10// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11// Lesser General Public License for more details.
12//
13// You should have received a copy of the GNU Lesser General Public
14// License along with this library; if not, write to the Free Software
15// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16//
17// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18//
19
20#ifndef PlaneGCSSolver_UpdateCoincidence_H_
21#define PlaneGCSSolver_UpdateCoincidence_H_
22
23#include <PlaneGCSSolver_Update.h>
24#include <PlaneGCSSolver_EntityWrapper.h>
25
26#include <GCS.h>
27
28#include <map>
29
35{
36public:
37 PlaneGCSSolver_UpdateCoincidence(UpdaterPtr theNext = UpdaterPtr())
38 : PlaneGCSSolver_Update(theNext)
39 {}
40
42
44 static const std::string& GROUP()
45 {
46 static const std::string TYPE("Coincidence");
47 return TYPE;
48 }
49
54 virtual void attach(SketchSolver_Constraint* theObserver, const std::string& theType);
55
57 virtual void update(const FeaturePtr& theFeature);
58
61 bool addCoincidence(const EntityWrapperPtr& theEntity1, const EntityWrapperPtr& theEntity2);
62
65 bool isPointOnEntity(const EntityWrapperPtr& thePoint, const EntityWrapperPtr& theEntity);
66
67private:
69 class CoincidentEntities
70 {
71 public:
72 CoincidentEntities(const EntityWrapperPtr& theEntity1,
73 const EntityWrapperPtr& theEntity2);
74
76 bool isExist(const EntityWrapperPtr& theEntity) const;
78 bool isExist(const GCS::Point& thePoint) const;
79
81 bool add(const EntityWrapperPtr& theEntity);
82
84 void remove(const EntityWrapperPtr& theEntity);
85
87 void merge(const CoincidentEntities& theOther);
88
90 EntityWrapperPtr externalPoint() const;
91
92 private:
93 std::set<EntityWrapperPtr> myPoints;
94 std::set<EntityWrapperPtr> myExternalPoints; //< external points coincident to other points
95 std::set<EntityWrapperPtr> myFeatures;
96 };
97
100 std::list<CoincidentEntities>::iterator findGroupOfCoincidence(const EntityWrapperPtr& theEntity);
101
104 bool addToGroupOfCoincidence(CoincidentEntities& theGroup, const EntityWrapperPtr& theEntity);
105
106private:
107 std::list<CoincidentEntities> myCoincident;
108};
109
110#endif
Send events to listeners about changing a constraint.
Definition: PlaneGCSSolver_UpdateCoincidence.h:35
bool addCoincidence(const EntityWrapperPtr &theEntity1, const EntityWrapperPtr &theEntity2)
Set coincidence between two given entities.
Definition: PlaneGCSSolver_UpdateCoincidence.cpp:74
virtual void attach(SketchSolver_Constraint *theObserver, const std::string &theType)
Attach listener.
Definition: PlaneGCSSolver_UpdateCoincidence.cpp:34
bool isPointOnEntity(const EntityWrapperPtr &thePoint, const EntityWrapperPtr &theEntity)
Verifies the point is coincident to the feature.
Definition: PlaneGCSSolver_UpdateCoincidence.cpp:115
static const std::string & GROUP()
Group of entities, processed by this kind of updater.
Definition: PlaneGCSSolver_UpdateCoincidence.h:44
virtual void update(const FeaturePtr &theFeature)
Send notification about update of the feature to all interested.
Definition: PlaneGCSSolver_UpdateCoincidence.cpp:49
Send events to listeners about changing a feature.
Definition: PlaneGCSSolver_Update.h:38
Converts SketchPlugin constraint to the constraint applicable for solver.
Definition: SketchSolver_Constraint.h:39