From: spo Date: Fri, 18 Sep 2015 08:30:49 +0000 (+0300) Subject: Fix TestParameterRename X-Git-Tag: V_1.4.0~21^2 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=711560136859ac1fdc980aaacb38d039c0ccee3d;p=modules%2Fshaper.git Fix TestParameterRename --- diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index 8b5e915ee..183a027f4 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -280,17 +280,9 @@ void ParametersPlugin_EvalListener::renameInAttribute( } void ParametersPlugin_EvalListener::renameInDependants(std::shared_ptr theResultParameter, + const std::string& theOldName, const std::string& theNewName) { - // get parameter feature for the result - std::shared_ptr aParameter = - std::dynamic_pointer_cast( - ModelAPI_Feature::feature(theResultParameter)); - if (!aParameter.get()) - return; - - std::string anOldName = aParameter->string(ParametersPlugin_Parameter::VARIABLE_ID())->value(); - std::set > anAttributes = theResultParameter->data()->refsToMe(); std::set >::const_iterator anAttributeIt = @@ -303,10 +295,10 @@ void ParametersPlugin_EvalListener::renameInDependants(std::shared_ptrowner()); if (aParameter.get()) // Rename - renameInParameter(aParameter, anOldName, theNewName); + renameInParameter(aParameter, theOldName, theNewName); } else // Rename - renameInAttribute(anAttribute, anOldName, theNewName); + renameInAttribute(anAttribute, theOldName, theNewName); } } @@ -366,7 +358,7 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent( return; } - renameInDependants(aResultParameter, aMessage->newName()); + renameInDependants(aResultParameter, aMessage->oldName(), aMessage->newName()); } void ParametersPlugin_EvalListener::processReplaceParameterEvent( @@ -391,5 +383,5 @@ void ParametersPlugin_EvalListener::processReplaceParameterEvent( double aRealValue = aResultParameter->data()->real(ModelAPI_ResultParameter::VALUE())->value(); std::string aValue = toStdString(aRealValue); - renameInDependants(aResultParameter, aValue); + renameInDependants(aResultParameter, aResultParameter->data()->name(), aValue); } diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.h b/src/ParametersPlugin/ParametersPlugin_EvalListener.h index 56bb88dd4..c24831780 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.h +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.h @@ -43,6 +43,7 @@ class ParametersPlugin_EvalListener : public Events_Listener const std::string& theOldName, const std::string& theNewName); void renameInDependants(std::shared_ptr theResultParameter, + const std::string& theOldName, const std::string& theNewName); private: