X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchSolver%2FSketchSolver_ConstraintGroup.h;h=00e8d4e7b54a8533c068476a92a6a356d53785c9;hb=aeca03e919a402327655e3f9c133985d9223b873;hp=6024f8caecab8cebac7dd567d8d2ccb312531838;hpb=53137bb38745e513e524055309d0abaaac18d3ba;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.h b/src/SketchSolver/SketchSolver_ConstraintGroup.h index 6024f8cae..00e8d4e7b 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.h +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + // File: SketchSolver_ConstraintGroup.h // Created: 27 May 2014 // Author: Artem ZHIDKOV @@ -10,12 +12,18 @@ #include #include +#include + +#include #include #include #include #include +typedef std::map< std::shared_ptr, std::vector > + ConstraintMap; + /** \class SketchSolver_ConstraintGroup * \ingroup DataModel * \brief Keeps the group of constraints which based on the same entities @@ -27,7 +35,7 @@ class SketchSolver_ConstraintGroup * Throws an exception if theWorkplane is not an object of SketchPlugin_Sketch type * \remark Type of theSketch is not verified inside */ - SketchSolver_ConstraintGroup(boost::shared_ptr theWorkplane); + SketchSolver_ConstraintGroup(std::shared_ptr theWorkplane); ~SketchSolver_ConstraintGroup(); @@ -53,21 +61,22 @@ class SketchSolver_ConstraintGroup * \param[in] theConstraint constraint to be changed * \return \c true if the constraint added or updated successfully */ - bool changeConstraint(boost::shared_ptr theConstraint); + bool changeConstraint(std::shared_ptr theConstraint); + bool changeRigidConstraint(std::shared_ptr theConstraint); /** \brief Verifies the feature attributes are used in this group * \param[in] theFeature constraint or any other object for verification of interaction * \return \c true if some of attributes are used in current group */ - bool isInteract(boost::shared_ptr theFeature) const; + bool isInteract(std::shared_ptr theFeature) const; /** \brief Verifies the specified feature is equal to the base workplane for this group * \param[in] theWorkplane the feature to be compared with base workplane * \return \c true if workplanes are the same */ - bool isBaseWorkplane(boost::shared_ptr theWorkplane) const; + bool isBaseWorkplane(std::shared_ptr theWorkplane) const; - boost::shared_ptr getWorkplane() const + std::shared_ptr getWorkplane() const { return mySketch; } @@ -80,7 +89,7 @@ class SketchSolver_ConstraintGroup /** \brief If the entity is in this group it will updated * \param[in] theEntity attribute, which values should update SolveSpace entity */ - void updateEntityIfPossible(boost::shared_ptr theEntity); + void updateEntityIfPossible(std::shared_ptr theEntity); /** \brief Searches invalid features and constraints in the group and avoids them * \return \c true if the group several constraints were removed @@ -105,8 +114,8 @@ class SketchSolver_ConstraintGroup /** \brief Searches the constraints built on the entity and emit the signal to update them * \param[in] theEntity attribute of the constraint */ - void updateRelatedConstraints(boost::shared_ptr theEntity) const; - void updateRelatedConstraints(boost::shared_ptr theFeature) const; + void updateRelatedConstraints(std::shared_ptr theEntity) const; + void updateRelatedConstraintsFeature(std::shared_ptr theFeature) const; /** \brief Adds or updates an entity in the group * @@ -116,8 +125,8 @@ class SketchSolver_ConstraintGroup * \param[in] theEntity the object of constraint * \return identifier of changed entity or 0 if entity could not be changed */ - Slvs_hEntity changeEntity(boost::shared_ptr theEntity); - Slvs_hEntity changeEntity(FeaturePtr theEntity); + Slvs_hEntity changeEntity(std::shared_ptr theEntity); + Slvs_hEntity changeEntityFeature(std::shared_ptr theEntity); protected: /** \brief Adds or updates a normal in the group @@ -133,9 +142,9 @@ protected: * \param[in] theNorm attribute for the normal (used to identify newly created entity) * \return identifier of created or updated normal */ - Slvs_hEntity changeNormal(boost::shared_ptr theDirX, - boost::shared_ptr theDirY, - boost::shared_ptr theNorm); + Slvs_hEntity changeNormal(std::shared_ptr theDirX, + std::shared_ptr theDirY, + std::shared_ptr theNorm); /** \brief Adds or updates a parameter in the group * \param[in] theParam the value of parameter @@ -154,31 +163,37 @@ protected: /** \brief Removes constraints from the group * \param[in] theConstraint constraint to be removed */ - void removeConstraint(boost::shared_ptr theConstraint); + void removeConstraint(std::shared_ptr theConstraint); /** \brief Change values of attribute by parameters received from SolveSpace solver * \param[in,out] theAttribute pointer to the attribute to be changed * \param[in] theEntityID identifier of SolveSpace entity, which contains updated data * \return \c true if the attribute's value has changed */ - bool updateAttribute(boost::shared_ptr theAttribute, + bool updateAttribute(std::shared_ptr theAttribute, const Slvs_hEntity& theEntityID); /** \brief Adds a constraint for a point which should not be changed during computations - * \param[in] theEntity the base for the constraint + * \param[in] theEntity the base for the constraint + * \param[in] theAllowToFit this flag shows that the entity may be placed into + * the 'dragged' field of SolveSpace solver, so this entity + * may be changed a little during solution */ - void addTemporaryConstraintWhereDragged(boost::shared_ptr theEntity); + void addTemporaryConstraintWhereDragged(std::shared_ptr theEntity, + bool theAllowToFit = true); /** \brief Remove all temporary constraint after computation finished + * \param[in] theRemoved indexes of constraints to be removed. If empty, all temporary constraints should be deleted */ - void removeTemporaryConstraints(); + void removeTemporaryConstraints(const std::set& theRemoved = + std::set()); private: /** \brief Creates a workplane from the sketch parameters * \param[in] theSketch parameters of workplane are the attributes of this sketch * \return \c true if success, \c false if workplane parameters are not consistent */ - bool addWorkplane(boost::shared_ptr theSketch); + bool addWorkplane(std::shared_ptr theSketch); /** \brief Add the entities of constraint for points coincidence into the appropriate list * \param[in] thePoint1 identifier of the first point @@ -214,14 +229,14 @@ protected: std::list myTempConstraints; ///< The list of identifiers of temporary constraints (SLVS_C_WHERE_DRAGGED) applied for all other points moved by user // SketchPlugin entities - boost::shared_ptr mySketch; ///< Equivalent to workplane - std::map, Slvs_hConstraint> myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints - std::map, Slvs_hEntity> myEntityAttrMap; ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities + std::shared_ptr mySketch; ///< Equivalent to workplane + ConstraintMap myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints + std::map, Slvs_hEntity> myEntityAttrMap; ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities std::map myEntityFeatMap; ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities // Conincident items std::vector > myCoincidentPoints; ///< Stores the lists of identifiers of coincident points (to avoid unnecessary coincidence constraints) - std::set > myExtraCoincidence; ///< Additional coincidence constraints which are not necessary (coincidence between points already done + std::set > myExtraCoincidence; ///< Additional coincidence constraints which are not necessary (coincidence between points already done ///< by other constraints) but created by GUI tools. Useful when some coincidence constraints were removed };