Salome HOME
Issue #2966: Provide update of viewer on text color preference changed
[modules/shaper.git] / src / ParametersAPI / ParametersAPI_Parameter.cpp
index 7bc88521a282950f9fc61c375c0796507140e4ca..2af3eec68d1bd59e38dd6436496423c4f77fb9c5 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2017  CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019  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
@@ -12,9 +12,9 @@
 //
 // You should have received a copy of the GNU Lesser General Public
 // License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
 
 #include "ParametersAPI_Parameter.h"
@@ -22,6 +22,7 @@
 #include <ModelHighAPI_Dumper.h>
 #include <ModelHighAPI_Tools.h>
 #include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_Events.h>
 //--------------------------------------------------------------------------------------
 ParametersAPI_Parameter::ParametersAPI_Parameter(
     const std::shared_ptr<ModelAPI_Feature> & theFeature)
@@ -91,3 +92,14 @@ ParameterPtr addParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
   std::shared_ptr<ModelAPI_Feature> aFeature = thePart->addFeature(ParametersAPI_Parameter::ID());
   return ParameterPtr(new ParametersAPI_Parameter(aFeature, theName, theExpression, theComment));
 }
+
+//--------------------------------------------------------------------------------------
+void removeParameter(const std::shared_ptr<ModelAPI_Document> & thePart,
+                     const ParameterPtr & theParameter)
+{
+  FeaturePtr aParam = theParameter->feature();
+  if (aParam) {
+    ModelAPI_ReplaceParameterMessage::send(aParam, 0);
+    thePart->removeFeature(aParam);
+  }
+}