20 #ifndef SketchSolver_Storage_H_
21 #define SketchSolver_Storage_H_
23 #include <PlaneGCSSolver_ConstraintWrapper.h>
24 #include <PlaneGCSSolver_EntityWrapper.h>
26 #include <PlaneGCSSolver_Solver.h>
27 #include <PlaneGCSSolver_UpdateFeature.h>
29 #include <ModelAPI_Attribute.h>
30 #include <ModelAPI_AttributeDouble.h>
31 #include <ModelAPI_Feature.h>
32 #include <SketchPlugin_Constraint.h>
35 class SketchSolver_ConstraintFixedArcRadius;
36 typedef std::map<EntityWrapperPtr, std::set<EntityWrapperPtr> > CoincidentPointsMap;
57 ConstraintWrapperPtr theSolverConstraint);
69 EntityWrapperPtr theSolverEntity);
76 EntityWrapperPtr theSolverEntity);
82 virtual bool update(FeaturePtr theFeature,
bool theForce =
false) = 0;
88 virtual bool update(AttributePtr theAttribute,
bool theForce =
false) = 0;
91 const ConstraintWrapperPtr&
constraint(
const ConstraintPtr& theConstraint)
const;
94 const EntityWrapperPtr&
entity(
const FeaturePtr& theFeature)
const;
96 const EntityWrapperPtr&
entity(
const AttributePtr& theAttribute)
const;
154 void notify(
const FeaturePtr& theFeature)
const;
164 FeaturePtr& theFeature,
165 AttributePtr& theAttribute);
179 UpdaterPtr myUpdaters;
182 typedef std::shared_ptr<SketchSolver_Storage> StoragePtr;
SolveStatus
The result of constraints solution.
Definition: PlaneGCSSolver_Solver.h:33
Convert distance constraint to SolveSpace structure.
Definition: SketchSolver_ConstraintDistance.h:30
Converts SketchPlugin constraint to the constraint applicable for solver.
Definition: SketchSolver_Constraint.h:39
Interface to map SketchPlugin features to the entities of corresponding solver.
Definition: SketchSolver_Storage.h:44
void subscribeUpdates(SketchSolver_Constraint *theSubscriber, const std::string &theGroup) const
Subscribe for updates of features.
Definition: SketchSolver_Storage.cpp:227
virtual bool isNeedToResolve()
Shows the sketch should be resolved.
Definition: SketchSolver_Storage.h:122
bool areFeaturesValid() const
Check the features have not been removed.
Definition: SketchSolver_Storage.cpp:189
bool myEventsBlocked
indicates that features do not send events
Definition: SketchSolver_Storage.h:170
SolverPtr mySketchSolver
Sketch solver, prepared in corresponding group.
Definition: SketchSolver_Storage.h:168
virtual void makeExternal(const EntityWrapperPtr &theEntity)=0
Make entity external.
void notify(const FeaturePtr &theFeature) const
Notify all subscribers about update of the feature.
Definition: SketchSolver_Storage.cpp:238
void addEntity(FeaturePtr theFeature, EntityWrapperPtr theSolverEntity)
Change mapping feature from SketchPlugin and the entity applicable for corresponding solver.
Definition: SketchSolver_Storage.cpp:96
virtual bool isEmpty() const
Check the storage has constraints.
Definition: SketchSolver_Storage.h:118
bool myNeedToResolve
parameters are changed and group needs to be resolved
Definition: SketchSolver_Storage.h:169
virtual void getUnderconstrainedGeometry(std::set< ObjectPtr > &theFeatures) const =0
Return list of features which are not fully constrained.
void blockEvents(bool isBlocked)
Block or unblock events when refreshing features.
Definition: SketchSolver_Storage.cpp:199
const ConstraintWrapperPtr & constraint(const ConstraintPtr &theConstraint) const
Returns constraint related to corresponding constraint.
Definition: SketchSolver_Storage.cpp:125
virtual void removeInvalidEntities()=0
Remove all features became invalid.
virtual void refresh() const =0
Update SketchPlugin features after resolving constraints.
void removeAttribute(AttributePtr theAttribute)
Removes attribute from the storage.
Definition: SketchSolver_Storage.cpp:182
virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry() const =0
Verify, the sketch contains degenerated geometry after resolving the set of constraints.
void unsubscribeUpdates(SketchSolver_Constraint *theSubscriber) const
Unsubscribe for updates of features.
Definition: SketchSolver_Storage.cpp:233
virtual void addMovementConstraint(const ConstraintWrapperPtr &theSolverConstraint)=0
Add a movement constraint which will be destroyed after the next solving of the set of constraints.
std::set< ObjectPtr > getConflictingConstraints(SolverPtr theSolver) const
Return list of conflicting constraints.
Definition: SketchSolver_Storage.cpp:215
virtual void adjustParametrizationOfArcs()=0
Make parametrization of arcs consistent.
std::map< AttributePtr, EntityWrapperPtr > myAttributeMap
map attribute to solver's entity
Definition: SketchSolver_Storage.h:177
std::map< FeaturePtr, EntityWrapperPtr > myFeatureMap
map SketchPlugin feature to solver's entity
Definition: SketchSolver_Storage.h:175
std::map< ConstraintPtr, ConstraintWrapperPtr > myConstraintMap
map SketchPlugin constraint to a list of solver's constraints
Definition: SketchSolver_Storage.h:173
virtual bool update(FeaturePtr theFeature, bool theForce=false)=0
Convert feature to the form applicable for specific solver and map it.
void setNeedToResolve(bool theFlag)
Changes the flag of group to be resolved.
Definition: SketchSolver_Storage.h:125
virtual void makeNonExternal(const EntityWrapperPtr &theEntity)=0
Make entity non-external.
void removeFeature(FeaturePtr theFeature)
Removes feature from the storage.
Definition: SketchSolver_Storage.cpp:176
static void resultToFeatureOrAttribute(const ObjectPtr &theResult, FeaturePtr &theFeature, AttributePtr &theAttribute)
Convert result to feature or attribute if theResult is linked to center of circle/arc.
Definition: SketchSolver_Storage.cpp:243
const EntityWrapperPtr & entity(const FeaturePtr &theFeature) const
Returns entity related to corresponding feature.
Definition: SketchSolver_Storage.cpp:137
virtual bool update(AttributePtr theAttribute, bool theForce=false)=0
Convert attribute to the form applicable for specific solver and map it.
virtual void addConstraint(ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint)
Change mapping between constraint from SketchPlugin and a constraint applicable for corresponding sol...
Definition: SketchSolver_Storage.cpp:46
virtual bool removeConstraint(ConstraintPtr theConstraint)=0
Removes constraint from the storage.