33#include <tools/tokenize>
42G4VisCommandPlotterCreate::G4VisCommandPlotterCreate () {
43 fpCommand =
new G4UIcommand(
"/vis/plotter/create",
this);
44 fpCommand->SetGuidance(
"Create a named G4Plotter.");
48 fpCommand->SetParameter (parameter);
51G4VisCommandPlotterCreate::~G4VisCommandPlotterCreate () {
delete fpCommand;}
57 G4Scene* pScene = fpVisManager->GetCurrentScene();
58 if(pScene) CheckSceneAndNotifyHandlers (pScene);
64G4VisCommandPlotterSetLayout::G4VisCommandPlotterSetLayout () {
65 fpCommand =
new G4UIcommand(
"/vis/plotter/setLayout",
this);
66 fpCommand->SetGuidance(
"Set plotter grid layout.");
70 fpCommand->SetParameter (parameter);
74 fpCommand->SetParameter (parameter);
78 fpCommand->SetParameter (parameter);
81G4VisCommandPlotterSetLayout::~G4VisCommandPlotterSetLayout () {
delete fpCommand;}
87 std::istringstream is(newValue);
88 is >> plotter >> cols >> rows;
93 G4Scene* pScene = fpVisManager->GetCurrentScene();
94 if(pScene) CheckSceneAndNotifyHandlers (pScene);
100G4VisCommandPlotterAddStyle::G4VisCommandPlotterAddStyle () {
101 fpCommand =
new G4UIcommand(
"/vis/plotter/addStyle",
this);
102 fpCommand->SetGuidance(
"Add a style for a plotter.");
103 fpCommand->SetGuidance(
"It is applied on all regions/plots of the plotter.");
104 fpCommand->SetGuidance(
"default, ROOT_default, hippodraw are known embedded styles.");
105 fpCommand->SetGuidance(
"reset is a keyword used to reset regions style.");
109 fpCommand->SetParameter (parameter);
113 fpCommand->SetParameter (parameter);
116G4VisCommandPlotterAddStyle::~G4VisCommandPlotterAddStyle () {
delete fpCommand;}
122 std::istringstream is(newValue);
123 is >> plotter >> style;
128 G4Scene* pScene = fpVisManager->GetCurrentScene();
129 if(pScene) CheckSceneAndNotifyHandlers (pScene);
135G4VisCommandPlotterAddRegionStyle::G4VisCommandPlotterAddRegionStyle () {
136 fpCommand =
new G4UIcommand(
"/vis/plotter/addRegionStyle",
this);
137 fpCommand->SetGuidance(
"Add a style to be applied on a region.");
138 fpCommand->SetGuidance(
"default, ROOT_default, hippodraw are known embedded styles.");
139 fpCommand->SetGuidance(
"reset is a keyword used to reset a region style.");
143 fpCommand->SetParameter (parameter);
147 fpCommand->SetParameter (parameter);
151 fpCommand->SetParameter (parameter);
154G4VisCommandPlotterAddRegionStyle::~G4VisCommandPlotterAddRegionStyle () {
delete fpCommand;}
163 std::istringstream is(newValue);
164 is >> plotter >> region >> style;
167 G4warn <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
175 G4Scene* pScene = fpVisManager->GetCurrentScene();
176 if(pScene) CheckSceneAndNotifyHandlers (pScene);
182G4VisCommandPlotterAddRegionParameter::G4VisCommandPlotterAddRegionParameter () {
183 fpCommand =
new G4UIcommand(
"/vis/plotter/addRegionParameter",
this);
184 fpCommand->SetGuidance(
"Add a parameter to be set on a region.");
188 fpCommand->SetParameter (parameter);
191 fpCommand->SetParameter (parameter);
194 fpCommand->SetParameter (parameter);
197 fpCommand->SetParameter (parameter);
200G4VisCommandPlotterAddRegionParameter::~G4VisCommandPlotterAddRegionParameter () {
delete fpCommand;}
202void G4VisCommandPlotterAddRegionParameter::SetNewValue (
G4UIcommand* command,
G4String newValue)
206 std::vector<std::string> args;
207 tools::double_quotes_tokenize(newValue, args);
215 std::string plotter = args[0];
217 std::string parameter = args[2];
218 std::string value = args[3];
221 G4warn <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
229 G4Scene* pScene = fpVisManager->GetCurrentScene();
230 if(pScene) CheckSceneAndNotifyHandlers (pScene);
236G4VisCommandPlotterClear::G4VisCommandPlotterClear () {
237 fpCommand =
new G4UIcommand(
"/vis/plotter/clear",
this);
238 fpCommand->SetGuidance(
"Remove plottables from all regions.");
242 fpCommand->SetParameter (parameter);
245G4VisCommandPlotterClear::~G4VisCommandPlotterClear () {
delete fpCommand;}
252 G4Scene* pScene = fpVisManager->GetCurrentScene();
253 if(pScene) CheckSceneAndNotifyHandlers (pScene);
259G4VisCommandPlotterClearRegion::G4VisCommandPlotterClearRegion () {
260 fpCommand =
new G4UIcommand(
"/vis/plotter/clearRegion",
this);
261 fpCommand->SetGuidance(
"Remove plottables a region.");
265 fpCommand->SetParameter (parameter);
269 fpCommand->SetParameter (parameter);
272G4VisCommandPlotterClearRegion::~G4VisCommandPlotterClearRegion () {
delete fpCommand;}
280 std::istringstream is(newValue);
281 is >> plotter >> region;
284 G4warn <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
292 G4Scene* pScene = fpVisManager->GetCurrentScene();
293 if(pScene) CheckSceneAndNotifyHandlers (pScene);
299G4VisCommandPlotterList::G4VisCommandPlotterList () {
300 fpCommand =
new G4UIcommand(
"/vis/plotter/list",
this);
301 fpCommand->SetGuidance(
"List plotters in the scene.");
304G4VisCommandPlotterList::~G4VisCommandPlotterList () {
delete fpCommand;}
314G4VisCommandPlotterAddRegionH1::G4VisCommandPlotterAddRegionH1 () {
315 fpCommand =
new G4UIcommand(
"/vis/plotter/add/h1",
this);
316 fpCommand->SetGuidance(
"Attach a 1D histogram to a plotter region.");
320 fpCommand->SetParameter (parameter);
323 fpCommand->SetParameter (parameter);
327 fpCommand->SetParameter (parameter);
330G4VisCommandPlotterAddRegionH1::~G4VisCommandPlotterAddRegionH1 () {
delete fpCommand;}
339 std::istringstream is(newValue);
340 is >> hid >> plotter >> region;
344 G4warn <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
352 G4Scene* pScene = fpVisManager->GetCurrentScene();
353 if(pScene) CheckSceneAndNotifyHandlers (pScene);
359G4VisCommandPlotterAddRegionH2::G4VisCommandPlotterAddRegionH2 () {
360 fpCommand =
new G4UIcommand(
"/vis/plotter/add/h2",
this);
361 fpCommand->SetGuidance(
"Attach a 2D histogram to a plotter region.");
365 fpCommand->SetParameter (parameter);
368 fpCommand->SetParameter (parameter);
372 fpCommand->SetParameter (parameter);
375G4VisCommandPlotterAddRegionH2::~G4VisCommandPlotterAddRegionH2 () {
delete fpCommand;}
384 std::istringstream is(newValue);
385 is >> hid >> plotter >> region;
389 G4warn <<
"ERROR: bad region index " << region <<
"." <<
G4endl;
397 G4Scene* pScene = fpVisManager->GetCurrentScene();
398 if(pScene) CheckSceneAndNotifyHandlers (pScene);
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)