1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: SketchSolver_Builder.h
4 // Created: 25 Mar 2015
5 // Author: Artem ZHIDKOV
7 #ifndef SketchSolver_Builder_H_
8 #define SketchSolver_Builder_H_
10 #include <SketchSolver_Constraint.h>
11 #include <SketchPlugin_Constraint.h>
13 #include <GeomAPI_Lin2d.h>
14 #include <GeomAPI_Pnt2d.h>
16 /** \class SketchSolver_Builder
18 * \brief Abstract class for builders of solver's entities
20 class SketchSolver_Builder
23 /// \brief Creates a storage specific for used solver
24 virtual StoragePtr createStorage(const SolverPtr&) const = 0;
25 /// \brief Creates specific solver
26 virtual SolverPtr createSolver() const = 0;
28 /// \brief Creates a solver's constraint using given SketchPlugin constraint
29 /// or returns empty pointer if not all attributes are correct
30 SolverConstraintPtr createConstraint(ConstraintPtr theConstraint) const;
32 /// \brief Creates temporary constraint to fix the feature after movement
33 SolverConstraintPtr createMovementConstraint(FeaturePtr theMovedFeature) const;
35 /// \brief Creates new constraint using given parameters
36 /// \param theConstraint [in] original constraint
37 /// \param theType [in] type of constraint
38 /// \param theValue [in] numeric characteristic of constraint
39 /// (e.g. distance or radius) if applicable
40 /// \param theEntity1 [in] first attribute of constraint
41 /// \param theEntity2 [in] second attribute of constraint
42 /// \param theEntity3 [in] third attribute of constraint
43 /// \param theEntity4 [in] fourth attribute of constraint
44 /// \return Created wrapper of constraints applicable for specific solver.
45 virtual ConstraintWrapperPtr
46 createConstraint(ConstraintPtr theConstraint,
47 const SketchSolver_ConstraintType& theType,
48 const EntityWrapperPtr& theValue,
49 const EntityWrapperPtr& theEntity1,
50 const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(),
51 const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(),
52 const EntityWrapperPtr& theEntity4 = EntityWrapperPtr()) const = 0;
54 /// \brief Creates new multi-translation or multi-rotation constraint
55 /// \param theConstraint [in] original constraint
56 /// \param theType [in] type of constraint
57 /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation)
59 /// \param theFullValue [in] indicates theValue shows full translation delta/rotation angle or
60 /// delta/angle between neighbor entities
61 /// \param thePoint1 [in] center for multi-rotation or start point for multi-translation
62 /// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation)
63 /// \param theTrsfEnt [in] list of transformed entities
64 virtual ConstraintWrapperPtr
65 createConstraint(ConstraintPtr theConstraint,
66 const SketchSolver_ConstraintType& theType,
67 const EntityWrapperPtr& theValue,
68 const bool theFullValue,
69 const EntityWrapperPtr& thePoint1,
70 const EntityWrapperPtr& thePoint2,
71 const std::list<EntityWrapperPtr>& theTrsfEnt) const = 0;
74 /// \brief Convert entity to point
75 /// \return empty pointer if the entity is not a point
76 virtual std::shared_ptr<GeomAPI_Pnt2d> point(EntityWrapperPtr theEntity) const = 0;
77 /// \brief Convert entity to line
78 /// \return empty pointer if the entity is not a line
79 virtual std::shared_ptr<GeomAPI_Lin2d> line(EntityWrapperPtr theEntity) const = 0;
81 /// \brief Convert entity to line
82 /// \return empty pointer if the entity is not a line
83 virtual std::shared_ptr<GeomAPI_Lin2d> line(FeaturePtr theFeature) const = 0;
85 /// \brief Check if two connected arcs have centers
86 /// in same direction relatively to connection point
87 virtual bool isArcArcTangencyInternal(EntityWrapperPtr theArc1,
88 EntityWrapperPtr theArc2) const = 0;
91 typedef std::shared_ptr<SketchSolver_Builder> BuilderPtr;