SHAPER  9.12.0
PlaneGCSSolver_Storage.h
1 // Copyright (C) 2014-2023 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 
77 
79  virtual void refresh() const;
80 
82  double* createParameter();
84  void removeParameters(const GCS::SET_pD& theParams);
85 
87  virtual void removeInvalidEntities();
88 
90  virtual bool isEmpty() const
91  { return SketchSolver_Storage::isEmpty() && myAuxConstraintMap.empty(); }
92 
96  virtual void adjustParametrizationOfArcs();
97 
99  virtual void getUnderconstrainedGeometry(std::set<ObjectPtr>& theFeatures) const;
100 
101 private:
103  EntityWrapperPtr createFeature(const FeaturePtr& theFeature,
104  PlaneGCSSolver_EntityBuilder* theBuilder);
105 
107  EntityWrapperPtr createAttribute(const AttributePtr& theAttribute,
108  PlaneGCSSolver_EntityBuilder* theBuilder);
109 
113  void createAuxiliaryConstraints(const EntityWrapperPtr& theEntity);
114  void removeAuxiliaryConstraints(const EntityWrapperPtr& theEntity);
115 
116 private:
117  ConstraintID myConstraintLastID;
118 
120  std::map<EntityWrapperPtr, ConstraintWrapperPtr> myAuxConstraintMap;
121 
123  std::list<GCSConstraintPtr> myRemovedConstraints;
124 };
125 
126 #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:571
virtual void adjustParametrizationOfArcs()
Make parametrization of arcs consistent.
Definition: PlaneGCSSolver_Storage.cpp:462
void removeParameters(const GCS::SET_pD &theParams)
Release memory occupied by parameters.
Definition: PlaneGCSSolver_Storage.cpp:576
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:73
virtual bool isEmpty() const
Check the storage has constraints.
Definition: PlaneGCSSolver_Storage.h:90
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:487
virtual void getUnderconstrainedGeometry(std::set< ObjectPtr > &theFeatures) const
Return list of features which are not fully constrained.
Definition: PlaneGCSSolver_Storage.cpp:690
virtual void refresh() const
Update SketchPlugin features after resolving constraints.
Definition: PlaneGCSSolver_Storage.cpp:600
virtual void removeInvalidEntities()
Remove all features became invalid.
Definition: PlaneGCSSolver_Storage.cpp:518
virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const
Verify, the sketch contains degenerated geometry after resolving the set of constraints.
Definition: PlaneGCSSolver_Storage.cpp:678
virtual void makeNonExternal(const EntityWrapperPtr &theEntity)
Make entity non-external.
Definition: PlaneGCSSolver_Storage.cpp:236
virtual void makeExternal(const EntityWrapperPtr &theEntity)
Make entity external.
Definition: PlaneGCSSolver_Storage.cpp:223
virtual bool update(FeaturePtr theFeature, bool theForce=false)
Convert feature to the form applicable for specific solver and map it.
Definition: PlaneGCSSolver_Storage.cpp:128
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:118