Salome HOME
First phase of SketchSolver refactoring
[modules/shaper.git] / src / SketchSolver / SketchSolver_ConstraintMirror.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 // File:    SketchSolver_ConstraintMirror.h
4 // Created: 1 Apr 2015
5 // Author:  Artem ZHIDKOV
6
7 #ifndef SketchSolver_ConstraintMirror_H_
8 #define SketchSolver_ConstraintMirror_H_
9
10 #include "SketchSolver.h"
11 #include <SketchSolver_Constraint.h>
12
13 /** \class   SketchSolver_ConstraintMirror
14  *  \ingroup Plugins
15  *  \brief   Convert fillet constraint to SolveSpace structure
16  */
17 class SketchSolver_ConstraintMirror : public SketchSolver_Constraint
18 {
19 public:
20   /// Constructor based on SketchPlugin constraint
21   SketchSolver_ConstraintMirror(ConstraintPtr theConstraint) :
22       SketchSolver_Constraint(theConstraint),
23       myNumberOfObjects(0)////,
24 ////      myMirrorLineLength(0.0)
25   {}
26
27   /// \brief Update constraint
28   virtual void update();
29
30 ////  /// \brief Tries to remove constraint
31 ////  /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence)
32 ////  virtual bool remove(ConstraintPtr theConstraint = ConstraintPtr());
33
34 protected:
35   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
36   virtual void process();
37
38   /// \brief Generate list of attributes of constraint in order useful for constraints
39   /// \param[out] theValue      numerical characteristic of constraint (e.g. distance)
40   /// \param[out] theAttributes list of attributes to be filled
41   virtual void getAttributes(double& theValue, std::vector<EntityWrapperPtr>& theAttributes)
42   { /* do nothing here */ }
43
44 ////  /// \brief Verify the attributes of constraint are changed (and constraint need to rebuild)
45 ////  /// \param[in] theConstraint constraint, which attributes should be checked (if NULL, the myBaseConstraint is used)
46 ////  /// \return \c true if some attributes are changed
47 ////  virtual bool checkAttributesChanged(ConstraintPtr theConstraint);
48
49   /// \brief Generate list of entities of mirror constraint
50   /// \param[out] theMirrorLine     entity corresponding to mirror line
51   /// \param[out] theBaseEntities   list of entities to mirror
52   /// \param[out] theMirrorEntities list of mirrored entities
53   void getAttributes(EntityWrapperPtr& theMirrorLine,
54                      std::vector<EntityWrapperPtr>& theBaseEntities,
55                      std::vector<EntityWrapperPtr>& theMirrorEntities);
56
57   /// \brief This method is used in derived objects to check consistence of constraint.
58   ///        E.g. the distance between line and point may be signed.
59   virtual void adjustConstraint();
60
61 private:
62 ////  /// \brief Change parameters of entities to be symmetric relative a line,
63 ////  ///        given by array of parameters (coordinates of first and last points)
64 ////  void makeMirrorEntity(const Slvs_Entity& theBase,
65 ////                        const Slvs_Entity& theMirror,
66 ////                        const double theMirrorLine[]) const;
67 ////
68 ////  /// \brief Precisely update last point to be on arc
69 ////  void adjustArcPoints(const Slvs_Entity& theArc) const;
70
71 private:
72   size_t myNumberOfObjects;  ///< number of previously mirrored objects
73 ////  double myMirrorLineLength; ///< length of mirror line (should be always greater than 0)
74 };
75
76 #endif