33#include <tools/tokenize>
40G4VisCommandPlotterCreate::G4VisCommandPlotterCreate () {
41 fpCommand =
new G4UIcommand(
"/vis/plotter/create",
this);
42 fpCommand->SetGuidance(
"Create a named G4Plotter.");
46 fpCommand->SetParameter (parameter);
49G4VisCommandPlotterCreate::~G4VisCommandPlotterCreate () {
delete fpCommand;}
55 G4Scene* pScene = fpVisManager->GetCurrentScene();
56 if(pScene) CheckSceneAndNotifyHandlers (pScene);
62G4VisCommandPlotterSetLayout::G4VisCommandPlotterSetLayout () {
63 fpCommand =
new G4UIcommand(
"/vis/plotter/setLayout",
this);
64 fpCommand->SetGuidance(
"Set plotter grid layout.");
68 fpCommand->SetParameter (parameter);
72 fpCommand->SetParameter (parameter);
76 fpCommand->SetParameter (parameter);
79G4VisCommandPlotterSetLayout::~G4VisCommandPlotterSetLayout () {
delete fpCommand;}
85 std::istringstream is(newValue);
86 is >> plotter >> cols >> rows;
91 G4Scene* pScene = fpVisManager->GetCurrentScene();
92 if(pScene) CheckSceneAndNotifyHandlers (pScene);
98G4VisCommandPlotterAddStyle::G4VisCommandPlotterAddStyle () {
99 fpCommand =
new G4UIcommand(
"/vis/plotter/addStyle",
this);
100 fpCommand->SetGuidance(
"Add a style for a plotter.");
101 fpCommand->SetGuidance(
"It is applied on all regions/plots of the plotter.");
102 fpCommand->SetGuidance(
"default, ROOT_default, hippodraw are known embedded styles.");
103 fpCommand->SetGuidance(
"reset is a keyword used to reset regions style.");
107 fpCommand->SetParameter (parameter);
111 fpCommand->SetParameter (parameter);
114G4VisCommandPlotterAddStyle::~G4VisCommandPlotterAddStyle () {
delete fpCommand;}
120 std::istringstream is(newValue);
121 is >> plotter >> style;
126 G4Scene* pScene = fpVisManager->GetCurrentScene();
127 if(pScene) CheckSceneAndNotifyHandlers (pScene);
133G4VisCommandPlotterAddRegionStyle::G4VisCommandPlotterAddRegionStyle () {
134 fpCommand =
new G4UIcommand(
"/vis/plotter/addRegionStyle",
this);
135 fpCommand->SetGuidance(
"Add a style to be applied on a region.");
136 fpCommand->SetGuidance(
"default, ROOT_default, hippodraw are known embedded styles.");
137 fpCommand->SetGuidance(
"reset is a keyword used to reset a region style.");
141 fpCommand->SetParameter (parameter);
145 fpCommand->SetParameter (parameter);
149 fpCommand->SetParameter (parameter);
152G4VisCommandPlotterAddRegionStyle::~G4VisCommandPlotterAddRegionStyle () {
delete fpCommand;}
161 std::istringstream is(newValue);
162 is >> plotter >> region >> style;
165 G4cerr <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
173 G4Scene* pScene = fpVisManager->GetCurrentScene();
174 if(pScene) CheckSceneAndNotifyHandlers (pScene);
180G4VisCommandPlotterAddRegionParameter::G4VisCommandPlotterAddRegionParameter () {
181 fpCommand =
new G4UIcommand(
"/vis/plotter/addRegionParameter",
this);
182 fpCommand->SetGuidance(
"Add a parameter to be set on a region.");
186 fpCommand->SetParameter (parameter);
189 fpCommand->SetParameter (parameter);
192 fpCommand->SetParameter (parameter);
195 fpCommand->SetParameter (parameter);
198G4VisCommandPlotterAddRegionParameter::~G4VisCommandPlotterAddRegionParameter () {
delete fpCommand;}
200void G4VisCommandPlotterAddRegionParameter::SetNewValue (
G4UIcommand* command,
G4String newValue)
204 std::vector<std::string>
args;
205 tools::double_quotes_tokenize(newValue,
args);
213 std::string plotter =
args[0];
215 std::string parameter =
args[2];
216 std::string value =
args[3];
219 G4cerr <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
227 G4Scene* pScene = fpVisManager->GetCurrentScene();
228 if(pScene) CheckSceneAndNotifyHandlers (pScene);
234G4VisCommandPlotterClear::G4VisCommandPlotterClear () {
235 fpCommand =
new G4UIcommand(
"/vis/plotter/clear",
this);
236 fpCommand->SetGuidance(
"Remove plottables from all regions.");
240 fpCommand->SetParameter (parameter);
243G4VisCommandPlotterClear::~G4VisCommandPlotterClear () {
delete fpCommand;}
250 G4Scene* pScene = fpVisManager->GetCurrentScene();
251 if(pScene) CheckSceneAndNotifyHandlers (pScene);
257G4VisCommandPlotterClearRegion::G4VisCommandPlotterClearRegion () {
258 fpCommand =
new G4UIcommand(
"/vis/plotter/clearRegion",
this);
259 fpCommand->SetGuidance(
"Remove plottables a region.");
263 fpCommand->SetParameter (parameter);
267 fpCommand->SetParameter (parameter);
270G4VisCommandPlotterClearRegion::~G4VisCommandPlotterClearRegion () {
delete fpCommand;}
278 std::istringstream is(newValue);
279 is >> plotter >> region;
282 G4cerr <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
290 G4Scene* pScene = fpVisManager->GetCurrentScene();
291 if(pScene) CheckSceneAndNotifyHandlers (pScene);
297G4VisCommandPlotterList::G4VisCommandPlotterList () {
298 fpCommand =
new G4UIcommand(
"/vis/plotter/list",
this);
299 fpCommand->SetGuidance(
"List plotters in the scene.");
302G4VisCommandPlotterList::~G4VisCommandPlotterList () {
delete fpCommand;}
312G4VisCommandPlotterAddRegionH1::G4VisCommandPlotterAddRegionH1 () {
313 fpCommand =
new G4UIcommand(
"/vis/plotter/add/h1",
this);
314 fpCommand->SetGuidance(
"Attach a 1D histogram to a plotter region.");
318 fpCommand->SetParameter (parameter);
321 fpCommand->SetParameter (parameter);
325 fpCommand->SetParameter (parameter);
328G4VisCommandPlotterAddRegionH1::~G4VisCommandPlotterAddRegionH1 () {
delete fpCommand;}
337 std::istringstream is(newValue);
338 is >> hid >> plotter >> region;
342 G4cerr <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
350 G4Scene* pScene = fpVisManager->GetCurrentScene();
351 if(pScene) CheckSceneAndNotifyHandlers (pScene);
357G4VisCommandPlotterAddRegionH2::G4VisCommandPlotterAddRegionH2 () {
358 fpCommand =
new G4UIcommand(
"/vis/plotter/add/h2",
this);
359 fpCommand->SetGuidance(
"Attach a 2D histogram to a plotter region.");
363 fpCommand->SetParameter (parameter);
366 fpCommand->SetParameter (parameter);
370 fpCommand->SetParameter (parameter);
373G4VisCommandPlotterAddRegionH2::~G4VisCommandPlotterAddRegionH2 () {
delete fpCommand;}
382 std::istringstream is(newValue);
383 is >> hid >> plotter >> region;
387 G4cerr <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
395 G4Scene* pScene = fpVisManager->GetCurrentScene();
396 if(pScene) CheckSceneAndNotifyHandlers (pScene);
G4GLOB_DLL std::ostream G4cerr
G4Plotter & GetPlotter(const G4String &a_name)
static G4PlotterManager & GetInstance()
void AddRegionH2(unsigned int region, int id)
void AddRegionStyle(unsigned int region, const G4String &style)
void AddRegionH1(unsigned int region, int id)
void AddStyle(const G4String &style)
void ClearRegion(unsigned int region)
void SetLayout(unsigned int colums, unsigned int rows)
void AddRegionParameter(unsigned int region, const G4String ¶meter, const G4String &value)
std::size_t GetParameterEntries() const
static G4int ConvertToInt(const char *st)
void SetDefaultValue(const char *theDefaultValue)