class SketchSolver_ConstraintMulti : public SketchSolver_Constraint
{
public:
+ /// Constructor based on SketchPlugin constraint
SketchSolver_ConstraintMulti(ConstraintPtr theConstraint) :
SketchSolver_Constraint(theConstraint),
myNumberOfObjects(0),
- myNumberOfCopies(0)
+ myNumberOfCopies(0),
+ myIsFullValue(false),
+ myAdjusted(false),
+ myIsEventsBlocked(false)
{}
- virtual int getType() const
- { return SLVS_C_UNKNOWN; }
-
/// \brief Update constraint
- virtual void update(ConstraintPtr theConstraint = ConstraintPtr());
+ virtual void update();
+
+ /// \brief Notify this object about the feature is changed somewhere
+ virtual void notify(const FeaturePtr& theFeature, PlaneGCSSolver_Update*);
/// \brief Tries to remove constraint
- /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence)
- virtual bool remove(ConstraintPtr theConstraint = ConstraintPtr());
+ /// \return \c false, if current constraint contains another SketchPlugin
+ /// constraints (like for multiple coincidence)
+ virtual bool remove();
- /// \brief Adds a feature to constraint and create its analogue in SolveSpace
- virtual void addFeature(FeaturePtr theFeature);
+ /// \brief Block or unblock events from this constraint
+ virtual void blockEvents(bool isBlocked);
protected:
/// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
virtual void process()
{ /* do nothing here */ }
- /// \brief Collect entities and their copies, like circles and arcs
- void processEntities(const std::vector< std::vector<Slvs_hEntity> >& theEntAndCopies);
+ /// \brief Collect entities which are translated or rotated (not their copies)
+ void getEntities(std::list<EntityWrapperPtr>& theEntities);
/// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
- /// \param[out] theValue numerical characteristic of constraint (e.g. distance)
- /// \param[out] theAttributes list of attributes to be filled
- virtual void getAttributes(double& theValue, std::vector<Slvs_hEntity>& theAttributes)
+ virtual void getAttributes(EntityWrapperPtr&, std::vector<EntityWrapperPtr>&)
{ /* do nothing here */ }
/// \brief This method is used in derived objects to check consistence of constraint.
virtual void updateLocal() = 0;
/// \brief Returns name of NUMBER_OF_COPIES parameter for corresponding feature
- virtual const std::string& nameNbCopies() = 0;
+ virtual const std::string& nameNbObjects() = 0;
protected:
/// \brief Convert absolute coordinates to relative coordinates
virtual void transformRelative(double& theX, double& theY) = 0;
protected:
- size_t myNumberOfObjects; ///< number of previous initial objects
- size_t myNumberOfCopies; ///< number of previous copies of initial objects
+ int myNumberOfObjects; ///< number of previous initial objects
+ int myNumberOfCopies; ///< number of previous copies of initial objects
+ bool myIsFullValue; ///< value whether the angle/distance is a full or single for objects
+
+ bool myAdjusted; ///< the constraint is already adjusted (to not do it several times)
- std::vector< std::vector<Slvs_hEntity> > myPointsAndCopies; ///< list of initial points and their copies
- std::vector< std::vector<Slvs_hEntity> > myCircsAndCopies; ///< list of circles and their copies (to change their radii together)
+ /// list of features and their copies to find whether some of them are disappeared
+ std::set<FeaturePtr> myFeatures;
- std::set<Slvs_hEntity> myPointsJustUpdated; ///< list of points touched by user
- std::set<Slvs_hEntity> myInitialPoints; ///< list of points containing initial objects
+ bool myIsEventsBlocked;
};
#endif