24 #include <nlohmann/json.hpp>
29 class ISurfaceMaterial;
32 std::tuple<std::shared_ptr<const Acts::Surface>,
33 std::shared_ptr<const Acts::ISurfaceMaterial>,
47 void to_json(nlohmann::json&
j,
const std::shared_ptr<const Surface>&
surface);
54 void toJson(nlohmann::json&
j,
const std::shared_ptr<const Surface>&
surface,
72 template <
typename surface_t,
typename bounds_t>
74 nlohmann::json jTransform = j[
"transform"];
76 if constexpr (std::is_same_v<bounds_t, void>) {
77 return Surface::makeShared<surface_t>(
sTransform);
79 nlohmann::json jBounds = j[
"bounds"];
80 auto sBounds = SurfaceBoundsJsonConverter::fromJson<bounds_t>(jBounds);
85 namespace SurfaceJsonConverter {
124 std::shared_ptr<Surface>
fromJson(
const nlohmann::json& jSurface);
129 NLOHMANN_JSON_SERIALIZE_ENUM(
131 {{Surface::SurfaceType::Cone,
"ConeSurface"},
132 {Surface::SurfaceType::Cylinder,
"CylinderSurface"},
133 {Surface::SurfaceType::Disc,
"DiscSurface"},
134 {Surface::SurfaceType::Perigee,
"PerigeeSurface"},
135 {Surface::SurfaceType::Plane,
"PlaneSurface"},
136 {Surface::SurfaceType::Straw,
"StrawSurface"},
137 {Surface::SurfaceType::Curvilinear,
"CurvilinearSurface"},
138 {Surface::SurfaceType::Other,
"Other"}})