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_Constraint.h>
13 /** \class SketchSolver_ConstraintMultiRotation
15 * \brief Convert rotated features to the list of SolveSpace constraints
17 class SketchSolver_ConstraintMultiRotation : public SketchSolver_Constraint
20 SketchSolver_ConstraintMultiRotation(ConstraintPtr theConstraint) :
21 SketchSolver_Constraint(theConstraint),
26 virtual int getType() const
27 { return SLVS_C_MULTI_ROTATION; }
29 /// \brief Update constraint
30 virtual void update(ConstraintPtr theConstraint = ConstraintPtr());
32 /// \brief Tries to remove constraint
33 /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence)
34 virtual bool remove(ConstraintPtr theConstraint = ConstraintPtr());
37 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
38 virtual void process();
40 /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
41 /// \param[out] theValue numerical characteristic of constraint (e.g. distance)
42 /// \param[out] theAttributes list of attributes to be filled
43 virtual void getAttributes(double& theValue, std::vector<Slvs_hEntity>& theAttributes)
44 { /* do nothing here */ }
46 /// \brief Generate list of rotated entities
47 /// \param[out] theCenter ID of central point of rotation
48 /// \param[out] theAngle rotation angle
49 /// \param[out] thePoints list of IDs of initial points and their rotated copies
50 /// \param[out] theCircular list of IDs of arcs and circles and their copies
51 void getAttributes(Slvs_hEntity& theCenter, double& theAngle,
52 std::vector<std::vector<Slvs_hEntity> >& thePoints,
53 std::vector<std::vector<Slvs_hEntity> >& theCircular);
55 /// \brief This method is used in derived objects to check consistence of constraint.
56 virtual void adjustConstraint();
59 size_t myNumberOfObjects; ///< number of previous initial objects
60 size_t myNumberOfCopies; ///< number of previous copies of initial objects
61 Slvs_hEntity myRotationCenter; ///< ID of center of rotation
62 double myAngle; ///< angle of rotation