]> SALOME platform Git repositories - modules/shaper.git/blob - src/SketchSolver/SketchSolver_ConstraintMirror.h
Salome HOME
SketchSolver library 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   SketchSolver_ConstraintMirror(ConstraintPtr theConstraint) :
21       SketchSolver_Constraint(theConstraint),
22       myNumberOfObjects(0)
23   {}
24
25   virtual int getType() const
26   { return SLVS_C_SYMMETRIC_LINE; }
27
28   /// \brief Update constraint
29   virtual void update(ConstraintPtr theConstraint = ConstraintPtr());
30
31   /// \brief Tries to remove constraint
32   /// \return \c false, if current constraint contains another SketchPlugin constraints (like for multiple coincidence)
33   virtual bool remove(ConstraintPtr theConstraint = ConstraintPtr());
34
35 protected:
36   /// \brief Converts SketchPlugin constraint to a list of SolveSpace constraints
37   virtual void process();
38
39   /// \brief Generate list of attributes of constraint in order useful for SolveSpace constraints
40   /// \param[out] theValue      numerical characteristic of constraint (e.g. distance)
41   /// \param[out] theAttributes list of attributes to be filled
42   virtual void getAttributes(double& theValue, std::vector<Slvs_hEntity>& theAttributes)
43   { /* do nothing here */ }
44
45   /// \brief Generate list of entities of mirror constraint
46   /// \param[out] theMirrorLine     entity corresponding to mirror line
47   /// \param[out] theBaseEntities   list of entities to mirror
48   /// \param[out] theMirrorEntities list of mirrored entities
49   void getAttributes(Slvs_Entity& theMirrorLine,
50                      std::vector<Slvs_Entity>& theBaseEntities,
51                      std::vector<Slvs_Entity>& theMirrorEntities);
52
53 private:
54   /// \brief Change parameters of entities to be symmetric relative a line,
55   ///        given by array of parameters (coordinates of first and last points)
56   void makeMirrorEntity(const Slvs_Entity& theBase,
57                         const Slvs_Entity& theMirror,
58                         const double theMirrorLine[]) const;
59
60 private:
61   size_t myNumberOfObjects; ///< number of previously mirrored objects
62 };
63
64 #endif