30 const double default_min = 0.0;
31 const double default_max = 1.0;
41 auto* basicAxis = addProperty<BasicAxisItem>(
P_XAXIS);
42 basicAxis->binsItem();
44 auto* amplitudeAxis = addProperty<AmplitudeAxisItem>(
P_YAXIS);
45 amplitudeAxis->binsItem();
46 amplitudeAxis->titleItem();
47 amplitudeAxis->visibilityItem()->setValue(
true);
48 amplitudeAxis->visibilityItem();
162 throw Error(
"Error in DataItem1DView::resetToDefault: not implemented");
171 #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
172 auto centers = data->axis(0).binCenters();
173 auto values = data->flatVector();
174 return {QVector<double>(centers.cbegin(), centers.cend()),
175 QVector<double>(values.cbegin(), values.cend())};
177 return {QVector<double>::fromStdVector(data->axis(0).binCenters()),
178 QVector<double>::fromStdVector(data->flatVector())};
193 }
while ((
item =
item->parentItem()));
194 throw Error(
"Error in DataItem1DView::jobItem: passed item is not owned by any job item");
234 return item<BasicAxisItem>(
P_XAXIS);
239 return item<BasicAxisItem>(
P_XAXIS);
244 return item<AmplitudeAxisItem>(
P_YAXIS);
249 return item<AmplitudeAxisItem>(
P_YAXIS);
273 return QPair<double, double>(default_min, default_max);
277 double min(*std::min_element(vec.cbegin(), vec.cend()));
278 double max(*std::max_element(vec.cbegin(), vec.cend()));
281 min = std::numeric_limits<double>::epsilon() < min ? min : default_min;
283 max = max > min ? max : default_max;
285 return QPair<double, double>(min, max);
Defines various axis items.
Defines class ComboProperty.
Defines class Data1DViewItem.
Defines class DataProperties and its descendants.
Defines class DataPropertyContainer.
Defines namespace GUI::Model::DataViewUtils.
const QString y_axis_default_name
const QString x_axis_default_name
void setLogScale(bool value)
DoubleDescriptor min(const QString &unit=QString()) const
void setLowerBound(double value)
void setUpperBound(double value)
DoubleDescriptor max(const QString &unit=QString()) const
void setTitle(const QString &title)
Custom property to define list of string values with multiple selections. Intended for QVariant.
QVariant variant() const
Constructs variant enclosing given ComboProperty.
Holds data required for 1D DataItem representation.
JobItem * jobItem()
Returns either parenting JobItem or job item set with DataItem1DView::setJobItem.
void setLog(bool log_flag)
static bool isXAxisPropertyName(const QString &name)
static bool isAxesUnitsPropertyName(const QString &name)
static bool isYAxisPropertyName(const QString &name)
const AmplitudeAxisItem * yAxisItem() const
int getNbins() const
Number of bins in data.
QPair< double, double > dataRange(const Datafield *data) const
Init ymin, ymax to match the intensity values range.
static constexpr auto T_DATA_PROPERTIES
static constexpr auto P_TITLE
void setAxesRangeToData()
set zoom range of x,y axes to axes of input data
static constexpr auto P_AXES_UNITS
DataPropertyContainer * propertyContainerItem()
void resetView()
Set axes viewport to original data.
double getLowerY() const
Returns lower and upper zoom ranges of y-axis.
const BasicAxisItem * xAxisItem() const
QString getYaxisTitle() const
static constexpr auto P_YAXIS
void setUpperY(double value)
QString getXaxisTitle() const
double getLowerX() const
Returns lower and upper zoom ranges of x-axis.
QPair< QVector< double >, QVector< double > > graphData(Data1DProperties *property_item)
Returns point data for drawing.
void setLowerX(double value)
void setLowerY(double value)
void setUpperX(double value)
void setXaxisTitle(const QString &title)
DataPropertyContainer * createPropertyContainerItem()
static constexpr auto P_XAXIS
void setYaxisTitle(const QString &title)
void resetToDefault()
Returns data view to default state (no dimensional units, default axes' names)
SelectionDescriptor< QString > axesUnitsDescriptor() const
void setAxesUnits(const ComboProperty &units)
ComboProperty axesUnits() const
static constexpr auto M_TYPE
static constexpr auto M_TYPE
void setOnPropertyChange(std::function< void(QString)> f, const void *caller=nullptr)
Describes a selection (various possibilities and the current one).
Base class for a GUI data item.
SessionItem * addProperty(const QString &name, const QVariant &variant)
Add new property item and register new tag. name is the tag name and the display name....
bool registerTag(const QString &name, int min=0, int max=-1, QStringList modelTypes={})
Add new tag to this item with given name, min, max and types. max = -1 -> unlimited,...
QVariant value() const
Get value.
QVariant getItemValue(const QString &tag) const
Directly access value of item under given tag.
void setItemValue(const QString &tag, const QVariant &variant) const
Directly set value of item under given tag.
ModelMapper * mapper()
Returns the current model mapper of this item. Creates new one if necessary.
SessionModel * model() const
Returns model of this item.
T * item(const QString &tag) const
SessionItem * parentItem() const
Returns parent of this item.
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
T * insertItem(SessionItem *parent=nullptr, int row=-1, QString tag="")
std::unique_ptr< Datafield > getTranslatedData(Data1DViewItem *view_item, DataItem *data_item)
void updateAxesTitle(Data1DViewItem *view_item)
QString const & name(EShape k)