BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
AxisProperty Class Reference

Description

Holds values which can be used to describe a FixedBinAxis.

Use this as a member in your class to

  • reduce dependency to axis items and axis classes
  • simplify serialization
  • easily have a UI supporting solution.

This class is designed to work seamlessly with the serialization methods; just call it's serialize for both reading and writing. For UI integration just use AxisPropertyEditor.

Do not forget to call all three init functions from within the containing class's constructor!

Definition at line 38 of file AxisProperty.h.

Public Member Functions

std::unique_ptr< FixedBinAxis > createAxis (double scaleFactor) const
 Creates an axis with empty title. More...
 
 DOUBLE_PROPERTY (max, Max)
 
 DOUBLE_PROPERTY (min, Min)
 
void initMax (const QString &label, const QString &tooltip, double value, const variant< QString, Unit > &unit, const RealLimits &limits=RealLimits::nonnegative(), uint decimals=3)
 
void initMin (const QString &label, const QString &tooltip, double value, const variant< QString, Unit > &unit, const RealLimits &limits=RealLimits::nonnegative(), uint decimals=3)
 
void initNbins (const QString &label, const QString &tooltip, uint n=100, const variant< QString, Unit > &unit="nbins")
 
void rwAxisProperty (Streamer &s, const QString &tag)
 
void serialize (Streamer &s)
 
 UINT_PROPERTY (nbins, Nbins)
 

Member Function Documentation

◆ createAxis()

std::unique_ptr< FixedBinAxis > AxisProperty::createAxis ( double  scaleFactor) const

Creates an axis with empty title.

Definition at line 40 of file AxisProperty.cpp.

41 {
42  return std::make_unique<FixedBinAxis>(std::string(), m_nbins, m_min * scaleFactor,
43  m_max * scaleFactor);
44 }

◆ DOUBLE_PROPERTY() [1/2]

AxisProperty::DOUBLE_PROPERTY ( max  ,
Max   
)

◆ DOUBLE_PROPERTY() [2/2]

AxisProperty::DOUBLE_PROPERTY ( min  ,
Min   
)

◆ initMax()

void AxisProperty::initMax ( const QString &  label,
const QString &  tooltip,
double  value,
const variant< QString, Unit > &  unit,
const RealLimits &  limits = RealLimits::nonnegative(),
uint  decimals = 3 
)

Definition at line 33 of file AxisProperty.cpp.

36 {
37  m_max.init(label, tooltip, value, unit, decimals, limits, "max");
38 }

◆ initMin()

void AxisProperty::initMin ( const QString &  label,
const QString &  tooltip,
double  value,
const variant< QString, Unit > &  unit,
const RealLimits &  limits = RealLimits::nonnegative(),
uint  decimals = 3 
)

Definition at line 26 of file AxisProperty.cpp.

29 {
30  m_min.init(label, tooltip, value, unit, decimals, limits, "min");
31 }

◆ initNbins()

void AxisProperty::initNbins ( const QString &  label,
const QString &  tooltip,
uint  n = 100,
const variant< QString, Unit > &  unit = "nbins" 
)

Definition at line 19 of file AxisProperty.cpp.

21 {
22  m_nbins.init(label, tooltip, n, unit, "nbins");
23 }

◆ rwAxisProperty()

void AxisProperty::rwAxisProperty ( Streamer s,
const QString &  tag 
)

Definition at line 46 of file AxisProperty.cpp.

47 {
48  s.start(tag);
49  s.assertVersion(0);
50  Serialize::rwProperty(s, m_nbins);
51  Serialize::rwProperty(s, m_min);
52  Serialize::rwProperty(s, m_max);
53  s.finish(tag);
54 }
void start(const QString &tag)
Definition: Streamer.cpp:82
void finish(const QString &tag)
Definition: Streamer.cpp:90
void assertVersion(unsigned expectedVersion) const
As reader, throws DeserializationException unless the expected version is read. As writer,...
Definition: Streamer.cpp:26
void rwProperty(Streamer &s, DoubleProperty &d)

References Streamer::assertVersion(), Streamer::finish(), Serialize::rwProperty(), and Streamer::start().

Here is the call graph for this function:

◆ serialize()

void AxisProperty::serialize ( Streamer s)

◆ UINT_PROPERTY()

AxisProperty::UINT_PROPERTY ( nbins  ,
Nbins   
)

The documentation for this class was generated from the following files: