SHAPER  9.15.0
PlaneGCSSolver_Storage.h
1 // Copyright (C) 2014-2025 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_Storage_H_
21 #define PlaneGCSSolver_Storage_H_
22 
23 #include <PlaneGCSSolver_Defs.h>
24 #include <SketchSolver_Storage.h>
25 
27 
33 {
34 public:
35  PlaneGCSSolver_Storage(const SolverPtr& theSolver);
36 
37 // ============= Inherited from SketchSolver_Storage =============
38 
43  virtual void addConstraint(ConstraintPtr theConstraint,
44  ConstraintWrapperPtr theSolverConstraint);
45 
49  virtual void addMovementConstraint(const ConstraintWrapperPtr& theSolverConstraint);
50 
51 
56  virtual bool update(FeaturePtr theFeature, bool theForce = false);
57 
62  virtual bool update(AttributePtr theAttribute, bool theForce = false);
63 
65  virtual void makeExternal(const EntityWrapperPtr& theEntity);
67  virtual void makeNonExternal(const EntityWrapperPtr& theEntity);
68 
71  virtual bool removeConstraint(ConstraintPtr theConstraint);
72 
73  // Change status of constraints.
74  virtual bool changeActiveStatus(ConstraintPtr theConstraint, bool theNewState);
75 
76  virtual bool UpdateDeactivateList();
77 
82 
84  virtual void refresh() const;
85 
87  double* createParameter();
89  void removeParameters(const GCS::SET_pD& theParams);
90 
92  virtual void removeInvalidEntities();
93 
95  virtual bool isEmpty() const
96  { return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty(); }
97 
101  virtual void adjustParametrizationOfArcs();
102 
104  virtual void getUnderconstrainedGeometry(std::set<ObjectPtr>& theFeatures) const;
105 
106 private:
108  EntityWrapperPtr createFeature(const FeaturePtr& theFeature,
109  PlaneGCSSolver_EntityBuilder* theBuilder);
110 
112  EntityWrapperPtr createAttribute(const AttributePtr& theAttribute,
113  PlaneGCSSolver_EntityBuilder* theBuilder);
114 
118  void createAuxiliaryConstraints(const EntityWrapperPtr& theEntity);
119  void removeAuxiliaryConstraints(const EntityWrapperPtr& theEntity);
120 
121 private:
122  ConstraintID myConstraintLastID;
123 
125  std::map<EntityWrapperPtr, ConstraintWrapperPtr> myAuxConstraintMap;
126 
128  std::list<GCSConstraintPtr> myRemovedConstraints;
129 };
130 
131 #endif
API to convert data model entity to the entity applicable for PlaneGCS solver.
Definition: PlaneGCSSolver_EntityBuilder.h:31
SolveStatus
The result of constraints solution.
Definition: PlaneGCSSolver_Solver.h:33
Contains all necessary data in PlaneGCS format to solve a single group of constraints.
Definition: PlaneGCSSolver_Storage.h:33
double * createParameter()
Initialize memory for new solver's parameter.
Definition: PlaneGCSSolver_Storage.cpp:633
virtual void adjustParametrizationOfArcs()
Make parametrization of arcs consistent.
Definition: PlaneGCSSolver_Storage.cpp:463
void removeParameters(const GCS::SET_pD &theParams)
Release memory occupied by parameters.
Definition: PlaneGCSSolver_Storage.cpp:638
virtual void addMovementConstraint(const ConstraintWrapperPtr &theSolverConstraint)
Add a movement constraint which will be destroyed after the next solving of the set of constraints.
Definition: PlaneGCSSolver_Storage.cpp:74
virtual bool isEmpty() const
Check the storage has constraints.
Definition: PlaneGCSSolver_Storage.h:95
virtual void addConstraint(ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint)
Change mapping between constraint from SketchPlugin and a constraint applicable for corresponding sol...
Definition: PlaneGCSSolver_Storage.cpp:63
virtual bool removeConstraint(ConstraintPtr theConstraint)
Removes constraint from the storage.
Definition: PlaneGCSSolver_Storage.cpp:496
virtual void getUnderconstrainedGeometry(std::set< ObjectPtr > &theFeatures) const
Return list of features which are not fully constrained.
Definition: PlaneGCSSolver_Storage.cpp:752
virtual void refresh() const
Update SketchPlugin features after resolving constraints.
Definition: PlaneGCSSolver_Storage.cpp:662
virtual void removeInvalidEntities()
Remove all features became invalid.
Definition: PlaneGCSSolver_Storage.cpp:580
virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const
Verify, the sketch contains degenerated geometry after resolving the set of constraints.
Definition: PlaneGCSSolver_Storage.cpp:740
virtual void makeNonExternal(const EntityWrapperPtr &theEntity)
Make entity non-external.
Definition: PlaneGCSSolver_Storage.cpp:237
virtual void makeExternal(const EntityWrapperPtr &theEntity)
Make entity external.
Definition: PlaneGCSSolver_Storage.cpp:224
virtual bool update(FeaturePtr theFeature, bool theForce=false)
Convert feature to the form applicable for specific solver and map it.
Definition: PlaneGCSSolver_Storage.cpp:129
Interface to map SketchPlugin features to the entities of corresponding solver.
Definition: SketchSolver_Storage.h:44
virtual bool isEmpty() const
Check the storage has constraints.
Definition: SketchSolver_Storage.h:123