Salome HOME
Add call execute() to sketch feature.
[modules/shaper.git] / src / SketchSolver / SketchSolver_Constraint.h
index 134263412da5574997e456bb728db825191de3ef..f4a15db60ff19e3445a04d1c3c420ffa7134cae6 100644 (file)
@@ -28,6 +28,7 @@ class SketchSolver_Constraint
 protected:
   /// Default constructor
   SketchSolver_Constraint() {}
+  /// Constructor based on SketchPlugin constraint
   SketchSolver_Constraint(ConstraintPtr theConstraint);
 
 public:
@@ -46,12 +47,12 @@ public:
   virtual bool remove(ConstraintPtr theConstraint = ConstraintPtr());
 
   /// \brief Update SketchPlugin attributes using the data obtained from SolveSpace entities
-  void refresh();
+  virtual void refresh();
 
   /// \brief Returns the type of constraint
   virtual int getType() const = 0;
 
-  /// \brief The constraint is made temoparary
+  /// \brief The constraint is made temporary
   void makeTemporary() const;
 
   /// \brief Checks the constraint is used by current object
@@ -66,6 +67,9 @@ public:
   /// \brief Return identifier of SolveSpace entity relating to the attribute
   Slvs_hEntity getId(AttributePtr theAttribute) const;
 
+  /// \brief Adds a feature to constraint and create its analogue in SolveSpace
+  virtual void addFeature(FeaturePtr theFeature);
+
   /// \brief Shows error message
   const std::string& error() const
   { return myErrorMsg; }
@@ -79,7 +83,12 @@ protected:
   /// \param[out] theAttributes list of attributes to be filled
   virtual void getAttributes(double& theValue, std::vector<Slvs_hEntity>& theAttributes);
 
-  /// \brief This method is used in derived objects to check consistence of constraint.
+  /// \brief Verify the attributes of constraint are changed (and constraint need to rebuild)
+  /// \param[in] theConstraint constraint, which attributes should be checked (if NULL, the myBaseConstraint is used)
+  /// \return \c true if some attributes are changed
+  virtual bool checkAttributesChanged(ConstraintPtr theConstraint);
+
+  /// \brief This method is used in derived objects to check consistency of constraint.
   ///        E.g. the distance between line and point may be signed.
   virtual void adjustConstraint()
   {}
@@ -136,6 +145,7 @@ typedef std::shared_ptr<SketchSolver_Constraint> SolverConstraintPtr;
 class SketchSolver_ConstraintParallel : public SketchSolver_Constraint
 {
 public:
+  /// Constructor based on SketchPlugin constraint
   SketchSolver_ConstraintParallel(ConstraintPtr theConstraint) :
       SketchSolver_Constraint(theConstraint)
   {}
@@ -152,6 +162,7 @@ public:
 class SketchSolver_ConstraintPerpendicular : public SketchSolver_Constraint
 {
 public:
+  /// Constructor based on SketchPlugin constraint
   SketchSolver_ConstraintPerpendicular(ConstraintPtr theConstraint) :
       SketchSolver_Constraint(theConstraint)
   {}
@@ -168,6 +179,7 @@ public:
 class SketchSolver_ConstraintHorizontal : public SketchSolver_Constraint
 {
 public:
+  /// Constructor based on SketchPlugin constraint
   SketchSolver_ConstraintHorizontal(ConstraintPtr theConstraint) :
       SketchSolver_Constraint(theConstraint)
   {}
@@ -184,6 +196,7 @@ public:
 class SketchSolver_ConstraintVertical : public SketchSolver_Constraint
 {
 public:
+  /// Constructor based on SketchPlugin constraint
   SketchSolver_ConstraintVertical(ConstraintPtr theConstraint) :
       SketchSolver_Constraint(theConstraint)
   {}
@@ -200,6 +213,7 @@ public:
 class SketchSolver_ConstraintRadius : public SketchSolver_Constraint
 {
 public:
+  /// Constructor based on SketchPlugin constraint
   SketchSolver_ConstraintRadius(ConstraintPtr theConstraint) :
       SketchSolver_Constraint(theConstraint)
   {}