Salome HOME
Merge branch 'Dev_2.8.0'
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_Tools.h
1 // Copyright (C) 2014-2017  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
19 //
20
21 #ifndef PlaneGCSSolver_Tools_H_
22 #define PlaneGCSSolver_Tools_H_
23
24 #include <SketchSolver_Constraint.h>
25 #include <SketchSolver_ConstraintMovement.h>
26 #include <SketchPlugin_Constraint.h>
27
28 #include <GeomAPI_Lin2d.h>
29 #include <GeomAPI_Pnt2d.h>
30
31 /** \namespace  PlaneGCSSolver_Tools
32  *  \ingroup    Plugins
33  *  \brief      Converter tools
34  */
35 namespace PlaneGCSSolver_Tools
36 {
37   /// \brief Creates a solver's constraint using given SketchPlugin constraint
38   ///        or returns empty pointer if not all attributes are correct
39   SolverConstraintPtr createConstraint(ConstraintPtr theConstraint);
40
41   /// \brief Creates temporary constraint to fix the feature after movement
42   std::shared_ptr<SketchSolver_ConstraintMovement>
43       createMovementConstraint(FeaturePtr theMovedFeature);
44   /// \brief Creates temporary constraint to fix the attribute after movement
45   std::shared_ptr<SketchSolver_ConstraintMovement>
46       createMovementConstraint(AttributePtr theMovedAttribute);
47
48   /// \brief Creates new constraint using given parameters
49   /// \param theConstraint [in]  original constraint
50   /// \param theType       [in]  type of constraint
51   /// \param theValue      [in]  numeric characteristic of constraint
52   ///                            (e.g. distance or radius) if applicable
53   /// \param theEntity1    [in]  first attribute of constraint
54   /// \param theEntity2    [in]  second attribute of constraint
55   /// \param theEntity3    [in]  third attribute of constraint
56   /// \param theEntity4    [in]  fourth attribute of constraint
57   /// \return Created wrapper of constraints applicable for specific solver.
58   ConstraintWrapperPtr createConstraint(ConstraintPtr theConstraint,
59                                         const SketchSolver_ConstraintType& theType,
60                                         const EntityWrapperPtr& theValue,
61                                         const EntityWrapperPtr& theEntity1,
62                                         const EntityWrapperPtr& theEntity2 = EntityWrapperPtr(),
63                                         const EntityWrapperPtr& theEntity3 = EntityWrapperPtr(),
64                                         const EntityWrapperPtr& theEntity4 = EntityWrapperPtr());
65
66   /// \brief Convert entity to point
67   /// \return empty pointer if the entity is not a point
68   std::shared_ptr<GeomAPI_Pnt2d> point(EntityWrapperPtr theEntity);
69   /// \brief Convert entity to line
70   /// \return empty pointer if the entity is not a line
71   std::shared_ptr<GeomAPI_Lin2d> line(EntityWrapperPtr theEntity);
72
73   /// \brief Convert entity to line
74   /// \return empty pointer if the entity is not a line
75   std::shared_ptr<GeomAPI_Lin2d> line(FeaturePtr theFeature);
76
77   /// brief Return list of parameters for the given entity
78   GCS::SET_pD parameters(const EntityWrapperPtr& theEntity);
79 };
80
81 #endif