Salome HOME
bos#35152 [EDF] (2023-T1) Sketch Circle should allow user to position construction...
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.h
index 11a2639087700596e0518015e155b05accfd616e..7f2fa98ea31fef627833078d25504f9835eee8c9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2020  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2023  CEA, EDF
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -27,6 +27,7 @@
 
 #include <SketchPlugin_Sketch.h>
 #include <SketchPlugin_SketchEntity.h>
+#include <SketchPlugin_Offset.h>
 
 #include <ModelHighAPI_Double.h>
 #include <ModelHighAPI_Interface.h>
@@ -56,6 +57,8 @@ class SketchAPI_Projection;
 class SketchAPI_Rectangle;
 class SketchAPI_Rotation;
 class SketchAPI_Translation;
+class SketchAPI_MacroMiddlePoint;
+
 //--------------------------------------------------------------------------------------
 typedef std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> PointOrReference;
 //--------------------------------------------------------------------------------------
@@ -178,46 +181,102 @@ public:
   std::shared_ptr<SketchAPI_Rectangle> addRectangle(
       const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
       const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
+  /// Add rectangle
+  SKETCHAPI_EXPORT
+  std::shared_ptr<SketchAPI_Rectangle> addRectangleCentered(
+      const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theCenter,
+      const std::pair<std::shared_ptr<GeomAPI_Pnt2d>, ModelHighAPI_RefAttr> & theCorner);
 
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(
       double theCenterX, double theCenterY,
       double theRadius);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(
       const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
       double theRadius);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       double theCenterX, double theCenterY,
       double thePassedX, double thePassedY);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       double theX1, double theY1,
       double theX2, double theY2,
       double theX3, double theY3);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_MacroCircle> addCircle(
       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
       const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
-  /// Add circle
+  /// Add circle.
+  /// [DEPRECATED]: use addCircleWithPoint() instead.
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Circle> addCircle(const std::wstring & theExternalName);
 
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(
+      double theCenterX, double theCenterY,
+      double theRadius, double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(
+      const std::shared_ptr<GeomAPI_Pnt2d>& theCenter,
+      double theRadius, double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      double theCenterX, double theCenterY,
+      double thePassedX, double thePassedY,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      const std::shared_ptr<GeomAPI_Pnt2d>& theCenterPoint,
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePassedPoint,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      double theX1, double theY1,
+      double theX2, double theY2,
+      double theX3, double theY3,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroCircle> addCircleWithPoint(
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePoint1,
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePoint2,
+      const std::shared_ptr<GeomAPI_Pnt2d>& thePoint3,
+      double theAngle);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(const ModelHighAPI_Selection& theExternal);
+  /// Add circle with point
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_Circle> addCircleWithPoint(const std::wstring& theExternalName);
+
   /// Add arc
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Arc> addArc(
@@ -369,10 +428,12 @@ public:
 
   /// Add offset
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Offset> addOffset(
+    std::shared_ptr<SketchAPI_Offset> addOffset(
       const std::list<std::shared_ptr<ModelAPI_Object> > & theObjects,
       const ModelHighAPI_Double & theValue,
-      const bool theReversed);
+      const bool theReversed = false,
+      const std::string & theJointType = SketchPlugin_Offset::JOINT_KEEP_DISTANCE(),
+      const bool theApprox = false);
 
   /// Add translation
   SKETCHAPI_EXPORT
@@ -514,6 +575,11 @@ public:
       const ModelHighAPI_RefAttr & thePoint,
       const ModelHighAPI_RefAttr & theLine);
 
+  /// Set middle
+  SKETCHAPI_EXPORT
+    std::shared_ptr<SketchAPI_MacroMiddlePoint> setMiddlePoint(
+      const ModelHighAPI_RefAttr& theLine);
+
   /// Set parallel
   SKETCHAPI_EXPORT
   std::shared_ptr<ModelHighAPI_Interface> setParallel(