BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
GUI::Model::DataViewUtils Namespace Reference

Functions

std::unique_ptr< Datafield > getTranslatedData (Data1DViewItem *view_item, DataItem *data_item)
 
void updateAxesTitle (Data1DViewItem *view_item)
 

Function Documentation

◆ getTranslatedData()

std::unique_ptr< Datafield > GUI::Model::DataViewUtils::getTranslatedData ( Data1DViewItem view_item,
DataItem data_item 
)

Definition at line 53 of file DataViewUtils.cpp.

55 {
56  if (!data_item || !data_item->getDatafield())
57  return {};
58 
59  auto* converter = getConverter(view_item);
60  auto current_units = selectedUnits(view_item);
61 
62  auto result = std::make_unique<Datafield>(converter->convertedAxes(current_units));
63 
64  result->setVector(data_item->getDatafield()->flatVector());
65 
66  return result;
67 }
Datafield * getDatafield()
Definition: DataItem.h:41

References DataItem::getDatafield().

Referenced by Data1DViewItem::graphData(), and Data1DViewItem::setAxesRangeToData().

Here is the call graph for this function:

◆ updateAxesTitle()

void GUI::Model::DataViewUtils::updateAxesTitle ( Data1DViewItem view_item)

Definition at line 42 of file DataViewUtils.cpp.

43 {
44  std::unique_ptr<ICoordSystem> converter{getConverter(view_item)};
45  if (!converter)
46  return;
47  auto current_units = selectedUnits(view_item);
48  view_item->setXaxisTitle(QString::fromStdString(converter->axisName(0, current_units)));
49  if (converter->rank() > 1)
50  view_item->setYaxisTitle(QString::fromStdString(converter->axisName(1, current_units)));
51 }
void setXaxisTitle(const QString &title)
void setYaxisTitle(const QString &title)

References Data1DViewItem::setXaxisTitle(), and Data1DViewItem::setYaxisTitle().

Referenced by Data1DViewItem::Data1DViewItem(), GUI::Model::JobItemUtils::createDefaultDetectorMap(), GUI::Model::JobItemUtils::setResults(), and GUI::Model::JobItemUtils::updateDataAxes().

Here is the call graph for this function: