1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_ConstraintMultiTranslation.h
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_ConstraintMultiTranslation_H_
8 #define SketchSolver_ConstraintMultiTranslation_H_
10 #include "SketchSolver.h"
11 #include <SketchSolver_Constraint.h>
13 /** \class SketchSolver_ConstraintMultiTranslation
15 * \brief Convert translated features to the list of SolveSpace constraints
17 class SketchSolver_ConstraintMultiTranslation : public SketchSolver_Constraint
20 SketchSolver_ConstraintMultiTranslation(ConstraintPtr theConstraint) :
21 SketchSolver_Constraint(theConstraint),
26 virtual int getType() const
27 { return SLVS_C_MULTI_TRANSLATION; }
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 translated entities
47 /// \param[out] theStartPoint ID of start point of translation
48 /// \param[out] theEndPoint ID of final point of translation
49 /// \param[out] thePoints list of IDs of initial points and their translated copies
50 /// \param[out] theCircular list of IDs of arcs and circles and their copies
51 void getAttributes(Slvs_hEntity& theStartPoint, Slvs_hEntity& theEndPoint,
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 myTranslationLine; ///< ID of translation line