X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Feature.cpp;h=f42f4c835b000d023ebc2dc0d1188e939b232045;hb=06e7f5859095193fc7f498bd89a7d28009794f53;hp=6ad032f18babeb82f14283b8243686072265027f;hpb=6e421e939851e0de46554ae45a3ca0e1f67cd91d;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Feature.cpp b/src/SketchPlugin/SketchPlugin_Feature.cpp index 6ad032f18..f42f4c835 100644 --- a/src/SketchPlugin/SketchPlugin_Feature.cpp +++ b/src/SketchPlugin/SketchPlugin_Feature.cpp @@ -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 @@ -57,3 +57,21 @@ SketchPlugin_Sketch* SketchPlugin_Feature::sketch() return mySketch; } +void SketchPlugin_Feature::keepCurrentFeature() +{ + FeaturePtr aCurFeature = document()->currentFeature(true); + std::shared_ptr aSketchFeature = + std::dynamic_pointer_cast(aCurFeature); + std::shared_ptr aSketch = + std::dynamic_pointer_cast(aCurFeature); + if ((!aSketchFeature || aSketchFeature->sketch() != sketch()) && + (!aSketch || aSketch.get() != sketch())) + myCurrentFeature = aCurFeature; +} + +void SketchPlugin_Feature::restoreCurrentFeature() +{ + if (myCurrentFeature) + document()->setCurrentFeature(myCurrentFeature, true); + myCurrentFeature = FeaturePtr(); +}