13vector<G4SceneText>
getSceneTexts(
const std::shared_ptr<GOptions>& gopts) {
14 vector<G4SceneText> st;
16 auto g4t_node = gopts->getOptionNode(
"g4text");
19 for (
auto g4t_item : g4t_node) {
22 st_item.
text = gopts->get_required_variable_in_option<
string>(g4t_item,
"text");
24 st_item.
color = gopts->get_variable_in_option<
string>(g4t_item,
"color",
"black");
25 st_item.
kind = gopts->get_variable_in_option<
string>(g4t_item,
"kind",
"2D");
26 st_item.
layout = gopts->get_variable_in_option<
string>(g4t_item,
"layout",
"");
27 st_item.
x = gopts->get_variable_in_option<
double>(g4t_item,
"x", 0);
28 st_item.
y = gopts->get_variable_in_option<
double>(g4t_item,
"y", 0);
29 st_item.
z = gopts->get_optional_variable_in_option<
double>(g4t_item,
"z");
30 st_item.
unit = gopts->get_variable_in_option<
string>(g4t_item,
"unit",
"cm");
31 st_item.
size = gopts->get_variable_in_option<
double>(g4t_item,
"size", 24.0);
32 st_item.
dx = gopts->get_variable_in_option<
double>(g4t_item,
"dx", 4.0);
33 st_item.
dy = gopts->get_variable_in_option<
double>(g4t_item,
"dy", 4.0);
35 st.push_back(st_item);
Scene text option structures and helpers for the g4display module.
One text annotation to be inserted into the Geant4 scene.
std::string layout
Optional text layout such as "right"; empty keeps Geant4 default layout.
std::string color
Text color name understood by Geant4 (e.g. "black", "red").
std::string kind
Text kind: "2D" for text2D or "3D" for text attached in scene coordinates.
std::string text
Text string to be displayed.
int size
Text size parameter passed to Geant4 visualization command.
std::string unit
Unit used by 3D text positions.
std::optional< double > z
Z position used by 3D text; absent for 2D text.