Skip to content
Snippets Groups Projects
Commit 28f4ec01 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ICoordSystem: member m_axes now here (#71)

parent d3c9c427
No related branches found
No related tags found
1 merge request!1557common member m_axes moved to ICoordSyst (#71)
......@@ -66,7 +66,7 @@ PointwiseAxis* createAxisFrom(const IAxis& axis, Coords coords, const std::strin
// ************************************************************************************************
CoordSystem1D::CoordSystem1D(const IAxis* axis)
: m_axis(axis)
: ICoordSystem({axis})
{
}
......@@ -116,12 +116,12 @@ AngularReflectometryCoords::AngularReflectometryCoords(double wavelength, const
: CoordSystem1D(createAxisFrom(axis, axis_units, nameOfAxis0(axis_units), wavelength))
, m_wavelength(wavelength)
{
if (m_axis->min() < 0 || m_axis->max() > M_PI_2)
if (m_axes[0]->min() < 0 || m_axes[0]->max() > M_PI_2)
throw std::runtime_error("Error in CoordSystem1D: input axis range is out of bounds");
}
AngularReflectometryCoords::AngularReflectometryCoords(const AngularReflectometryCoords& other)
: CoordSystem1D(other.m_axis->clone())
: CoordSystem1D(other.m_axes[0]->clone())
, m_wavelength(other.m_wavelength)
{
}
......
......@@ -47,9 +47,7 @@ protected:
//! Returns translating functional (rads --> output units)
virtual std::function<double(double)> getTraslatorTo(Coords units) const = 0;
const IAxis* coordinateAxis() const { return m_axis.get(); }
std::unique_ptr<const IAxis> m_axis; //!< semantics depends on subclass
const IAxis* coordinateAxis() const { return m_axes[0]; }
};
......
......@@ -42,12 +42,12 @@ double axisAngle(size_t i_axis, R3 kf)
// ************************************************************************************************
CoordSystem2D::CoordSystem2D(const std::vector<const IAxis*>& axes)
: m_axes(axes)
: ICoordSystem(axes)
{
}
CoordSystem2D::CoordSystem2D(const CoordSystem2D& other)
: m_axes(other.m_axes)
: CoordSystem2D(other.m_axes)
{
}
......
......@@ -45,8 +45,6 @@ public:
protected:
CoordSystem2D(const CoordSystem2D& other);
std::vector<const IAxis*> m_axes;
private:
virtual double calculateValue(size_t i_axis, Coords units, double value) const = 0;
};
......
......@@ -35,6 +35,10 @@ class IAxis;
class ICoordSystem : public ICloneable {
public:
ICoordSystem(std::vector<const IAxis*> axes)
: m_axes(axes)
{
}
~ICoordSystem() override;
ICoordSystem* clone() const override = 0;
......@@ -56,6 +60,8 @@ public:
protected:
Coords substituteDefaultUnits(Coords units) const;
std::vector<const IAxis*> m_axes;
};
#endif // BORNAGAIN_DEVICE_COORD_ICOORDSYSTEM_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment