ACTS
Experiment-independent tracking
Loading...
Searching...
No Matches
information.hpp
1// This file is part of the ACTS project.
2//
3// Copyright (C) 2016 CERN for the benefit of the ACTS project
4//
5// This Source Code Form is subject to the terms of the Mozilla Public
6// License, v. 2.0. If a copy of the MPL was not distributed with this
7// file, You can obtain one at https://mozilla.org/MPL/2.0/.
8
9#pragma once
10
11// Project include(s)
12#include "detray/plugins/svgtools/meta/proto/information_section.hpp"
13
14// Actsvg include(s)
15#include "actsvg/core.hpp"
16
17// System include(s)
18#include <string>
19
20namespace detray::svgtools::meta::display {
21
22template <concepts::point3D point3_t, concepts::point2D point2_t,
23 typename view_t>
24inline auto information_section(
25 const std::string& id,
26 const svgtools::meta::proto::information_section<point3_t>& is,
27 const view_t& view, const point2_t& screen_offset,
28 const actsvg::svg::object& connected_object,
29 const bool use_relative_offset = false) {
30 // Title style
31 actsvg::style::fill title_fill;
32 title_fill._fc._rgb = is._color;
33 title_fill._fc._opacity = 0.8f;
34 actsvg::style::font title_font;
35
36 title_font._size = 16u;
37 title_font._fc = actsvg::style::color{{255, 255, 255}};
38
39 // Info text style
40 actsvg::style::fill info_fill;
41 info_fill._fc._rgb = is._color;
42 info_fill._fc._opacity = 0.4f;
43
44 actsvg::style::font info_font;
45 info_font._size = 12;
46
47 // Box stroke
48 actsvg::style::stroke stroke;
49
50 const auto position =
51 use_relative_offset
52 ? (screen_offset + view(std::vector{is._position}).at(0))
53 : screen_offset;
54
55 return actsvg::draw::connected_info_box(
56 id, position, is._title, title_fill, title_font, is._info, info_fill,
57 info_font, stroke, connected_object, {"mousedown", "mouseout"});
58}
59} // namespace detray::svgtools::meta::display