9#include "MantidJson/Json.h"
27 if (Mantid::JsonHelpers::parse(source, &root)) {
28 const std::string shape = root[
"shape"].asString();
31 const std::string algorithmName(root[
"algorithm_name"].asString());
32 const int algorithmVersion(root[
"algorithm_version"].asInt());
34 std::vector<double> abcRadii, abcRadiiBackgroundInner, abcRadiiBackgroundOuter;
35 abcRadii.emplace_back(root[
"radius0"].asDouble());
36 abcRadii.emplace_back(root[
"radius1"].asDouble());
37 abcRadii.emplace_back(root[
"radius2"].asDouble());
38 abcRadiiBackgroundInner.emplace_back(root[
"background_inner_radius0"].asDouble());
39 abcRadiiBackgroundInner.emplace_back(root[
"background_inner_radius1"].asDouble());
40 abcRadiiBackgroundInner.emplace_back(root[
"background_inner_radius2"].asDouble());
41 abcRadiiBackgroundOuter.emplace_back(root[
"background_outer_radius0"].asDouble());
42 abcRadiiBackgroundOuter.emplace_back(root[
"background_outer_radius1"].asDouble());
43 abcRadiiBackgroundOuter.emplace_back(root[
"background_outer_radius2"].asDouble());
45 std::vector<V3D> directions(3);
46 directions[0].fromString(root[
"direction0"].asString());
47 directions[1].fromString(root[
"direction1"].asString());
48 directions[2].fromString(root[
"direction2"].asString());
50 product =
new PeakShapeEllipsoid(directions, abcRadii, abcRadiiBackgroundInner, abcRadiiBackgroundOuter, frame,
51 algorithmName, algorithmVersion);
57 throw std::invalid_argument(
"PeakShapeSphericalFactory:: No successor "
58 "factory able to process : " +
65 throw std::invalid_argument(
"PeakShapeSphericalFactory:: Source JSON for "
66 "the peak shape is not valid: " +
void setSuccessor(std::shared_ptr< const PeakShapeFactory > successorFactory) override
Set successor.
Mantid::Geometry::PeakShape * create(const std::string &source) const override
Create the PeakShape.
PeakShapeFactory_const_sptr m_successor
Successor factory.
PeakShapeEllipsoid : PeakShape representing a 3D ellipsoid.
static const std::string ellipsoidShapeName()
PeakShape : Abstract type to describes the shape of a peak.
SpecialCoordinateSystem
Special coordinate systems for Q3D.