16 #include "Base/Axis/PointwiseAxis.h"
17 #include "Device/Coord/ICoordSystem.h"
18 #include "Device/Data/Datafield.h"
19 #include "Device/IO/IOFactory.h"
20 #include "Device/IO/ReadWriteINT.h"
26 , m_instrumentItem(nullptr)
43 Serialize::rwBaseClass<BasicAxisItem>(s,
"base",
this);
79 std::unique_ptr<IAxis> converted_axis(converter->createConvertedAxis(0, Coords::DEGREES));
82 std::vector<double> centers = converted_axis->binCenters();
83 for (
double& e : centers)
86 return std::make_unique<PointwiseAxis>(converted_axis->axisName(), std::move(centers));
93 Datafield axisData({
m_axis->clone()});
96 ReadWriteINT().writeDatafield(axisData, ss);
97 return QByteArray(ss.str().c_str(),
static_cast<int>(ss.str().size()));
105 std::istringstream str(data.toStdString());
106 std::unique_ptr<Datafield> d(ReadWriteINT().readDatafield(str));
107 m_axis = std::unique_ptr<IAxis>(d->axis(0).clone());
Defines class InstrumentItem and all its children.
Defines pointwise axis item.
SessionItem * maxItem() const
SessionItem * binsItem() const
SessionItem * minItem() const
void setBinCount(size_t value)
void setLowerBound(double value)
void setUpperBound(double value)
Abstract base class for instrument-specific item classes.
void deserializeBinaryData(const QByteArray &data) override
~PointwiseAxisItem() override
bool checkValidity() const
const SpecularInstrumentItem * m_instrumentItem
std::unique_ptr< IAxis > createAxis(double scale) const override
static constexpr auto P_NATIVE_AXIS_UNITS
void serialize(Streamer &s) override
void setOwningInstrument(const InstrumentItem *instrument)
std::unique_ptr< IAxis > m_axis
QByteArray serializeBinaryData() const override
const IAxis * axis() const
QString getUnitsLabel() const
void init(const IAxis &axis, const QString &units_label)
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 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.
void emitDataChanged(int role=Qt::DisplayRole)
Notify model about data changes.
void setEnabled(bool enabled)
Flags accessors.
SessionItem * getItem(const QString &tag="", int row=0) const
Returns item in given row of given tag.
ICoordSystem * createCoordSystem() const override
Supports serialization to or deserialization from QXmlStream.
QXmlStreamWriter * xmlWriter()
Returns stream writer or nullptr.
QXmlStreamReader * xmlReader()
Returns stream reader or nullptr.
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
void rwValue(Streamer &s, const QString &tag, bool &val)