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