Salome HOME
Merge branch 'master' of newgeom:newgeom
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintGroup.h
index fe629046b16ef4ed3b8f9bcd7dce62cfe2b74ae8..362c31b251059d6f186bfd947f43a9af46763f51 100644 (file)
@@ -94,6 +94,12 @@ public:
    */
   void resolveConstraints();
 
+  /** \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<ModelAPI_Attribute> theEntity)  const;
+  void updateRelatedConstraints(boost::shared_ptr<ModelAPI_Feature>   theFeature) const;
+
 protected:
   /** \brief Adds or updates an entity in the group
    *
@@ -104,6 +110,7 @@ protected:
    *  \return identifier of changed entity or 0 if entity could not be changed
    */
   Slvs_hEntity changeEntity(boost::shared_ptr<ModelAPI_Attribute> theEntity);
+  Slvs_hEntity changeEntity(FeaturePtr   theEntity);
 
   /** \brief Adds or updates a normal in the group
    *
@@ -139,8 +146,9 @@ protected:
   /** \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
    */
-  void updateAttribute(boost::shared_ptr<ModelAPI_Attribute> theAttribute, const Slvs_hEntity& theEntityID);
+  bool updateAttribute(boost::shared_ptr<ModelAPI_Attribute> 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
@@ -158,6 +166,14 @@ private:
    */
   bool addWorkplane(boost::shared_ptr<SketchPlugin_Feature> theSketch);
 
+  /** \brief Add the entities of constraint for points coincidence into the appropriate list
+   *  \param[in] thePoint1 identifier of the first point
+   *  \param[in] thePoint2 identifier of the second point
+   *  \return \c true if the points are added successfully, and 
+   *          \c false if the constraint is the extra one (should not be created in SolveSpace)
+   */
+  bool addCoincidentPoints(const Slvs_hEntity& thePoint1, const Slvs_hEntity& thePoint2);
+
 private:
   // SolveSpace entities
   Slvs_hGroup                  myID;            ///< the index of the group
@@ -182,7 +198,9 @@ private:
   std::map<boost::shared_ptr<SketchPlugin_Constraint>, Slvs_hConstraint>
                                myConstraintMap; ///< The map between SketchPlugin and SolveSpace constraints
   std::map<boost::shared_ptr<ModelAPI_Attribute>, Slvs_hEntity>
-                               myEntityMap;     ///< The map between parameters of constraints and their equivalent SolveSpace entities
+                               myEntityAttrMap;     ///< The map between "attribute" parameters of constraints and their equivalent SolveSpace entities
+  std::map<FeaturePtr, Slvs_hEntity>
+                               myEntityFeatMap;     ///< The map between "feature" parameters of constraints and their equivalent SolveSpace entities
 
   // Conincident items
   std::vector< std::set<Slvs_hEntity> >