Salome HOME
Task 2.12. New entities: ellipses and arcs of ellipses (issue #3003)
[modules/shaper.git] / src / SketchSolver / PlaneGCSSolver / PlaneGCSSolver_Tools.h
index e06acb15923efe5dbb251b1a576ac0443a7144d8..a02a9948c77a2302f86a4b7d48176b33f3d3f4ea 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #ifndef PlaneGCSSolver_Tools_H_
 #define PlaneGCSSolver_Tools_H_
 
 #include <SketchSolver_Constraint.h>
-#include <SketchSolver_ConstraintFixed.h>
+#include <SketchSolver_ConstraintMovement.h>
 #include <SketchPlugin_Constraint.h>
 
-#include <GeomAPI_Lin2d.h>
-#include <GeomAPI_Pnt2d.h>
+class GeomAPI_Circ2d;
+class GeomAPI_Ellipse2d;
+class GeomAPI_Lin2d;
+class GeomAPI_Pnt2d;
 
 /** \namespace  PlaneGCSSolver_Tools
  *  \ingroup    Plugins
@@ -39,8 +40,11 @@ namespace PlaneGCSSolver_Tools
   SolverConstraintPtr createConstraint(ConstraintPtr theConstraint);
 
   /// \brief Creates temporary constraint to fix the feature after movement
-  std::shared_ptr<SketchSolver_ConstraintFixed>
+  std::shared_ptr<SketchSolver_ConstraintMovement>
       createMovementConstraint(FeaturePtr theMovedFeature);
+  /// \brief Creates temporary constraint to fix the attribute after movement
+  std::shared_ptr<SketchSolver_ConstraintMovement>
+      createMovementConstraint(AttributePtr theMovedAttribute);
 
   /// \brief Creates new constraint using given parameters
   /// \param theConstraint [in]  original constraint
@@ -66,11 +70,22 @@ namespace PlaneGCSSolver_Tools
   /// \brief Convert entity to line
   /// \return empty pointer if the entity is not a line
   std::shared_ptr<GeomAPI_Lin2d> line(EntityWrapperPtr theEntity);
+  /// \brief Convert entity to circle
+  /// \return empty pointer if the entity is not a circle
+  std::shared_ptr<GeomAPI_Circ2d> circle(EntityWrapperPtr theEntity);
+  /// \brief Convert entity to ellipse
+  /// \return empty pointer if the entity is not an ellipse
+  std::shared_ptr<GeomAPI_Ellipse2d> ellipse(EntityWrapperPtr theEntity);
 
   /// \brief Convert entity to line
   /// \return empty pointer if the entity is not a line
   std::shared_ptr<GeomAPI_Lin2d> line(FeaturePtr theFeature);
 
+  /// \brief Update start and end parameters of circular and elliptic arcs
+  ///        respectively to start and end points on the arc.
+  ///        For the circular arc, the radius is calculated too.
+  void recalculateArcParameters(EntityWrapperPtr theArc);
+
   /// brief Return list of parameters for the given entity
   GCS::SET_pD parameters(const EntityWrapperPtr& theEntity);
 };