Skip to content
Snippets Groups Projects
Commit 7775e3bc authored by Matthias Puchner's avatar Matthias Puchner
Browse files

set param units

parent e9faca03
No related branches found
No related tags found
1 merge request!606Refactor instrument items
...@@ -24,6 +24,7 @@ BeamAzimuthalAngleItem::BeamAzimuthalAngleItem() ...@@ -24,6 +24,7 @@ BeamAzimuthalAngleItem::BeamAzimuthalAngleItem()
valueItem->setLimits(RealLimits::limited(-90.0, 90.0)); valueItem->setLimits(RealLimits::limited(-90.0, 90.0));
valueItem->setDecimals(3); valueItem->setDecimals(3);
valueItem->setValue(0.0); valueItem->setValue(0.0);
distribution()->setUnit(Unit::degree);
initDistributionItem(m_show_mean); initDistributionItem(m_show_mean);
} }
...@@ -51,6 +52,7 @@ BeamInclinationAngleItem::BeamInclinationAngleItem() ...@@ -51,6 +52,7 @@ BeamInclinationAngleItem::BeamInclinationAngleItem()
valueItem->setLimits(RealLimits::limited(0.0, 90.0)); valueItem->setLimits(RealLimits::limited(0.0, 90.0));
valueItem->setDecimals(3); valueItem->setDecimals(3);
valueItem->setValue(0.2); valueItem->setValue(0.2);
distribution()->setUnit(Unit::degree);
initDistributionItem(m_show_mean); initDistributionItem(m_show_mean);
} }
......
...@@ -107,6 +107,7 @@ void BeamDistributionItem::initDistributionItem(bool show_mean) ...@@ -107,6 +107,7 @@ void BeamDistributionItem::initDistributionItem(bool show_mean)
for (auto* item : groupItem->groupItems()) { for (auto* item : groupItem->groupItems()) {
auto* distrItem = dynamic_cast<ResolutionItem*>(item); auto* distrItem = dynamic_cast<ResolutionItem*>(item);
distrItem->showMean(show_mean); distrItem->showMean(show_mean);
distrItem->setUnit(distributionNone->unit());
if (item == distributionNone) if (item == distributionNone)
continue; continue;
......
...@@ -36,12 +36,15 @@ BeamWavelengthItem::BeamWavelengthItem(const QString& model_type, Distributions ...@@ -36,12 +36,15 @@ BeamWavelengthItem::BeamWavelengthItem(const QString& model_type, Distributions
{ {
register_distribution_group(distribution_group); register_distribution_group(distribution_group);
// init DistributionNone
SessionItem* valueItem = dynamic_cast<SymmetricResolutionItem*>(distribution())->meanItem(); SessionItem* valueItem = dynamic_cast<SymmetricResolutionItem*>(distribution())->meanItem();
valueItem->setLimits(RealLimits::positive()); valueItem->setLimits(RealLimits::positive());
valueItem->setDecimals(4); valueItem->setDecimals(4);
valueItem->setValue(default_wl); valueItem->setValue(default_wl);
distribution()->setUnit(Unit::nanometer);
valueItem->setEditorType("ScientificSpinBox"); valueItem->setEditorType("ScientificSpinBox");
// init all other distributions by taking the values of DistributionNone
initDistributionItem(m_show_mean); initDistributionItem(m_show_mean);
} }
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
namespace { namespace {
void setupDistributionMean(SessionItem* distribution);
void setAxisPresentationDefaults(SessionItem* axis_item, const QString& type); void setAxisPresentationDefaults(SessionItem* axis_item, const QString& type);
GroupInfo createAxesGroup() GroupInfo createAxesGroup()
...@@ -38,7 +37,13 @@ SpecularBeamInclinationItem::SpecularBeamInclinationItem() ...@@ -38,7 +37,13 @@ SpecularBeamInclinationItem::SpecularBeamInclinationItem()
{ {
register_distribution_group(Distributions::Symmetric); register_distribution_group(Distributions::Symmetric);
setupAxisGroup(); setupAxisGroup();
setupDistributionMean(distribution());
SessionItem* valueItem = dynamic_cast<SymmetricResolutionItem*>(distribution())->meanItem();
ASSERT(valueItem);
valueItem->setLimits(RealLimits::limited(-90.0, 90.0));
valueItem->setDecimals(3);
valueItem->setValue(0.0);
distribution()->setUnit(Unit::degree);
initDistributionItem(m_show_mean); initDistributionItem(m_show_mean);
} }
...@@ -97,18 +102,6 @@ void SpecularBeamInclinationItem::setupAxisGroup() ...@@ -97,18 +102,6 @@ void SpecularBeamInclinationItem::setupAxisGroup()
namespace { namespace {
void setupDistributionMean(SessionItem* distribution)
{
ASSERT(distribution);
SessionItem* valueItem = dynamic_cast<SymmetricResolutionItem*>(distribution)->meanItem();
ASSERT(valueItem);
valueItem->setLimits(RealLimits::limited(-90.0, 90.0));
valueItem->setDecimals(3);
valueItem->setValue(0.0);
}
void setAxisPresentationDefaults(SessionItem* item, const QString& type) void setAxisPresentationDefaults(SessionItem* item, const QString& type)
{ {
auto* axis_item = dynamic_cast<BasicAxisItem*>(item); auto* axis_item = dynamic_cast<BasicAxisItem*>(item);
......
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