49 fPlotParameters(plotParameters),
52 fSetLayoutCmd(nullptr),
53 fSetDimensionsCmd(nullptr),
56 fHelper = G4Analysis::make_unique<G4AnalysisMessengerHelper>(
"plot");
58 fDirectory = fHelper->CreateHnDirectory();
74void G4PlotMessenger::SetStyleCmd()
76 fSetStyleCmd = G4Analysis::make_unique<G4UIcmdWithAString>(
"/analysis/plot/setStyle",
this);
77#if defined(TOOLS_USE_FREETYPE)
78 fSetStyleCmd->SetGuidance(
"Set plotting style from: ");
79 fSetStyleCmd->SetGuidance(
" ROOT_default: ROOT style with high resolution fonts");
80 fSetStyleCmd->SetGuidance(
" hippodraw: hippodraw style with high resolution fonts");
81 fSetStyleCmd->SetGuidance(
" inlib_default: PAW style with low resolution fonts");
82 fSetStyleCmd->SetParameterName(
"Style",
false);
84 fSetStyleCmd->SetGuidance(
"Only one plotting style is available in low resolution: ");
85 fSetStyleCmd->SetGuidance(
" inlib_default: PAW style with low resolution fonts");
86 fSetStyleCmd->SetParameterName(
"Style",
false);
87 fSetStyleCmd->SetCandidates(
"inlib_default");
94void G4PlotMessenger::SetLayoutCmd()
97 columns->SetGuidance(
"The number of columns in the page layout.");
98 G4String range =
"columns>=1 && columns<=";
99 std::ostringstream osMaxColumns;
101 range.
append(osMaxColumns.str());
102 columns->SetParameterRange(range);
105 rows->SetGuidance(
"The number of rows in the page layout.");
106 range =
"rows>=1 && rows<=";
107 std::ostringstream osMaxRows;
109 range.
append(osMaxRows.str());
110 rows->SetParameterRange(range);
112 fSetLayoutCmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/plot/setLayout",
this);
118 fSetLayoutCmd->SetGuidance(
"Set page layout (number of columns and rows per page).");
119 fSetLayoutCmd->SetGuidance(
" Supported layouts: ");
120 G4String guidance =
" columns = 1 .. ";
121 guidance.
append(osMaxColumns.str());
122 fSetLayoutCmd->SetGuidance(guidance);
123 guidance =
" rows = 1 .. ";
124 guidance.
append(osMaxRows.str());
125 guidance.
append(
" and >= columns");
126 fSetLayoutCmd->SetGuidance(guidance);
127 fSetLayoutCmd->SetParameter(columns);
128 fSetLayoutCmd->SetParameter(rows);
133void G4PlotMessenger::SetDimensionsCmd()
136 width->SetGuidance(
"The page width.");
139 height->SetGuidance(
"The page height.");
141 fSetDimensionsCmd = G4Analysis::make_unique<G4UIcommand>(
"/analysis/plot/setDimensions",
this);
142 fSetDimensionsCmd->SetGuidance(
"Set the plotter window size (width and height) in pixels.");
143 fSetDimensionsCmd->SetParameter(width);
144 fSetDimensionsCmd->SetParameter(height);
156 std::vector<G4String> parameters;
161 fHelper->WarnAboutParameters(command, parameters.size());
165 if ( command == fSetLayoutCmd.get() ) {
169 fPlotParameters->
SetLayout(columns, rows);
171 else if ( command == fSetDimensionsCmd.get() ) {
177#if defined(TOOLS_USE_FREETYPE)
178 else if ( command == fSetStyleCmd.get() ) {
179 fPlotParameters->
SetStyle(newValues);
G4PlotMessenger(G4PlotParameters *plotParameters)
virtual ~G4PlotMessenger()
virtual void SetNewValue(G4UIcommand *command, G4String value) final
void SetLayout(G4int columns, G4int rows)
G4String GetAvailableStyles()
void SetDimensions(G4int width, G4int height)
void SetStyle(const G4String &style)
G4String & append(const G4String &)
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
void Tokenize(const G4String &line, std::vector< G4String > &tokens)