Skip to content
Snippets Groups Projects
Commit 823d5b3e authored by Pospelov, Gennady's avatar Pospelov, Gennady
Browse files

Recently introduced bug in FitParameterItems.

parent ca05bc60
No related branches found
No related tags found
No related merge requests found
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "ModelPath.h" #include "ModelPath.h"
#include "FitParameter.h" #include "FitParameter.h"
#include "ParameterTreeItems.h" #include "ParameterTreeItems.h"
#include "JobItem.h"
#include <cmath> #include <cmath>
namespace namespace
...@@ -122,15 +123,16 @@ std::unique_ptr<FitParameter> FitParameterItem::createFitParameter() const ...@@ -122,15 +123,16 @@ std::unique_ptr<FitParameter> FitParameterItem::createFitParameter() const
result->setStartValue(getItemValue(FitParameterItem::P_START_VALUE).toDouble()); result->setStartValue(getItemValue(FitParameterItem::P_START_VALUE).toDouble());
result->setLimits(attLimits()); result->setLimits(attLimits());
const SessionItem* jobItem = ModelPath::ancestor(this, Constants::JobItemType); const JobItem* jobItem = dynamic_cast<const JobItem*>(ModelPath::ancestor(this, Constants::JobItemType));
Q_ASSERT(jobItem); Q_ASSERT(jobItem);
foreach (SessionItem* linkItem, getItems(FitParameterItem::T_LINK)) { foreach (SessionItem* linkItem, getItems(FitParameterItem::T_LINK)) {
// QString link = linkItem->getItemValue(FitParameterLinkItem::P_LINK).toString(); QString link = linkItem->getItemValue(FitParameterLinkItem::P_LINK).toString();
// std::string domainPath = "*" + ModelPath::translateParameterName(jobItem, link);
// linkItem->setItemValue(FitParameterLinkItem::P_DOMAIN, QString::fromStdString(domainPath)); ParameterItem *parItem = dynamic_cast<ParameterItem*>(
ModelPath::getItemFromPath(link, jobItem->parameterContainerItem()));
Q_ASSERT(parItem);
ParameterItem *parItem = dynamic_cast<ParameterItem*>(linkItem);
QString translation = "*/" + ModelPath::itemPathTranslation(*parItem->linkedItem(), jobItem); QString translation = "*/" + ModelPath::itemPathTranslation(*parItem->linkedItem(), jobItem);
parItem->setItemValue(ParameterItem::P_DOMAIN, translation); parItem->setItemValue(ParameterItem::P_DOMAIN, translation);
......
...@@ -276,7 +276,13 @@ FitSuiteItem *JobItem::fitSuiteItem() ...@@ -276,7 +276,13 @@ FitSuiteItem *JobItem::fitSuiteItem()
return dynamic_cast<FitSuiteItem *>(getItem(JobItem::T_FIT_SUITE)); return dynamic_cast<FitSuiteItem *>(getItem(JobItem::T_FIT_SUITE));
} }
ParameterContainerItem *JobItem::parameterContainerItem() ParameterContainerItem* JobItem::parameterContainerItem()
{
return const_cast<ParameterContainerItem*>(
static_cast<const JobItem*>(this)->parameterContainerItem());
}
const ParameterContainerItem *JobItem::parameterContainerItem() const
{ {
return dynamic_cast<ParameterContainerItem *>(getItem(JobItem::T_PARAMETER_TREE)); return dynamic_cast<ParameterContainerItem *>(getItem(JobItem::T_PARAMETER_TREE));
} }
......
...@@ -96,6 +96,8 @@ public: ...@@ -96,6 +96,8 @@ public:
FitSuiteItem *fitSuiteItem(); FitSuiteItem *fitSuiteItem();
ParameterContainerItem *parameterContainerItem(); ParameterContainerItem *parameterContainerItem();
const ParameterContainerItem *parameterContainerItem() const;
FitParameterContainerItem *fitParameterContainerItem(); FitParameterContainerItem *fitParameterContainerItem();
RealDataItem *realDataItem(); RealDataItem *realDataItem();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment