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

Description

Definition at line 44 of file FitComparisonViewController.h.

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

Public Member Functions

 FitComparison1DViewController (QObject *parent)
 
void clear ()
 
Data1DViewItemdiffItemView ()
 
void resetDiffView ()
 
void setItem (JobItem *job_item)
 
void updateDiffData ()
 

Private Member Functions

void createDiffViewItem (JobItem *job_item)
 
void deleteDiffViewItem ()
 

Private Attributes

PropertyRepeaterm_appearanceRepeater
 
DiffItemControllerm_diff_item_controller
 
Data1DViewItemm_diff_view_item
 
PropertyRepeaterm_xAxisRepeater
 

Constructor & Destructor Documentation

◆ FitComparison1DViewController()

FitComparison1DViewController::FitComparison1DViewController ( QObject *  parent)
explicit

Definition at line 34 of file FitComparisonViewController.cpp.

35  : QObject(parent)
37  , m_diff_view_item(nullptr)
40 {
41 }
FitComparisonController2D::DiffItemController DiffItemController
Tracks property change (axes range, units etc) for the collection of IntensityDataItems and sets same...
static constexpr auto M_TYPE

Member Function Documentation

◆ clear()

void FitComparison1DViewController::clear ( )

Definition at line 84 of file FitComparisonViewController.cpp.

References PropertyRepeater::clear(), deleteDiffViewItem(), m_appearanceRepeater, m_diff_item_controller, m_diff_view_item, m_xAxisRepeater, and DiffItemController::unsubscribe().

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

Here is the call graph for this function:

◆ createDiffViewItem()

void FitComparison1DViewController::createDiffViewItem ( JobItem job_item)
private

Definition at line 93 of file FitComparisonViewController.cpp.

94 {
96  auto* container = m_diff_view_item->createPropertyContainerItem();
97  container->addItem(m_diff_item_controller->diffItem());
98 
99  m_diff_view_item->setJobItem(job_item);
100  auto* job_data_view = job_item->dataItemView();
101  ComboProperty units_value = job_data_view->axesUnits();
102  m_diff_view_item->setAxesUnits(units_value);
103 }
Custom property to define list of string values with multiple selections. Intended for QVariant.
Definition: ComboProperty.h:25
View model for 1D DataItem. Can represent several items at once. In current implementation the first ...
void setJobItem(JobItem *job_item)
Sets job item (for unit conversion) if DataItemView is dynamically created outside of JobModel.
DataPropertyContainer * createPropertyContainerItem()
void setAxesUnits(const ComboProperty &units)
Data1DViewItem * dataItemView()
Definition: JobItem.cpp:305
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
Definition: SessionModel.h:137

References Data1DViewItem::createPropertyContainerItem(), JobItem::dataItemView(), DiffItemController::diffItem(), SessionModel::insertItem(), m_diff_item_controller, m_diff_view_item, DiffItemController::model(), Data1DViewItem::setAxesUnits(), and Data1DViewItem::setJobItem().

Referenced by setItem().

Here is the call graph for this function:

◆ deleteDiffViewItem()

void FitComparison1DViewController::deleteDiffViewItem ( )
private

Definition at line 105 of file FitComparisonViewController.cpp.

106 {
107  auto* parent = m_diff_view_item->parentItem();
108  auto* old_view_item = parent->takeRow(parent->rowOfChild(m_diff_view_item));
109  ASSERT(old_view_item == m_diff_view_item);
110  delete (old_view_item);
111  m_diff_view_item = nullptr;
112 }
SessionItem * takeRow(int row)
Removes row from item and returns the item.
SessionItem * parentItem() const
Returns parent of this item.
Definition: SessionItem.cpp:67

References m_diff_view_item, SessionItem::parentItem(), and SessionItem::takeRow().

Referenced by clear().

Here is the call graph for this function:

◆ diffItemView()

Data1DViewItem * FitComparison1DViewController::diffItemView ( )

Definition at line 43 of file FitComparisonViewController.cpp.

44 {
45  return m_diff_view_item;
46 }

References m_diff_view_item.

Referenced by setItem(), and FitComparisonWidget1D::subscribeToItem().

◆ resetDiffView()

void FitComparison1DViewController::resetDiffView ( )

Definition at line 75 of file FitComparisonViewController.cpp.

76 {
77  if (!m_diff_view_item)
78  return;
80  m_diff_view_item->setLowerY(relative_diff_min_1d);
81  m_diff_view_item->setUpperY(relative_diff_max_1d);
82 }
void resetView()
Set axes viewport to original data.
void setUpperY(double value)
void setLowerY(double value)

References m_diff_view_item, Data1DViewItem::resetView(), Data1DViewItem::setLowerY(), and Data1DViewItem::setUpperY().

Referenced by FitComparisonWidget1D::onResetViewAction().

Here is the call graph for this function:

◆ setItem()

void FitComparison1DViewController::setItem ( JobItem job_item)

Definition at line 48 of file FitComparisonViewController.cpp.

49 {
50  ASSERT(job_item);
51 
52  clear();
54  createDiffViewItem(job_item);
55 
56  auto* job_data_view = job_item->dataItemView();
57 
58  m_appearanceRepeater->addItem(job_data_view);
60 
61  m_xAxisRepeater->addItem(job_data_view->xAxisItem());
62  m_xAxisRepeater->addItem(diffItemView()->xAxisItem());
63 
64  m_diff_view_item->setXaxisTitle(job_data_view->getXaxisTitle());
65  m_diff_view_item->setYaxisTitle("Relative difference");
66  m_diff_view_item->setLowerY(relative_diff_min_1d);
67  m_diff_view_item->setUpperY(relative_diff_max_1d);
68 }
void setXaxisTitle(const QString &title)
void setYaxisTitle(const QString &title)
void setJobItem(JobItem *job_item)
void addItem(SessionItem *sessionItem)

References PropertyRepeater::addItem(), clear(), createDiffViewItem(), JobItem::dataItemView(), diffItemView(), m_appearanceRepeater, m_diff_item_controller, m_diff_view_item, m_xAxisRepeater, DiffItemController::setJobItem(), Data1DViewItem::setLowerY(), Data1DViewItem::setUpperY(), Data1DViewItem::setXaxisTitle(), and Data1DViewItem::setYaxisTitle().

Referenced by FitComparisonWidget1D::subscribeToItem().

Here is the call graph for this function:

◆ updateDiffData()

void FitComparison1DViewController::updateDiffData ( )

Definition at line 70 of file FitComparisonViewController.cpp.

References m_diff_item_controller, and DiffItemController::updateDiffData().

Here is the call graph for this function:

Member Data Documentation

◆ m_appearanceRepeater

PropertyRepeater* FitComparison1DViewController::m_appearanceRepeater
private

Definition at line 62 of file FitComparisonViewController.h.

Referenced by clear(), and setItem().

◆ m_diff_item_controller

DiffItemController* FitComparison1DViewController::m_diff_item_controller
private

Definition at line 60 of file FitComparisonViewController.h.

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

◆ m_diff_view_item

Data1DViewItem* FitComparison1DViewController::m_diff_view_item
private

◆ m_xAxisRepeater

PropertyRepeater* FitComparison1DViewController::m_xAxisRepeater
private

Definition at line 63 of file FitComparisonViewController.h.

Referenced by clear(), and setItem().


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