SHAPER  9.12.0
PlaneGCSSolver_Storage Class Reference

Contains all necessary data in PlaneGCS format to solve a single group of constraints. More...

Inheritance diagram for PlaneGCSSolver_Storage:
Inheritance graph

Public Member Functions

 PlaneGCSSolver_Storage (const SolverPtr &theSolver)
 
virtual void addConstraint (ConstraintPtr theConstraint, ConstraintWrapperPtr theSolverConstraint)
 Change mapping between constraint from SketchPlugin and a constraint applicable for corresponding solver. More...
 
virtual void addMovementConstraint (const ConstraintWrapperPtr &theSolverConstraint)
 Add a movement constraint which will be destroyed after the next solving of the set of constraints. More...
 
virtual bool update (FeaturePtr theFeature, bool theForce=false)
 Convert feature to the form applicable for specific solver and map it. More...
 
virtual bool update (AttributePtr theAttribute, bool theForce=false)
 Convert attribute to the form applicable for specific solver and map it. More...
 
virtual void makeExternal (const EntityWrapperPtr &theEntity)
 Make entity external. More...
 
virtual void makeNonExternal (const EntityWrapperPtr &theEntity)
 Make entity non-external. More...
 
virtual bool removeConstraint (ConstraintPtr theConstraint)
 Removes constraint from the storage. More...
 
virtual PlaneGCSSolver_Solver::SolveStatus checkDegeneratedGeometry () const
 Verify, the sketch contains degenerated geometry after resolving the set of constraints. More...
 
virtual void refresh () const
 Update SketchPlugin features after resolving constraints. More...
 
double * createParameter ()
 Initialize memory for new solver's parameter. More...
 
void removeParameters (const GCS::SET_pD &theParams)
 Release memory occupied by parameters. More...
 
virtual void removeInvalidEntities ()
 Remove all features became invalid. More...
 
virtual bool isEmpty () const
 Check the storage has constraints. More...
 
virtual void adjustParametrizationOfArcs ()
 Make parametrization of arcs consistent. More...
 
virtual void getUnderconstrainedGeometry (std::set< ObjectPtr > &theFeatures) const
 Return list of features which are not fully constrained. More...
 
void addEntity (FeaturePtr theFeature, EntityWrapperPtr theSolverEntity)
 Change mapping feature from SketchPlugin and the entity applicable for corresponding solver. More...
 
void addEntity (AttributePtr theAttribute, EntityWrapperPtr theSolverEntity)
 Change mapping attribute of a feature and the entity applicable for corresponding solver. More...
 
const ConstraintWrapperPtr & constraint (const ConstraintPtr &theConstraint) const
 Returns constraint related to corresponding constraint. More...
 
const EntityWrapperPtr & entity (const FeaturePtr &theFeature) const
 Returns entity related to corresponding feature. More...
 
const EntityWrapperPtr & entity (const AttributePtr &theAttribute) const
 Returns entity related to corresponding attribute. More...
 
void removeFeature (FeaturePtr theFeature)
 Removes feature from the storage. More...
 
void removeAttribute (AttributePtr theAttribute)
 Removes attribute from the storage. More...
 
bool areFeaturesValid () const
 Check the features have not been removed. More...
 
virtual bool isNeedToResolve ()
 Shows the sketch should be resolved. More...
 
void setNeedToResolve (bool theFlag)
 Changes the flag of group to be resolved. More...
 
std::set< ObjectPtr > getConflictingConstraints (SolverPtr theSolver) const
 Return list of conflicting constraints. More...
 
void blockEvents (bool isBlocked)
 Block or unblock events when refreshing features. More...
 
void subscribeUpdates (SketchSolver_Constraint *theSubscriber, const std::string &theGroup) const
 Subscribe for updates of features. More...
 
void unsubscribeUpdates (SketchSolver_Constraint *theSubscriber) const
 Unsubscribe for updates of features. More...
 
void notify (const FeaturePtr &theFeature) const
 Notify all subscribers about update of the feature. More...
 

Static Protected Member Functions

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. More...
 

Protected Attributes

SolverPtr mySketchSolver
 Sketch solver, prepared in corresponding group. More...
 
bool myNeedToResolve
 parameters are changed and group needs to be resolved More...
 
bool myEventsBlocked
 indicates that features do not send events More...
 
std::map< ConstraintPtr, ConstraintWrapperPtr > myConstraintMap
 map SketchPlugin constraint to a list of solver's constraints More...
 
std::map< FeaturePtr, EntityWrapperPtr > myFeatureMap
 map SketchPlugin feature to solver's entity More...
 
std::map< AttributePtr, EntityWrapperPtr > myAttributeMap
 map attribute to solver's entity More...
 
UpdaterPtr myUpdaters
 

Detailed Description

Contains all necessary data in PlaneGCS format to solve a single group of constraints.

Member Function Documentation

◆ addConstraint()

void PlaneGCSSolver_Storage::addConstraint ( ConstraintPtr  theConstraint,
ConstraintWrapperPtr  theSolverConstraint 
)
virtual

Change mapping between constraint from SketchPlugin and a constraint applicable for corresponding solver.

Parameters
theConstraint[in] original SketchPlugin constraint
theSolverConstraint[in] solver's constraint

Reimplemented from SketchSolver_Storage.

◆ addMovementConstraint()

void PlaneGCSSolver_Storage::addMovementConstraint ( const ConstraintWrapperPtr &  theSolverConstraint)
virtual

Add a movement constraint which will be destroyed after the next solving of the set of constraints.

Parameters
theSolverConstraint[in] solver's constraint

Implements SketchSolver_Storage.

◆ update() [1/2]

bool PlaneGCSSolver_Storage::update ( FeaturePtr  theFeature,
bool  theForce = false 
)
virtual

Convert feature to the form applicable for specific solver and map it.

Parameters
theFeature[in] feature to convert
theForce[in] forced feature creation
Returns
true if the feature has been created or updated

Implements SketchSolver_Storage.

◆ update() [2/2]

bool PlaneGCSSolver_Storage::update ( AttributePtr  theAttribute,
bool  theForce = false 
)
virtual

Convert attribute to the form applicable for specific solver and map it.

Parameters
theAttribute[in] attribute to convert
theForce[in] forced feature creation
Returns
true if the attribute has been created or updated

TODO: Check resultToFeatureOrAttribute() precisely.

Implements SketchSolver_Storage.

◆ makeExternal()

void PlaneGCSSolver_Storage::makeExternal ( const EntityWrapperPtr &  theEntity)
virtual

Make entity external.

Implements SketchSolver_Storage.

◆ makeNonExternal()

void PlaneGCSSolver_Storage::makeNonExternal ( const EntityWrapperPtr &  theEntity)
virtual

Make entity non-external.

Implements SketchSolver_Storage.

◆ removeConstraint()

bool PlaneGCSSolver_Storage::removeConstraint ( ConstraintPtr  theConstraint)
virtual

Removes constraint from the storage.

Returns
true if the constraint and all its parameters are removed successfully

Implements SketchSolver_Storage.

◆ checkDegeneratedGeometry()

PlaneGCSSolver_Solver::SolveStatus PlaneGCSSolver_Storage::checkDegeneratedGeometry ( ) const
virtual

Verify, the sketch contains degenerated geometry after resolving the set of constraints.

Returns
STATUS_OK if the geometry is valid, STATUS_DEGENERATED otherwise.

Implements SketchSolver_Storage.

◆ refresh()

void PlaneGCSSolver_Storage::refresh ( ) const
virtual

Update SketchPlugin features after resolving constraints.

Implements SketchSolver_Storage.

◆ createParameter()

double * PlaneGCSSolver_Storage::createParameter ( )

Initialize memory for new solver's parameter.

◆ removeParameters()

void PlaneGCSSolver_Storage::removeParameters ( const GCS::SET_pD &  theParams)

Release memory occupied by parameters.

◆ removeInvalidEntities()

void PlaneGCSSolver_Storage::removeInvalidEntities ( )
virtual

Remove all features became invalid.

TODO: Think on optimization of checking invalid features and attributes

Implements SketchSolver_Storage.

◆ isEmpty()

virtual bool PlaneGCSSolver_Storage::isEmpty ( ) const
inlinevirtual

Check the storage has constraints.

Reimplemented from SketchSolver_Storage.

◆ adjustParametrizationOfArcs()

void PlaneGCSSolver_Storage::adjustParametrizationOfArcs ( )
virtual

Make parametrization of arcs consistent.

Forward arcs should have the last parameter greater than the first parameter. Reversed arcs should have the last parameter lesser than the first parameter.

Implements SketchSolver_Storage.

◆ getUnderconstrainedGeometry()

void PlaneGCSSolver_Storage::getUnderconstrainedGeometry ( std::set< ObjectPtr > &  theFeatures) const
virtual

Return list of features which are not fully constrained.

Implements SketchSolver_Storage.

◆ addEntity() [1/2]

