X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FSketchSolver%2FSketchSolver_ConstraintGroup.h;h=c8a673029e2ce047589e971d17e7cdb2b132dd70;hb=24f1ad2fd93475684288c899fb4fffcf05f6c21e;hp=5d7123903abc50a099ba0a420e3f2b4784a72d07;hpb=1788d3baf9a25806d24754c9f8e32e52ac32d3d3;p=modules%2Fshaper.git diff --git a/src/SketchSolver/SketchSolver_ConstraintGroup.h b/src/SketchSolver/SketchSolver_ConstraintGroup.h index 5d7123903..c8a673029 100644 --- a/src/SketchSolver/SketchSolver_ConstraintGroup.h +++ b/src/SketchSolver/SketchSolver_ConstraintGroup.h @@ -16,6 +16,9 @@ #include #include +typedef std::map< boost::shared_ptr, std::vector > + ConstraintMap; + /** \class SketchSolver_ConstraintGroup * \ingroup DataModel * \brief Keeps the group of constraints which based on the same entities @@ -27,7 +30,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(boost::shared_ptr theWorkplane); ~SketchSolver_ConstraintGroup(); @@ -54,20 +57,21 @@ class SketchSolver_ConstraintGroup * \return \c true if the constraint added or updated successfully */ bool changeConstraint(boost::shared_ptr theConstraint); + bool changeRigidConstraint(boost::shared_ptr theConstraint); - /** \brief Verifies the constraint uses the objects from this group - * \param[in] theConstraint constraint for verification of interaction - * \return \c true if the constrained objects are used in current group + /** \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 theConstraint) const; + bool isInteract(boost::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(boost::shared_ptr theWorkplane) const; - boost::shared_ptr getWorkplane() const + boost::shared_ptr getWorkplane() const { return mySketch; } @@ -108,7 +112,6 @@ class SketchSolver_ConstraintGroup void updateRelatedConstraints(boost::shared_ptr theEntity) const; void updateRelatedConstraints(boost::shared_ptr theFeature) const; - protected: /** \brief Adds or updates an entity in the group * * The parameters of entity will be parsed and added to the list of SolveSpace parameters. @@ -120,6 +123,7 @@ class SketchSolver_ConstraintGroup Slvs_hEntity changeEntity(boost::shared_ptr theEntity); Slvs_hEntity changeEntity(FeaturePtr theEntity); +protected: /** \brief Adds or updates a normal in the group * * Normal is a special entity in SolveSpace, which defines a direction in 3D and @@ -146,6 +150,11 @@ class SketchSolver_ConstraintGroup Slvs_hParam changeParameter(const double& theParam, std::vector::const_iterator& thePrmIter); + /** \brief Removes specified entities and their parameters + * \param[in] theEntities list of IDs of the entities to be removed + */ + void removeEntitiesById(const std::set& theEntities); + /** \brief Removes constraints from the group * \param[in] theConstraint constraint to be removed */ @@ -160,20 +169,26 @@ class SketchSolver_ConstraintGroup 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(boost::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(boost::shared_ptr theSketch); /** \brief Add the entities of constraint for points coincidence into the appropriate list * \param[in] thePoint1 identifier of the first point @@ -196,6 +211,7 @@ class SketchSolver_ConstraintGroup std::vector myParams; ///< List of parameters of the constraints Slvs_hParam myParamMaxID; ///< Actual maximal ID of parameters (not equal to myParams size) std::vector myEntities; ///< List of entities of the constaints + std::vector myEntOfConstr; ///< Flags show that certain entity used in constraints Slvs_hEntity myEntityMaxID; ///< Actual maximal ID of entities (not equal to myEntities size) std::vector myConstraints; ///< List of constraints in SolveSpace format Slvs_hConstraint myConstrMaxID; ///< Actual maximal ID of constraints (not equal to myConstraints size) @@ -208,8 +224,8 @@ class SketchSolver_ConstraintGroup 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 + boost::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