BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FitComparisonController2D Class Reference

Description

Provides synchronization between certain properties of fit related IntensityDataItems. Used solely in FitComparisonWidget.

Definition at line 30 of file FitComparisonController.h.

Inheritance diagram for FitComparisonController2D:
[legend]
Collaboration diagram for FitComparisonController2D:
[legend]

Classes

class  DiffItemController
 

Public Member Functions

 FitComparisonController2D (QObject *parent=nullptr)
 
void clear ()
 
IntensityDataItemdiffItem ()
 
void resetDiffItem ()
 
void setItem (JobItem *job_item)
 
void updateDiffData ()
 

Private Attributes

PropertyRepeaterm_appearanceRepeater
 
DiffItemControllerm_diff_item_controller
 
PropertyRepeaterm_xAxisRepeater
 
PropertyRepeaterm_yAxisRepeater
 
PropertyRepeaterm_zAxisRepeater
 

Constructor & Destructor Documentation

◆ FitComparisonController2D()

FitComparisonController2D::FitComparisonController2D ( QObject *  parent = nullptr)
explicit

Definition at line 51 of file FitComparisonController.cpp.

52  : QObject(parent)
58 {
59 }
FitComparisonController2D::DiffItemController DiffItemController
DiffItemController * m_diff_item_controller
PropertyRepeater * m_appearanceRepeater
static constexpr auto M_TYPE
Tracks property change (axes range, units etc) for the collection of IntensityDataItems and sets same...

Member Function Documentation

◆ clear()

void FitComparisonController2D::clear ( )

Definition at line 113 of file FitComparisonController.cpp.

References PropertyRepeater::clear(), m_appearanceRepeater, m_diff_item_controller, m_xAxisRepeater, m_yAxisRepeater, m_zAxisRepeater, and FitComparisonController2D::DiffItemController::unsubscribe().

Referenced by setItem(), and FitComparisonWidget::unsubscribeFromItem().

Here is the call graph for this function:

◆ diffItem()

IntensityDataItem * FitComparisonController2D::diffItem ( )

Definition at line 61 of file FitComparisonController.cpp.

References FitComparisonController2D::DiffItemController::diffItem(), and m_diff_item_controller.

Referenced by FitComparisonWidget::diffItem(), resetDiffItem(), setItem(), and FitComparisonWidget::subscribeToItem().

Here is the call graph for this function:

◆ resetDiffItem()

void FitComparisonController2D::resetDiffItem ( )

Definition at line 107 of file FitComparisonController.cpp.

108 {
109  diffItem()->resetView();
110  diffItem()->setLowerAndUpperZ(relative_diff_min_2d, relative_diff_max_2d);
111 }
void setLowerAndUpperZ(double zmin, double zmax)
void resetView()
Set axes viewport to original data.

References diffItem(), IntensityDataItem::resetView(), and IntensityDataItem::setLowerAndUpperZ().

Referenced by FitComparisonWidget::onResetViewAction().

Here is the call graph for this function:

◆ setItem()

void FitComparisonController2D::setItem ( JobItem job_item)

Definition at line 67 of file FitComparisonController.cpp.

68 {
69  ASSERT(job_item);
70 
71  clear();
73 
74  auto* sim_data_item = dynamic_cast<IntensityDataItem*>(job_item->dataItem());
75  auto* real_data_item = dynamic_cast<IntensityDataItem*>(job_item->realDataItem()->dataItem());
76 
77  double zmin = real_data_item->getLowerZ();
78  double zmax = real_data_item->getUpperZ();
79  sim_data_item->setLowerAndUpperZ(zmin, zmax);
80 
81  diffItem()->xAxisItem()->setTitle(sim_data_item->getXaxisTitle());
82  diffItem()->yAxisItem()->setTitle(sim_data_item->getYaxisTitle());
83  diffItem()->setLowerAndUpperZ(relative_diff_min_2d, relative_diff_max_2d);
85 
86  m_appearanceRepeater->addItem(real_data_item);
87  m_appearanceRepeater->addItem(sim_data_item);
89 
90  m_xAxisRepeater->addItem(real_data_item->xAxisItem());
91  m_xAxisRepeater->addItem(sim_data_item->xAxisItem());
92  m_xAxisRepeater->addItem(diffItem()->xAxisItem());
93 
94  m_yAxisRepeater->addItem(real_data_item->yAxisItem());
95  m_yAxisRepeater->addItem(sim_data_item->yAxisItem());
96  m_yAxisRepeater->addItem(diffItem()->yAxisItem());
97 
98  m_zAxisRepeater->addItem(real_data_item->zAxisItem());
99  m_zAxisRepeater->addItem(sim_data_item->zAxisItem());
100 }
void setTitle(const QString &title)
Definition: AxesItems.cpp:85
double getLowerZ() const
Returns lower and upper zoom ranges of z-axis.
void setAxesRangeToData() override
set zoom range of x,y axes to axes of input data
const BasicAxisItem * yAxisItem() const
const BasicAxisItem * xAxisItem() const
DataItem * dataItem()
Definition: JobItem.cpp:101
RealDataItem * realDataItem()
Definition: JobItem.cpp:290
void addItem(SessionItem *sessionItem)
DataItem * dataItem()

References PropertyRepeater::addItem(), clear(), RealDataItem::dataItem(), JobItem::dataItem(), diffItem(), IntensityDataItem::getLowerZ(), m_appearanceRepeater, m_diff_item_controller, m_xAxisRepeater, m_yAxisRepeater, m_zAxisRepeater, JobItem::realDataItem(), IntensityDataItem::setAxesRangeToData(), FitComparisonController2D::DiffItemController::setItem(), IntensityDataItem::setLowerAndUpperZ(), BasicAxisItem::setTitle(), IntensityDataItem::xAxisItem(), and IntensityDataItem::yAxisItem().

Referenced by FitComparisonWidget::subscribeToItem().

Here is the call graph for this function:

◆ updateDiffData()

void FitComparisonController2D::updateDiffData ( )

Definition at line 102 of file FitComparisonController.cpp.

References m_diff_item_controller, and FitComparisonController2D::DiffItemController::updateDiffData().

Here is the call graph for this function:

Member Data Documentation

◆ m_appearanceRepeater

PropertyRepeater* FitComparisonController2D::m_appearanceRepeater
private

Definition at line 46 of file FitComparisonController.h.

Referenced by clear(), and setItem().

◆ m_diff_item_controller

DiffItemController* FitComparisonController2D::m_diff_item_controller
private

Definition at line 45 of file FitComparisonController.h.

Referenced by clear(), diffItem(), setItem(), and updateDiffData().

◆ m_xAxisRepeater

PropertyRepeater* FitComparisonController2D::m_xAxisRepeater
private

Definition at line 47 of file FitComparisonController.h.

Referenced by clear(), and setItem().

◆ m_yAxisRepeater

PropertyRepeater* FitComparisonController2D::m_yAxisRepeater
private

Definition at line 48 of file FitComparisonController.h.

Referenced by clear(), and setItem().

◆ m_zAxisRepeater

PropertyRepeater* FitComparisonController2D::m_zAxisRepeater
private

Definition at line 49 of file FitComparisonController.h.

Referenced by clear(), and setItem().


The documentation for this class was generated from the following files: