Salome HOME
updated copyright message
[modules/shaper.git] / src / SketchAPI / SketchAPI_Ellipse.h
index 13e344369dcb6b1f29da9a5825636fb5ce13d210..0ccf9abc79bbf58ccb65f527f6275037573aeb4d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  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,8 @@
 
 class ModelHighAPI_Selection;
 
+typedef std::pair<std::string, std::string> PairOfStrings;
+
 /// \class SketchAPI_Ellipse
 /// \ingroup CPPHighAPI
 /// \brief Interface for Ellipse feature.
@@ -59,7 +61,7 @@ public:
   /// Constructor with external.
   SKETCHAPI_EXPORT
   SketchAPI_Ellipse(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                    const std::string& theExternalName);
+                    const std::wstring& theExternalName);
 
   /// Destructor.
   SKETCHAPI_EXPORT
@@ -105,7 +107,7 @@ public:
 
   /// Set by external name.
   SKETCHAPI_EXPORT
-  void setByExternalName(const std::string& theExternalName);
+  void setByExternalName(const std::wstring& theExternalName);
 
   /// Set center.
   SKETCHAPI_EXPORT
@@ -113,7 +115,7 @@ public:
 
   /// Set center.
   SKETCHAPI_EXPORT
-  void setCenter(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
+  void setCenter(const std::shared_ptr<GeomAPI_Pnt2d>& theCenter);
 
   /// Set focus.
   SKETCHAPI_EXPORT
@@ -121,23 +123,69 @@ public:
 
   /// Set focus.
   SKETCHAPI_EXPORT
-  void setFocus(const std::shared_ptr<GeomAPI_Pnt2d> & theCenter);
+  void setFocus(const std::shared_ptr<GeomAPI_Pnt2d>& theFocus);
 
   /// Set radius.
   SKETCHAPI_EXPORT
   void setMinorRadius(double theRadius);
 
-  /// Return major axis of the ellipse
-  SKETCHAPI_EXPORT
-  ModelHighAPI_Selection majorAxis() const;
-
-  /// Return minor axis of the ellipse
-  SKETCHAPI_EXPORT
-  ModelHighAPI_Selection minorAxis() const;
+  /// Create construction elements (focuses, axes etc.).
+  /// Empty value for each parameter shows that the corresponding feature has been removed.
+  /// Value "aux" marks this feature as auxiliary.
+  /// And the name of the feature shows that it is a regular feature.
+  SKETCHAPI_EXPORT
+  std::list<std::shared_ptr<SketchAPI_SketchEntity> > construction(
+      const std::wstring& center = std::wstring(),
+      const std::wstring& firstFocus = std::wstring(),
+      const std::wstring& secondFocus = std::wstring(),
+      const std::wstring& majorAxisStart = std::wstring(),
+      const std::wstring& majorAxisEnd = std::wstring(),
+      const std::wstring& minorAxisStart = std::wstring(),
+      const std::wstring& minorAxisEnd = std::wstring(),
+      const std::wstring& majorAxis = std::wstring(),
+      const std::wstring& minorAxis = std::wstring()) const;
 
   /// Dump wrapped feature
   SKETCHAPI_EXPORT
   virtual void dump(ModelHighAPI_Dumper& theDumper) const;
+
+private:
+  /// Find all features connected with theEllipse by the internal coincidence.
+  /// \param[in]  theEllipse        ellipse or elliptic arc
+  /// \param[in]  theMajorAxis      names of attributes composing a major axis of ellipse
+  /// \param[in]  theMinorAxis      names of attributes composing a minor axis of ellipse
+  /// \param[out] theAttrToFeature  map attribute of ellipse and coincident auxiliary feature
+  static void collectAuxiliaryFeatures(FeaturePtr theEllipse,
+                                       const PairOfStrings& theMajorAxis,
+                                       const PairOfStrings& theMinorAxis,
+                                       std::map<std::string, FeaturePtr>& theAttrToFeature);
+
+  /// \brief Dump the construction features (points, axes) for the ellipse.
+  /// \param[in] theDumper      dumper instance
+  /// \param[in] theAttributes  list of attributes the construction points are
+  ///                           connected with, and their dump names
+  /// \param[in] theAuxFeatures list of construction features
+  static void dumpConstructionEntities(ModelHighAPI_Dumper& theDumper,
+                                       const FeaturePtr& theEllipse,
+                                       const std::list<PairOfStrings>& theAttributes,
+                                       const std::map<std::string, FeaturePtr>& theAuxFeatures);
+
+  /// \brief Create construction features for the ellipse connected
+  ///        with corresponding attribute of ellipse.
+  static std::list<std::shared_ptr<SketchAPI_SketchEntity> > buildConstructionEntities(
+      const FeaturePtr& theEllipse,
+      const std::list<PairOfStrings>& theAttributes,
+      const std::wstring& theCenter,
+      const std::wstring& theFirstFocus,
+      const std::wstring& theSecondFocus,
+      const std::wstring& theMajorAxisStart,
+      const std::wstring& theMajorAxisEnd,
+      const std::wstring& theMinorAxisStart,
+      const std::wstring& theMinorAxisEnd,
+      const std::wstring& theMajorAxis,
+      const std::wstring& theMinorAxis);
+
+  friend class SketchAPI_EllipticArc;
 };
 
 /// Pointer on Ellipse object.