16 #include "Base/Axis/IAxis.h"
34 addProperty<BasicAxisItem>(
P_XAXIS);
36 auto* amplitudeAxis = addProperty<AmplitudeAxisItem>(
P_YAXIS);
37 amplitudeAxis->visibilityItem()->setValue(
true);
45 if (data !=
nullptr) {
46 if (data->rank() != 1)
47 throw Error(
"Error in SpecularDataItem::setDatafield: cannot handle non-1D data");
74 const double defaultXmin(0.0);
80 const double defaultXmax(1.0);
154 setDatafield(std::move(data).intensityData().release());
209 const int nx =
static_cast<int>(
m_data->axis(0).size());
216 const double default_min = 0.0;
217 const double default_max = 1.0;
220 return QPair<double, double>(default_min, default_max);
222 const auto vec = data->flatVector();
223 double min(*std::min_element(vec.cbegin(), vec.cend()));
224 double max(*std::max_element(vec.cbegin(), vec.cend()));
227 min = std::numeric_limits<double>::epsilon() < min ? min : default_min;
229 max = max > min ? max : default_max;
231 return QPair<double, double>(min, max);
236 return item<BasicAxisItem>(
P_XAXIS);
241 return item<BasicAxisItem>(
P_XAXIS);
246 return item<AmplitudeAxisItem>(
P_YAXIS);
251 return item<AmplitudeAxisItem>(
P_YAXIS);
Defines various axis items.
Defines ImportDataInfo helper struct.
const QString y_axis_default_name
const QString x_axis_default_name
Defines namespace GUI::Model::JobItemUtils.
Defines class SpecularDataItem.
void setLogScale(bool value)
DoubleDescriptor min(const QString &unit=QString()) const
void setBinCount(size_t value)
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.
Abstract base class for IntensityDataItem and SpecularDataItem. Owns one simulated data set of type D...
virtual void setDatafield(Datafield *data)=0
The given pointer becomes owned by this class!!
Datafield * getDatafield()
void setAxesUnits(const ComboProperty &units)
std::unique_ptr< Datafield > m_data
simulation results
Carries information about loaded data.
QString unitsLabel() const
QString axisLabel(size_t axis_index) const
Abstract base class for instrument-specific item classes.
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....
QVariant value() const
Get value.
void emitDataChanged(int role=Qt::DisplayRole)
Notify model about data changes.
void setYaxisTitle(const QString &title) override
double getLowerY() const
Returns lower and upper zoom ranges of y-axis.
void setDatafield(Datafield *data) override
The given pointer becomes owned by this class!!
QString getXaxisTitle() const
void updateAxesZoomLevel()
Sets zoom range of X,Y axes, if it was not yet defined.
int getNbins() const
Number of bins in data.
void setUpperY(double value)
static constexpr auto P_TITLE
static bool isXaxisPropertyName(const QString &name)
void setXaxisTitle(const QString &title) override
void setUpperX(double value)
void setLowerX(double value)
static constexpr auto P_XAXIS
std::vector< int > shape() const override
void setLowerY(double value)
void setLog(bool log_flag)
double getLowerX() const
Returns lower and upper zoom ranges of x-axis.
void setAxesRangeToData() override
set zoom range of x,y axes to axes of input data
QString getYaxisTitle() const
static bool isYaxisPropertyName(const QString &name)
void updateCoords(const InstrumentItem *instrument) override
void resetView()
Set axes viewport to original data.
QPair< double, double > dataRange() const
Init ymin, ymax to match the intensity values range.
double yMin() const
Returns min and max range of y-axis as given by IntensityData.
static constexpr auto P_YAXIS
const AmplitudeAxisItem * yAxisItem() const
void reset(ImportDataInfo data) override
Returns data to the state defined by user (imported) data.
double xMin() const
Returns min and max range of x-axis as given by IntensityData.
const BasicAxisItem * xAxisItem() const
void updateDataAxes(DataItem *intensityItem, const InstrumentItem *instrumentItem)
updates axes of Datafield in IntensityData item
QString const & name(EShape k)