Salome HOME
Revert "bos#35152 [EDF] (2023-T1) Sketch Circle should allow user to position constru...
[modules/shaper.git] / src / SketchPlugin / SketchPlugin_Split.cpp
index b0a5658ffef5145a4ee4c13906f34caa50aed772..ab89602c1e674c8c6b35bedcc3c375e8cdc50d27 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
@@ -28,6 +28,8 @@
 #include <GeomDataAPI_Point2D.h>
 #include <GeomAlgoAPI_ShapeTools.h>
 
+#include <Locale_Convert.h>
+
 #include <ModelAPI_AttributeBoolean.h>
 #include <ModelAPI_AttributeDouble.h>
 #include <ModelAPI_AttributeRefAttr.h>
@@ -1095,10 +1097,10 @@ FeaturePtr SketchPlugin_Split::splitEllipticArc(FeaturePtr& theSplitFeature,
 }
 
 FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature,
-                                               FeaturePtr& theBaseFeatureModified,
-                                               FeaturePtr& theAfterFeature,
-                                               std::set<AttributePoint2DPtr>& thePoints,
-                                               std::set<FeaturePtr>& theCreatedFeatures,
+                                           FeaturePtr& theBaseFeatureModified,
+                                           FeaturePtr& /*theAfterFeature*/,
+                                           std::set<AttributePoint2DPtr>& thePoints,
+                                           std::set<FeaturePtr>& theCreatedFeatures,
                  std::set<std::pair<AttributePtr, AttributePtr>>& theModifiedAttributes)
 {
   FeaturePtr anNewFeature;
@@ -1164,8 +1166,16 @@ FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature,
         aRefsToParent.push_back(*aRef);
     }
     for (std::list<AttributePtr>::iterator aRef = aRefsToParent.begin();
-         aRef != aRefsToParent.end(); ++aRef)
-      std::dynamic_pointer_cast<ModelAPI_AttributeReference>(*aRef)->setValue(theSplitFeature);
+         aRef != aRefsToParent.end(); ++aRef) {
+      std::dynamic_pointer_cast<ModelAPI_AttributeReference>(*aRef)->setValue(
+          theBaseFeatureModified);
+
+      FeaturePtr anOwner = ModelAPI_Feature::feature((*aRef)->owner());
+      SketchPlugin_Tools::replaceInName(anOwner,
+          aBaseFeature->name(), theBaseFeatureModified->name());
+      SketchPlugin_Tools::replaceInName(anOwner->lastResult(),
+          aBaseFeature->name(), theBaseFeatureModified->name());
+    }
   }
 
   theCreatedFeatures.insert(theBaseFeatureModified);
@@ -1204,7 +1214,7 @@ FeaturePtr SketchPlugin_Split::splitClosed(FeaturePtr& theSplitFeature,
 
 void SketchPlugin_Split::arrangePointsOnLine(
     const AttributePoint2DPtr& theStartPointAttr,
-    const AttributePoint2DPtr& theEndPointAttr,
+    const AttributePoint2DPtr& /*theEndPointAttr*/,
     AttributePoint2DPtr& theFirstPointAttr,
     AttributePoint2DPtr& theLastPointAttr) const
 {
@@ -1220,7 +1230,7 @@ void SketchPlugin_Split::arrangePointsOnLine(
 void SketchPlugin_Split::arrangePointsOnArc(
     const FeaturePtr& theArc,
     const std::shared_ptr<GeomDataAPI_Point2D>& theStartPointAttr,
-    const std::shared_ptr<GeomDataAPI_Point2D>& theEndPointAttr,
+    const std::shared_ptr<GeomDataAPI_Point2D>& /*theEndPointAttr*/,
     std::shared_ptr<GeomDataAPI_Point2D>& theFirstPointAttr,
     std::shared_ptr<GeomDataAPI_Point2D>& theSecondPointAttr) const
 {
@@ -1381,7 +1391,7 @@ std::string SketchPlugin_Split::getFeatureInfo(const std::shared_ptr<ModelAPI_Fe
   }
 
   if (theFeature->data()->isValid())
-    anInfo.append(theFeature->data()->name().c_str());
+    anInfo.append(Locale::Convert::toString(theFeature->data()->name()));
 
   if (isUseAttributesInfo) {
     std::string aPointsInfo = ModelGeomAlgo_Point2D::getPontAttributesInfo(theFeature,