1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: PlaneGCSSolver_Tools.h
4 // Created: 01 Mar 2017
5 // Author: Artem ZHIDKOV
7 #ifndef PlaneGCSSolver_Tools_H_
8 #define PlaneGCSSolver_Tools_H_
10 #include <SketchSolver_Constraint.h>
11 #include <SketchSolver_ConstraintFixed.h>
12 #include <SketchPlugin_Constraint.h>
14 #include <GeomAPI_Lin2d.h>
15 #include <GeomAPI_Pnt2d.h>
17 /** \namespace PlaneGCSSolver_Tools
19 * \brief Converter tools
21 namespace PlaneGCSSolver_Tools
23 /// \brief Creates a solver's constraint using given SketchPlugin constraint
24 /// or returns empty pointer if not all attributes are correct
25 SolverConstraintPtr createConstraint(ConstraintPtr theConstraint);
27 /// \brief Creates temporary constraint to fix the feature after movement
28 std::shared_ptr<SketchSolver_ConstraintFixed>
29 createMovementConstraint(FeaturePtr theMovedFeature);
31 /// \brief Creates new constraint using given parameters
32 /// \param theConstraint [in] original constraint
33 /// \param theType [in] type of constraint
34 /// \param theValue [in] numeric characteristic of constraint
35 /// (e.g. distance or radius) if applicable
36 /// \param theEntity1 [in] first attribute of constraint
37 /// \param theEntity2 [in] second attribute of constraint
38 /// \param theEntity3 [in] third attribute of constraint
39 /// \param theEntity4 [in] fourth attribute of constraint
40 /// \return Created wrapper of constraints applicable for specific solver.
41 ConstraintWrapperPtr createConstraint(ConstraintPtr theConstraint,
42 const SketchSolver_ConstraintType& theType,
43 const EntityWrapperPtr& theValue,
44 const EntityWrapperPtr& theEntity1,
45 const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(),
46 const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(),
47 const EntityWrapperPtr& theEntity4 = EntityWrapperPtr());
49 /// \brief Convert entity to point
50 /// \return empty pointer if the entity is not a point
51 std::shared_ptr<GeomAPI_Pnt2d> point(EntityWrapperPtr theEntity);
52 /// \brief Convert entity to line
53 /// \return empty pointer if the entity is not a line
54 std::shared_ptr<GeomAPI_Lin2d> line(EntityWrapperPtr theEntity);
56 /// \brief Convert entity to line
57 /// \return empty pointer if the entity is not a line
58 std::shared_ptr<GeomAPI_Lin2d> line(FeaturePtr theFeature);