1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_ConstraintMultiRotation.h
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_ConstraintMultiRotation_H_
8 #define SketchSolver_ConstraintMultiRotation_H_
10 #include "SketchSolver.h"
11 #include <SketchSolver_ConstraintMulti.h>
13 #include "GeomDataAPI_Point2D.h"
15 /** \class SketchSolver_ConstraintMultiRotation
17 * \brief Convert rotated features to the list of SolveSpace constraints
19 class SketchSolver_ConstraintMultiRotation : public SketchSolver_ConstraintMulti
22 /// Constructor based on SketchPlugin constraint
23 SketchSolver_ConstraintMultiRotation(ConstraintPtr theConstraint) :
24 SketchSolver_ConstraintMulti(theConstraint)
28 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
29 virtual void process();
31 /// \brief Generate list of rotated entities
32 /// \param[out] theCenter central point of rotation
33 /// \param[out] theAngle rotation angle
34 /// \param[out] theFullValue applying translation using the disstance as a full or single value
35 /// \param[out] theEntities list of base entities
36 void getAttributes(EntityWrapperPtr& theCenter, double& theAngle, bool& theFullValue,
37 std::list<EntityWrapperPtr>& theEntities);
39 /// \brief This method is used in derived objects to check consistence of constraint.
40 virtual void adjustConstraint();
42 /// \brief Update parameters (called from base class)
43 virtual void updateLocal();
46 /// \brief Convert absolute coordinates to relative coordinates
47 virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY);
48 /// \brief Convert relative coordinates to absolute coordinates
49 virtual void getAbsolute(double theRelX, double theRelY, double& theAbsX, double& theAbsY);
50 /// \brief Apply transformation for relative coordinates
51 virtual void transformRelative(double& theX, double& theY);
53 /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
54 virtual const std::string& nameNbObjects();
57 AttributePoint2DPtr myCenterPointAttribute; ///< a center of rotation
58 double myAngle; ///< angle of rotation
60 double myCenterCoord[2]; ///< coordinates of rotation center
61 double myRotationVal[2]; ///< sinus and cosine of rotation angle