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 /** \class SketchSolver_ConstraintMultiRotation
15 * \brief Convert rotated features to the list of SolveSpace constraints
17 class SketchSolver_ConstraintMultiRotation : public SketchSolver_ConstraintMulti
20 /// Constructor based on SketchPlugin constraint
21 SketchSolver_ConstraintMultiRotation(ConstraintPtr theConstraint) :
22 SketchSolver_ConstraintMulti(theConstraint)
25 virtual int getType() const
26 { return SLVS_C_MULTI_ROTATION; }
29 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
30 virtual void process();
32 /// \brief Generate list of rotated entities
33 /// \param[out] theCenter ID of central point of rotation
34 /// \param[out] theAngle rotation angle
35 /// \param[out] thePoints list of IDs of initial points and their rotated copies
36 /// \param[out] theEntities list of IDs of entities and their rotated copies
37 void getAttributes(Slvs_hEntity& theCenter, double& theAngle,
38 std::vector< std::vector<Slvs_hEntity> >& thePoints,
39 std::vector< std::vector<Slvs_hEntity> >& theEntities);
41 /// \brief This method is used in derived objects to check consistence of constraint.
42 virtual void adjustConstraint();
44 /// \brief Update parameters (called from base class)
45 virtual void updateLocal();
48 /// \brief Convert absolute coordinates to relative coordinates
49 virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY);
50 /// \brief Convert relative coordinates to absolute coordinates
51 virtual void getAbsolute(double theRelX, double theRelY, double& theAbsX, double& theAbsY);
52 /// \brief Apply transformation for relative coordinates
53 virtual void transformRelative(double& theX, double& theY);
56 /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
57 virtual const std::string& nameNbObjects();
60 Slvs_hEntity myRotationCenter; ///< ID of center of rotation
61 double myAngle; ///< angle of rotation
63 double myCenterCoord[2]; ///< coordinates of rotation center
64 double myRotationVal[2]; ///< sinus and cosinus of rotation angle