1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_ConstraintMulti.h
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_ConstraintMulti_H_
8 #define SketchSolver_ConstraintMulti_H_
10 #include "SketchSolver.h"
11 #include <SketchSolver_Constraint.h>
15 /** \class SketchSolver_ConstraintMulti
17 * \brief Common base class for the Multi constraints
19 class SketchSolver_ConstraintMulti : public SketchSolver_Constraint
22 /// Constructor based on SketchPlugin constraint
23 SketchSolver_ConstraintMulti(ConstraintPtr theConstraint) :
24 SketchSolver_Constraint(theConstraint),
30 //// virtual int getType() const
31 //// { return SLVS_C_UNKNOWN; }
33 /// \brief Update constraint
34 virtual void update(bool isForce = false);
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();
40 //// /// \brief Adds a feature to constraint and create its analogue in SolveSpace
41 //// virtual void addFeature(FeaturePtr theFeature);
43 //// /// \brief Update SketchPlugin attributes using the data obtained from SolveSpace entities
44 //// virtual void refresh()
46 //// myAdjusted = false;
47 //// SketchSolver_Constraint::refresh();
50 //// /// \brief Verifies, the coincidence between points of copied entities appears or disappears,
51 //// /// and removes or adds fixing of corresponding points.
52 //// void checkCoincidence();
55 /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
56 virtual void process()
57 { /* do nothing here */ }
59 /// \brief Collect entities and their copies, like circles and arcs
60 void getEntitiesAndCopies(std::list< std::list<EntityWrapperPtr> >& theEntAndCopies);
62 /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
63 /// \param[out] theValue numerical characteristic of constraint (e.g. distance)
64 /// \param[out] theAttributes list of attributes to be filled
65 virtual void getAttributes(double& theValue, std::vector<EntityWrapperPtr>& theAttributes)
66 { /* do nothing here */ }
68 /// \brief This method is used in derived objects to check consistence of constraint.
69 virtual void adjustConstraint();
71 /// \brief Update parameters of derived classes
72 virtual void updateLocal() = 0;
74 /// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
75 virtual const std::string& nameNbObjects() = 0;
78 //// /// \brief Convert absolute coordinates to relative coordinates
79 //// virtual void getRelative(double theAbsX, double theAbsY, double& theRelX, double& theRelY) = 0;
80 //// /// \brief Convert relative coordinates to absolute coordinates
81 //// virtual void getAbsolute(double theRelX, double theRelY, double& theAbsX, double& theAbsY) = 0;
82 //// /// \brief Apply transformation for relative coordinates
83 //// virtual void transformRelative(double& theX, double& theY) = 0;
86 int myNumberOfObjects; ///< number of previous initial objects
87 int myNumberOfCopies; ///< number of previous copies of initial objects
89 //// std::vector< std::vector<Slvs_hEntity> > myPointsAndCopies; ///< list of initial points and their copies
90 //// std::vector< std::vector<Slvs_hEntity> > myCircsAndCopies; ///< list of circles and their copies (to change their radii together)
92 //// std::set<Slvs_hEntity> myPointsJustUpdated; ///< list of points touched by user
93 //// std::set<Slvs_hEntity> myInitialPoints; ///< list of points containing initial objects
95 bool myAdjusted; ///< the constraint is already adjusted (to not do it several times)