Salome HOME
Merge branch 'master' into cgt/devCEA
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMultiTranslation.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintMultiTranslation.h
4 // Created: 1 Apr 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintMultiTranslation_H_
8 #define SketchSolver_ConstraintMultiTranslation_H_
9
10 #include <SketchSolver_ConstraintMulti.h>
11
12 #include "GeomDataAPI_Point2D.h"
13
14 /** \class   SketchSolver_ConstraintMultiTranslation
15  *  \ingroup Plugins
16  *  \brief   Convert translated features to the list of SolveSpace constraints
17  */
18 class SketchSolver_ConstraintMultiTranslation : public SketchSolver_ConstraintMulti
19 {
20 public:
21   /// Constructor based on SketchPlugin constraint
22   SketchSolver_ConstraintMultiTranslation(ConstraintPtr theConstraint) :
23       SketchSolver_ConstraintMulti(theConstraint)
24   {}
25
26 protected:
27   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
28   virtual void process();
29
30   /// \brief Generate list of translated entities
31   /// \param[out] theStartPoint start point of translation
32   /// \param[out] theEndPoint   final point of translation
33   /// \param[out] theFullValue  applying translation using the distance as a full or single value
34   /// \param[out] theEntities   list of base entities
35   void getAttributes(EntityWrapperPtr& theStartPoint, EntityWrapperPtr& theEndPoint,
36                      bool& theFullValue, std::list<EntityWrapperPtr>& theEntities);
37
38   /// \brief This method is used in derived objects to check consistence of constraint.
39   virtual void adjustConstraint();
40
41   /// \brief Update parameters (called from base class)
42   virtual void updateLocal();
43
44 private:
45   /// \brief Convert absolute coordinates to relative coordinates
46   virtual void getRelative(double theAbsX, double theAbsY,
47                            double& theRelX, double& theRelY);
48   /// \brief Convert relative coordinates to absolute coordinates
49   virtual void getAbsolute(double theRelX, double theRelY,
50                            double& theAbsX, double& theAbsY);
51   /// \brief Apply transformation for relative coordinates
52   virtual void transformRelative(double& theX, double& theY);
53
54   /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
55   virtual const std::string& nameNbObjects();
56
57 private:
58   AttributePoint2DPtr myStartPointAttribute;
59   AttributePoint2DPtr myEndPointAttribute;
60
61   double myDelta[2]; ///< increment of translation
62 };
63
64 #endif