24 if (
auto xaxis = item->
xAxis(); xaxis)
25 if (
auto yaxis = item->
yAxis(); yaxis)
26 return static_cast<size_t>(xaxis->size() * yaxis->size());
42 std::unique_ptr<BinnedAxisItem> y_axis)
46 setContent(std::vector<double>(total_bin_count(
this), 0.0));
53 return item<BinnedAxisItem>(
T_XAXIS);
60 return item<BinnedAxisItem>(
T_YAXIS);
65 if (total_bin_count(
this) !=
data.size())
66 throw std::runtime_error(
"Data1DItem::setContent() -> Data doesn't match size of axis");
75 return data<std::vector<double>>();
Item to represent an axis with arbitrary binning.
Complex item holding mixed SessionItem types (single properties and other CompountItems).
Represents two-dimensional data (axes definition and 2d array of values).
static const std::string T_XAXIS
BinnedAxisItem * xAxis() const
Returns x-axis (nullptr if it doesn't exist).
BinnedAxisItem * yAxis() const
Returns y-axis (nullptr if it doesn't exist).
static const std::string T_YAXIS
void setAxes(std::unique_ptr< BinnedAxisItem > x_axis, std::unique_ptr< BinnedAxisItem > y_axis)
Sets axes and put data points to zero.
std::vector< double > content() const
Returns 2d vector representing 2d data.
void insert_axis(std::unique_ptr< BinnedAxisItem > axis, const std::string &tag)
Insert axis under given tag. Previous axis will be deleted and data points invalidated.
void setContent(const std::vector< double > &data)
SessionItem * takeItem(const TagRow &tagrow)
Removes item from given row from given tag, returns it to the caller.
SessionItem * getItem(const std::string &tag, int row=0) const
Returns item at given row of given tag.
void registerTag(const TagInfo &tagInfo, bool set_as_default=false)
Registers tag to hold items under given name.
bool setData(const T &value, int role=ItemDataRole::DATA, bool direct=false)
Sets data for a given role.
T data(int role=ItemDataRole::DATA) const
Returns data of given type T for given role.
bool insertItem(SessionItem *item, const TagRow &tagrow)
Insert item into given tag under the given row.
Holds info about single tag for SessionItem.
const model_type Data2DItemType
const model_type FixedBinAxisItemType
materialitems.h Collection of materials to populate MaterialModel.