37 std::vector<std::string> cmds;
39 const bool gui = gopts->getSwitch(
"gui");
40 const bool use_dawn = gopts->getSwitch(
"useDawn");
47 const bool open_configured_viewer = gui || g4view.driver ==
"TOOLSSG_OFFSCREEN";
48 if (!use_dawn && !open_configured_viewer) {
return cmds; }
51 cmds.emplace_back(
"/vis/open DAWNFILE");
53 if (open_configured_viewer) {
55 std::string openArg = g4view.driver +
" " + g4view.dimension;
56 if (g4view.driver !=
"TOOLSSG_OFFSCREEN") openArg += g4view.position;
57 cmds.emplace_back(
"/vis/open " + openArg);
62 cmds.emplace_back(
"/vis/viewer/set/autoRefresh false");
63 cmds.emplace_back(
"/vis/scene/create gemc");
64 cmds.emplace_back(
"/vis/sceneHandler/attach");
65 cmds.emplace_back(
"/vis/scene/add/volume root -1");
67 if (use_dawn && !open_configured_viewer) {
68 cmds.emplace_back(
"/vis/geometry/set/visibility World 0 false");
69 cmds.emplace_back(
"/vis/viewer/set/style surface");
71 if (open_configured_viewer) {
73 const double toDegrees = 180.0 / M_PI;
78 if (lightThetaValue == 0.0 && lightPhiValue == 0.0) {
79 lightThetaValue = thetaValue;
80 lightPhiValue = phiValue;
83 cmds.emplace_back(
"/vis/viewer/set/viewpointThetaPhi " + std::to_string(thetaValue) +
" " + std::to_string(phiValue));
84 cmds.emplace_back(
"/vis/viewer/set/lightsThetaPhi " + std::to_string(lightThetaValue) +
" " + std::to_string(lightPhiValue));
85 cmds.emplace_back(
"/vis/viewer/set/lineSegmentsPerCircle " + std::to_string(g4view.segsPerCircle));
86 cmds.emplace_back(
"/vis/viewer/set/background " + g4view.background);
87 cmds.emplace_back(
"/vis/viewer/set/numberOfCloudPoints " + std::to_string(g4view.cloudPoints));
89 cmds.emplace_back(
"/vis/viewer/set/autoRefresh true");
95 std::vector<std::string> commands;
98 if (decorations.scale) {
99 commands.emplace_back(
"/vis/scene/add/scale " +
100 std::to_string(decorations.scaleLength) +
" " +
101 decorations.scaleUnit +
" " +
102 decorations.scaleDirection +
" " +
103 colourToRGB(decorations.scaleColor));
105 if (decorations.axes) { commands.emplace_back(
"/vis/scene/add/axes"); }
106 if (decorations.date) {
107 commands.emplace_back(
"/vis/scene/add/date " + std::to_string(decorations.dateSize));
109 if (decorations.logo2D) { commands.emplace_back(
"/vis/scene/add/logo2D"); }
110 if (decorations.logo) { commands.emplace_back(
"/vis/scene/add/logo"); }
111 if (decorations.frame) {
112 commands.emplace_back(
"/vis/set/colour " + decorations.frameColor);
113 commands.emplace_back(
"/vis/set/lineWidth " + std::to_string(decorations.frameLineWidth));
114 commands.emplace_back(
"/vis/scene/add/frame");
115 commands.emplace_back(
"/vis/set/colour");
116 commands.emplace_back(
"/vis/set/lineWidth");
123 std::vector<std::string> commands;
128 for (
const auto &text: text_to_add) {
129 commands.emplace_back(
"/vis/set/textColour " + text.color);
130 if (!text.layout.empty()) {
131 commands.emplace_back(
"/vis/set/textLayout " + text.layout);
134 if (is3DTextKind(text.kind)) {
135 commands.emplace_back(
136 "/vis/scene/add/text " +
137 std::to_string(text.x) +
" " +
138 std::to_string(text.y) +
" " +
139 std::to_string(text.z) +
" " +
141 std::to_string(text.size) +
" " +
142 std::to_string(text.dx) +
" " +
143 std::to_string(text.dy) +
" " +
146 commands.emplace_back(
147 "/vis/scene/add/text2D " +
148 std::to_string(text.x) +
" " +
149 std::to_string(text.y) +
" " +
150 std::to_string(text.size) +
" ! ! " +
154 if (!text.layout.empty()) {
155 commands.emplace_back(
"/vis/set/textLayout left");
159 commands.emplace_back(
"/vis/set/textColour");
std::vector< std::string > addSceneDecorations(const std::shared_ptr< GOptions > &gopts)
Build commands for optional scene decorations such as scale, axes, logos, and frame.
Scene text option structures and helpers for the g4display module.