void SketchSolver_Storage::addEntity ( FeaturePtr  theFeature,
EntityWrapperPtr  theSolverEntity 
)
inherited

Change mapping feature from SketchPlugin and the entity applicable for corresponding solver.

Parameters
theFeature[in] original SketchPlugin feature
theSolverEntity[in] solver's entity, created outside

◆ addEntity() [2/2]

void SketchSolver_Storage::addEntity ( AttributePtr  theAttribute,
EntityWrapperPtr  theSolverEntity 
)
inherited

Change mapping attribute of a feature and the entity applicable for corresponding solver.

Parameters
theAttribute[in] original attribute
theSolverEntity[in] solver's entity, created outside

◆ constraint()

const ConstraintWrapperPtr & SketchSolver_Storage::constraint ( const ConstraintPtr &  theConstraint) const
inherited

Returns constraint related to corresponding constraint.

◆ entity() [1/2]

const EntityWrapperPtr & SketchSolver_Storage::entity ( const FeaturePtr &  theFeature) const
inherited

Returns entity related to corresponding feature.

◆ entity() [2/2]

const EntityWrapperPtr & SketchSolver_Storage::entity ( const AttributePtr &  theAttribute) const
inherited

Returns entity related to corresponding attribute.

TODO: Check resultToFeatureOrAttribute() precisely. Create additional unit-test

◆ removeFeature()

void SketchSolver_Storage::removeFeature ( FeaturePtr  theFeature)
inherited

Removes feature from the storage.

◆ removeAttribute()

void SketchSolver_Storage::removeAttribute ( AttributePtr  theAttribute)
inherited

Removes attribute from the storage.

◆ areFeaturesValid()

bool SketchSolver_Storage::areFeaturesValid ( ) const
inherited

Check the features have not been removed.

◆ isNeedToResolve()

virtual bool SketchSolver_Storage::isNeedToResolve ( )
inlinevirtualinherited

Shows the sketch should be resolved.

◆ setNeedToResolve()

void SketchSolver_Storage::setNeedToResolve ( bool  theFlag)
inlineinherited

Changes the flag of group to be resolved.

◆ getConflictingConstraints()

std::set< ObjectPtr > SketchSolver_Storage::getConflictingConstraints ( SolverPtr  theSolver) const
inherited

Return list of conflicting constraints.

◆ blockEvents()

void SketchSolver_Storage::blockEvents ( bool  isBlocked)
inherited

Block or unblock events when refreshing features.

◆ subscribeUpdates()

void SketchSolver_Storage::subscribeUpdates ( SketchSolver_Constraint theSubscriber,
const std::string &  theGroup 
) const
inherited

Subscribe for updates of features.

Parameters
theSubscriber[in] object which wants to revceive notifications
theGroup[in] group of updates features to be send

◆ unsubscribeUpdates()

void SketchSolver_Storage::unsubscribeUpdates ( SketchSolver_Constraint theSubscriber) const
inherited

Unsubscribe for updates of features.

Parameters
theSubscriber[in] object which does not want to revceive notifications anymore

◆ notify()

void SketchSolver_Storage::notify ( const FeaturePtr &  theFeature) const
inherited

Notify all subscribers about update of the feature.

◆ resultToFeatureOrAttribute()

void SketchSolver_Storage::resultToFeatureOrAttribute ( const ObjectPtr &  theResult,
FeaturePtr &  theFeature,
AttributePtr &  theAttribute 
)
staticprotectedinherited

Convert result to feature or attribute if theResult is linked to center of circle/arc.

Field Documentation

◆ mySketchSolver

SolverPtr SketchSolver_Storage::mySketchSolver
protectedinherited

Sketch solver, prepared in corresponding group.

◆ myNeedToResolve

bool SketchSolver_Storage::myNeedToResolve
protectedinherited

parameters are changed and group needs to be resolved

◆ myEventsBlocked

bool SketchSolver_Storage::myEventsBlocked
protectedinherited

indicates that features do not send events

◆ myConstraintMap

std::map<ConstraintPtr, ConstraintWrapperPtr> SketchSolver_Storage::myConstraintMap
protectedinherited

map SketchPlugin constraint to a list of solver's constraints

◆ myFeatureMap

std::map<FeaturePtr, EntityWrapperPtr> SketchSolver_Storage::myFeatureMap
protectedinherited

map SketchPlugin feature to solver's entity

◆ myAttributeMap

std::map<AttributePtr, EntityWrapperPtr> SketchSolver_Storage::myAttributeMap
protectedinherited

map attribute to solver's entity