Salome HOME
#1150 Tab buttons problems
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMulti.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintMulti.h
4 // Created: 2 Sep 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintMulti_H_
8 #define SketchSolver_ConstraintMulti_H_
9
10 #include "SketchSolver.h"
11 #include <SketchSolver_Constraint.h>
12
13 #include <vector>
14
15 /** \class   SketchSolver_ConstraintMulti
16  *  \ingroup Plugins
17  *  \brief   Common base class for the Multi constraints
18  */
19 class SketchSolver_ConstraintMulti : public SketchSolver_Constraint
20 {
21 public:
22   /// Constructor based on SketchPlugin constraint
23   SketchSolver_ConstraintMulti(ConstraintPtr theConstraint) :
24       SketchSolver_Constraint(theConstraint),
25       myNumberOfObjects(0),
26       myNumberOfCopies(0),
27       myAdjusted(false)
28   {}
29
30   /// \brief Update constraint
31   virtual void update();
32   /// \brief Update constraint
33   void update(bool isForce);
34
35 protected:
36   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
37   virtual void process()
38   { /* do nothing here */ }
39
40   /// \brief Collect entities and their copies, like circles and arcs
41   void getEntitiesAndCopies(std::list< std::list<EntityWrapperPtr> >& theEntAndCopies);
42
43   /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
44   /// \param[out] theValue      numerical characteristic of constraint (e.g. distance)
45   /// \param[out] theAttributes list of attributes to be filled
46   virtual void getAttributes(double& theValue, std::vector<EntityWrapperPtr>& theAttributes)
47   { /* do nothing here */ }
48
49   /// \brief This method is used in derived objects to check consistence of constraint.
50   virtual void adjustConstraint();
51
52   /// \brief Update parameters of derived classes
53   virtual void updateLocal() = 0;
54
55   /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
56   virtual const std::string& nameNbObjects() = 0;
57
58 protected:
59   int myNumberOfObjects; ///< number of previous initial objects
60   int myNumberOfCopies;  ///< number of previous copies of initial objects
61
62   bool myAdjusted; ///< the constraint is already adjusted (to not do it several times)
63 };
64
65 #endif