]> SALOME platform Git repositories - modules/shaper.git/blobdiff - src/SketchAPI/SketchAPI_EllipticArc.cpp
Salome HOME
Copyright update 2022
[modules/shaper.git] / src / SketchAPI / SketchAPI_EllipticArc.cpp
index dd7d905c8fdfcf8953cd0753616de51e8de3bbfd..ce9064c7d21b5210e6ae38e26903be32371ecf68 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2019  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2022  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
@@ -74,7 +74,7 @@ SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feat
 }
 
 SketchAPI_EllipticArc::SketchAPI_EllipticArc(const std::shared_ptr<ModelAPI_Feature>& theFeature,
-                                     const std::string& theExternalName)
+                                     const std::wstring& theExternalName)
   : SketchAPI_SketchEntity(theFeature)
 {
   if (initialize()) {
@@ -92,11 +92,12 @@ void SketchAPI_EllipticArc::setByCenterFocusAndPoints(double theCenterX, double
                                                       double theEndX, double theEndY,
                                                       bool theInversed)
 {
-  fillAttribute(center(), theCenterX, theCenterY);
-  fillAttribute(firstFocus(), theFocusX, theFocusY);
-  fillAttribute(startPoint(), theStartX, theStartY);
-  fillAttribute(endPoint(), theEndX, theEndY);
+  // the order of attribute initialization is reversed to avoid odd recalculation of an elliptic arc
   fillAttribute(theInversed, reversed());
+  fillAttribute(endPoint(), theEndX, theEndY);
+  fillAttribute(startPoint(), theStartX, theStartY);
+  fillAttribute(firstFocus(), theFocusX, theFocusY);
+  fillAttribute(center(), theCenterX, theCenterY);
 
   execute();
 }
@@ -108,11 +109,12 @@ void SketchAPI_EllipticArc::setByCenterFocusAndPoints(
     const std::shared_ptr<GeomAPI_Pnt2d>& theEnd,
     bool theInversed)
 {
-  fillAttribute(theCenter, center());
-  fillAttribute(theFocus, firstFocus());
-  fillAttribute(theStart, startPoint());
-  fillAttribute(theEnd, endPoint());
+  // the order of attribute initialization is reversed to avoid odd recalculation of an elliptic arc
   fillAttribute(theInversed, reversed());
+  fillAttribute(theEnd, endPoint());
+  fillAttribute(theStart, startPoint());
+  fillAttribute(theFocus, firstFocus());
+  fillAttribute(theCenter, center());
 
   execute();
 }
@@ -123,7 +125,7 @@ void SketchAPI_EllipticArc::setByExternal(const ModelHighAPI_Selection & theExte
   execute();
 }
 
-void SketchAPI_EllipticArc::setByExternalName(const std::string & theExternalName)
+void SketchAPI_EllipticArc::setByExternalName(const std::wstring & theExternalName)
 {
   fillAttribute(ModelHighAPI_Selection("EDGE", theExternalName), external());
   execute();
@@ -176,15 +178,15 @@ static const std::list<PairOfStrings>& ellipticArcAttrAndDumpNames()
 }
 
 std::list<std::shared_ptr<SketchAPI_SketchEntity> > SketchAPI_EllipticArc::construction(
-    const std::string& center,
-    const std::string& firstFocus,
-    const std::string& secondFocus,
-    const std::string& majorAxisStart,
-    const std::string& majorAxisEnd,
-    const std::string& minorAxisStart,
-    const std::string& minorAxisEnd,
-    const std::string& majorAxis,
-    const std::string& minorAxis) const
+    const std::wstring& center,
+    const std::wstring& firstFocus,
+    const std::wstring& secondFocus,
+    const std::wstring& majorAxisStart,
+    const std::wstring& majorAxisEnd,
+    const std::wstring& minorAxisStart,
+    const std::wstring& minorAxisEnd,
+    const std::wstring& majorAxis,
+    const std::wstring& minorAxis) const
 {
   FeaturePtr anEllipse = feature();
 
@@ -213,7 +215,8 @@ void SketchAPI_EllipticArc::dump(ModelHighAPI_Dumper& theDumper) const
   AttributeSelectionPtr anExternal = aBase->selection(SketchPlugin_SketchEntity::EXTERNAL_ID());
   if (anExternal->context()) {
     // circle is external
-    theDumper << aBase << " = " << aSketchName << ".addEllipticArc(" << anExternal << ")" << std::endl;
+    theDumper << aBase << " = " << aSketchName << ".addEllipticArc("
+              << anExternal << ")" << std::endl;
   } else {
     // ellipse given by center, focus and radius
     theDumper << aBase << " = " << aSketchName << ".addEllipticArc("