1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PlaneGCSSolver_Builder.h
4 // Created: 14 Dec 2015
5 // Author: Artem ZHIDKOV
7 #ifndef PlaneGCSSolver_Builder_H_
8 #define PlaneGCSSolver_Builder_H_
10 #include <PlaneGCSSolver_Defs.h>
12 #include <SketchSolver_Builder.h>
13 #include <SketchSolver_Constraint.h>
15 #include <SketchPlugin_Constraint.h>
17 #include <ModelAPI_CompositeFeature.h>
19 /** \class PlaneGCSSolver_Builder
21 * \brief Create bridges between SketchPlugin constraints and PlaneGCS constraints
23 class PlaneGCSSolver_Builder : public SketchSolver_Builder
25 /// Default constructor
26 PlaneGCSSolver_Builder() {}
29 /// \brief Returns single instance of builder
30 static BuilderPtr getInstance();
32 /// \brief Creates a storage specific for used solver
33 virtual StoragePtr createStorage(const SolverPtr& theSolver) const;
34 /// \brief Creates specific solver
35 virtual SolverPtr createSolver() const;
37 /// \brief Creates new constraint using given parameters
38 /// \param theConstraint [in] original constraint
39 /// \param theType [in] type of constraint
40 /// \param theValue [in] numeric characteristic of constraint
41 /// (e.g. distance or radius) if applicable
42 /// \param theEntity1 [in] first attribute of constraint
43 /// \param theEntity2 [in] second attribute of constraint
44 /// \param theEntity3 [in] third attribute of constraint
45 /// \param theEntity4 [in] fourth attribute of constraint
46 /// \return Created wrapper of constraints applicable for specific solver.
47 virtual ConstraintWrapperPtr
48 createConstraint(ConstraintPtr theConstraint,
49 const SketchSolver_ConstraintType& theType,
50 const EntityWrapperPtr& theValue,
51 const EntityWrapperPtr& theEntity1,
52 const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(),
53 const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(),
54 const EntityWrapperPtr& theEntity4 = EntityWrapperPtr()) const;
56 /// \brief Creates new multi-translation or multi-rotation constraint
57 /// \param theConstraint [in] original constraint
58 /// \param theType [in] type of constraint
59 /// \param theValue [in] numeric characteristic of constraint (angle for multi-rotation)
61 /// \param theFullValue [in] indicates theValue shows full translation delta/rotation
62 /// angle or delta/angle between neighbor entities
63 /// \param thePoint1 [in] center for multi-rotation or start point for multi-translation
64 /// \param thePoint2 [in] end point for multi-translation (empty for multi-rotation)
65 /// \param theTrsfEnt [in] list of transformed entities
66 virtual ConstraintWrapperPtr
67 createConstraint(ConstraintPtr theConstraint,
68 const SketchSolver_ConstraintType& theType,
69 const EntityWrapperPtr& theValue,
70 const bool theFullValue,
71 const EntityWrapperPtr& thePoint1,
72 const EntityWrapperPtr& thePoint2,
73 const std::list<EntityWrapperPtr>& theTrsfEnt) const;
75 /// \brief Convert entity to point
76 /// \return empty pointer if the entity is not a point
77 virtual std::shared_ptr<GeomAPI_Pnt2d> point(EntityWrapperPtr theEntity) const;
78 /// \brief Convert entity to line
79 /// \return empty pointer if the entity is not a line
80 virtual std::shared_ptr<GeomAPI_Lin2d> line(EntityWrapperPtr theEntity) const;
82 /// \brief Convert entity to line
83 /// \return empty pointer if the entity is not a line
84 virtual std::shared_ptr<GeomAPI_Lin2d> line(FeaturePtr theFeature) const;
86 /// \brief Check if two connected arcs have centers
87 /// in same direction relatively to connection point
88 virtual bool isArcArcTangencyInternal(EntityWrapperPtr theArc1,
89 EntityWrapperPtr theArc2) const;