12#include "detray/plugins/svgtools/meta/proto/eta_lines.hpp"
13#include "detray/plugins/svgtools/meta/proto/intersection.hpp"
14#include "detray/plugins/svgtools/meta/proto/landmark.hpp"
15#include "detray/plugins/svgtools/meta/proto/trajectory.hpp"
16#include "detray/plugins/svgtools/styling/colors.hpp"
19#include "actsvg/core.hpp"
20#include "actsvg/core/style.hpp"
21#include "actsvg/proto/detector.hpp"
22#include "actsvg/proto/grid.hpp"
23#include "actsvg/proto/material.hpp"
24#include "actsvg/proto/portal.hpp"
25#include "actsvg/proto/surface.hpp"
26#include "actsvg/proto/volume.hpp"
27#include "actsvg/styles/defaults.hpp"
34namespace detray::svgtools::styling {
77 const actsvg::style::color& fill_color =
206 actsvg::style::font{},
207 actsvg::style::label{
"t/X0", actsvg::style::label::horizontal::right,
208 actsvg::style::label::vertical::top},
209 {colors::black, 1.f},
211 colors::gradient::rainbow_scale,
213 {{colors::black, 1.f}, 0.4f}};
246 {colors::black, 1.f}, {colors::black, 1.f}, 1.f, 1.f, 30u};
251 colors::black_theme(1.f).front(), 0.8f, 5.f,
"x"};
259 colors::green_theme(1.f).front(), 1.f};
276 actsvg::style::font{},
277 actsvg::style::label{
"t/X0", actsvg::style::label::horizontal::right,
278 actsvg::style::label::vertical::top},
279 {colors::black, 1.f},
281 colors::gradient::viridis_scale,
283 {{colors::black, 1.f}, 0.4f}};
322template <
typename po
int3_container_t>
323inline void apply_style(actsvg::proto::surface<point3_container_t>& p_surface,
324 const surface_style& styling) {
326 p_surface._fill = actsvg::style::fill(styling._fill_color);
327 p_surface._fill._fc._hl_rgb = styling._highlight_rgb;
328 p_surface._fill._fc._highlight = styling._highlights;
332 actsvg::style::stroke(styling._stroke_color, styling._stroke_width);
333 p_surface._stroke._sc._hl_rgb = styling._highlight_stroke_rgb;
334 p_surface._stroke._hl_width = styling._highlight_stroke_width;
338template <
typename po
int3_container_t>
339inline void apply_style(
340 typename actsvg::proto::portal<point3_container_t>::link& p_link,
341 const link_style& styling) {
342 p_link._end_marker._size = styling._marker_size;
346template <
typename po
int3_container_t>
347inline void apply_style(actsvg::proto::portal<point3_container_t>& p_portal,
348 const portal_style& styling) {
349 apply_style(p_portal._surface, styling._surface_style);
351 for (
auto& volume_link : p_portal._volume_links) {
352 apply_style<point3_container_t>(volume_link, styling._link_style);
357inline void apply_style(actsvg::proto::grid& p_grid,
359 p_grid._stroke._sc = styling._stroke_color;
360 p_grid._stroke._width = styling._stroke_width;
366inline void apply_style(actsvg::proto::surface_material& p_material,
368 p_material._info_pos = styling._info_pos;
370 p_material._gradient_pos = styling._gradient_pos;
371 p_material._gradient_box = styling._gradient_box;
372 p_material._gradient_font = styling._gradient_font;
373 p_material._gradient_label = styling._gradient_label;
374 p_material._gradient_stroke._sc = styling._gradient_stroke_color;
375 p_material._gradient_stroke._width = styling._gradient_stroke_width;
376 p_material._gradient._stops = colors::gradient::generate_stops(
377 styling._gradient_color_scale, styling._gradient_n_stops);
379 apply_style(p_material._grid, styling._grid_style);
383template <
typename po
int3_container_t>
384inline void apply_style(actsvg::proto::volume<point3_container_t>& p_volume,
386 using proto_sf_t = actsvg::proto::surface<point3_container_t>;
388 for (
auto& p_surface : p_volume._v_surfaces) {
389 const auto& sf_style =
390 (p_surface._sf_type == proto_sf_t::sf_type::e_sensitive)
391 ? styling._sensitive_surface_style
392 : styling._passive_surface_style;
393 apply_style(p_surface, sf_style);
395 for (
auto& p_portals : p_volume._portals) {
396 apply_style(p_portals, styling._portal_style);
398 apply_style(p_volume._surface_grid, styling._grid_style);
402template <
typename po
int3_container_t>
403inline void apply_style(actsvg::proto::detector<point3_container_t>& p_detector,
405 for (
auto& p_volume : p_detector._volumes) {
406 apply_style(p_volume, styling._volume_style);
411inline void apply_style(meta::proto::eta_lines& p_eta_lines,
413 p_eta_lines._stroke_main = actsvg::style::stroke(styling._fill_color_main,
414 styling._stroke_width_main);
416 p_eta_lines._stroke_half = actsvg::style::stroke(styling._fill_color_half,
417 styling._stroke_width_half);
418 p_eta_lines._stroke_half._dasharray = {2, 2};
419 p_eta_lines._label_font._size = styling._font_size;
423template <concepts::po
int3D po
int3_t>
424inline void apply_style(meta::proto::landmark<point3_t>& p_landmark,
426 const auto fill = actsvg::style::fill(styling._fill_color);
428 actsvg::style::stroke(styling._fill_color, styling._stroke_width);
430 const auto marker = actsvg::style::marker{styling._marker_type,
431 styling._marker_size, fill, stroke};
432 p_landmark._marker = marker;
436template <concepts::po
int3D po
int3_t>
437inline void apply_style(meta::proto::intersection<point3_t>& p_intersection,
440 actsvg::style::stroke(styling._fill_color, styling._stroke_width);
442 auto fill_color = styling._fill_color;
443 fill_color._opacity *= 0.5f;
444 const auto fill = actsvg::style::fill(fill_color);
446 const auto marker = actsvg::style::marker{styling._marker_type,
447 styling._marker_size, fill, stroke};
449 for (
auto& p_landmark : p_intersection._landmarks) {
450 p_landmark._marker = marker;
455template <concepts::po
int3D po
int3_t>
456inline void apply_style(meta::proto::trajectory<point3_t>& p_trajectory,
458 p_trajectory._stroke =
459 actsvg::style::stroke(styling._fill_color, styling._stroke_width);