Salome HOME
[EDF] (2023-T1) Sketch middle point constrain should create point if missing
[modules/shaper.git] / src / SketchAPI / SketchAPI_Sketch.h
index 3911015dea0dff208139a6968572a1718082e881..993e6ef901536e95e39316e17c17c648863da9bd 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;
 //--------------------------------------------------------------------------------------
@@ -140,7 +143,7 @@ public:
   std::shared_ptr<SketchAPI_Point> addPoint(const ModelHighAPI_Selection & theExternal);
   /// Add point
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Point> addPoint(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Point> addPoint(const std::wstring & theExternalName);
 
   /// Add intersection point
   SKETCHAPI_EXPORT
@@ -150,7 +153,7 @@ public:
   /// Add point
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_IntersectionPoint>
-    addIntersectionPoint(const std::string & theExternalName,
+    addIntersectionPoint(const std::wstring & theExternalName,
                          bool theKeepResult = false);
 
   /// Add line
@@ -167,7 +170,7 @@ public:
   std::shared_ptr<SketchAPI_Line> addLine(const ModelHighAPI_Selection & theExternal);
   /// Add line
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Line> addLine(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Line> addLine(const std::wstring & theExternalName);
 
   /// Add rectangle
   SKETCHAPI_EXPORT
@@ -178,6 +181,11 @@ 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
   SKETCHAPI_EXPORT
@@ -216,7 +224,7 @@ public:
   std::shared_ptr<SketchAPI_Circle> addCircle(const ModelHighAPI_Selection & theExternal);
   /// Add circle
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Circle> addCircle(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Circle> addCircle(const std::wstring & theExternalName);
 
   /// Add arc
   SKETCHAPI_EXPORT
@@ -270,7 +278,7 @@ public:
 
   /// Add arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Arc> addArc(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Arc> addArc(const std::wstring & theExternalName);
 
   /// Add ellipse
   SKETCHAPI_EXPORT
@@ -303,7 +311,7 @@ public:
   std::shared_ptr<SketchAPI_Ellipse> addEllipse(const ModelHighAPI_Selection & theExternal);
   /// Add ellipse
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Ellipse> addEllipse(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_Ellipse> addEllipse(const std::wstring & theExternalName);
 
   /// Add elliptic arc
   SKETCHAPI_EXPORT
@@ -326,7 +334,7 @@ public:
   std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const ModelHighAPI_Selection & theExternal);
   /// Add elliptic arc
   SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const std::string & theExternalName);
+  std::shared_ptr<SketchAPI_EllipticArc> addEllipticArc(const std::wstring & theExternalName);
 
   /// Add B-spline
   SKETCHAPI_EXPORT
@@ -358,12 +366,8 @@ public:
   SKETCHAPI_EXPORT
   std::shared_ptr<SketchAPI_Projection> addProjection(
       const ModelHighAPI_Selection & theExternalFeature,
-      bool theKeepResult = false);
-
-  /// Add projection
-  SKETCHAPI_EXPORT
-  std::shared_ptr<SketchAPI_Projection> addProjection(const std::string & theExternalName,
-                                                      bool theKeepResult = false);
+      bool keepResult = false,
+      bool keepRefToOriginal = true);
 
   /// Add mirror
   SKETCHAPI_EXPORT
@@ -373,10 +377,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
@@ -518,6 +524,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(
@@ -604,7 +615,7 @@ SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
  */
 SKETCHAPI_EXPORT
 SketchPtr addSketch(const std::shared_ptr<ModelAPI_Document> & thePart,
-                    const std::string & theExternalName);
+                    const std::wstring & theExternalName);
 
 /**\ingroup CPPHighAPI
  * \brief Create Sketch feature