Warning, file /include/Geant4/G4PlotterManager.hh was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029 #ifndef G4PLOTTERMANAGER_HH
0030 #define G4PLOTTERMANAGER_HH
0031
0032 #include "G4Plotter.hh"
0033 #include "G4UImessenger.hh"
0034
0035 #include <vector>
0036 #include <utility>
0037
0038 class G4PlotterManager {
0039 public:
0040 static G4PlotterManager& GetInstance ();
0041 G4Plotter& GetPlotter(const G4String& a_name);
0042 void List() const;
0043
0044 using StyleItem = std::pair<G4String,G4String>;
0045 using Style = std::vector<StyleItem>;
0046 using NamedStyle = std::pair<G4String,Style>;
0047 using Styles = std::vector<NamedStyle>;
0048 const Styles& GetStyles() const {return fStyles;}
0049 Styles& GetStyles() {return fStyles;}
0050
0051 private:
0052 G4PlotterManager();
0053 virtual ~G4PlotterManager();
0054 G4PlotterManager (const G4PlotterManager&);
0055 G4PlotterManager& operator = (const G4PlotterManager&);
0056
0057 void ListStyles() const;
0058 Style* FindStyle(const G4String& name);
0059 void SelectStyle(const G4String& style);
0060 void RemoveStyle(const G4String& name);
0061 void PrintStyle(const G4String&) const;
0062 void AddStyleParameter(const G4String& param,const G4String& value);
0063
0064 typedef std::pair<G4String,G4Plotter> NamedPlotter;
0065 std::vector<NamedPlotter> fPlotters;
0066
0067 G4String fCurrentStyle;
0068 Styles fStyles;
0069
0070 class Messenger: public G4UImessenger {
0071 public:
0072 Messenger(G4PlotterManager& aPlotterManager):fPlotterManager(aPlotterManager) {
0073 G4UIparameter* parameter;
0074
0075
0076
0077 remove_style = new G4UIcommand("/vis/plotter/style/remove",this);
0078 remove_style->SetGuidance("Remove a named style.");
0079
0080 parameter = new G4UIparameter("name",'s',false);
0081 remove_style->SetParameter(parameter);
0082
0083
0084
0085 select_style = new G4UIcommand("/vis/plotter/style/select",this);
0086 select_style->SetGuidance("Select a named style for further style/add commands.");
0087 select_style->SetGuidance("If not existing, the named style is created.");
0088
0089 parameter = new G4UIparameter("name",'s',false);
0090 select_style->SetParameter(parameter);
0091
0092
0093
0094 add_style_parameter = new G4UIcommand("/vis/plotter/style/add",this);
0095 add_style_parameter->SetGuidance("Add a (parameter,value) to the current named style.");
0096
0097 parameter = new G4UIparameter("parameter",'s',false);
0098 add_style_parameter->SetParameter (parameter);
0099
0100 parameter = new G4UIparameter("value",'s',false);
0101 add_style_parameter->SetParameter (parameter);
0102
0103
0104
0105 list_styles = new G4UIcommand("/vis/plotter/style/list", this);
0106 list_styles->SetGuidance("List known not embedded styles.");
0107
0108
0109
0110 print_style = new G4UIcommand("/vis/plotter/style/print", this);
0111 print_style->SetGuidance("Print a style.");
0112
0113 parameter = new G4UIparameter("style",'s',false);
0114 print_style->SetParameter (parameter);
0115 }
0116 virtual ~Messenger() {
0117 delete remove_style;
0118 delete select_style;
0119 delete add_style_parameter;
0120 delete list_styles;
0121 delete print_style;
0122 }
0123 virtual void SetNewValue(G4UIcommand*,G4String);
0124 private:
0125 G4PlotterManager& fPlotterManager;
0126 G4UIcommand* remove_style;
0127 G4UIcommand* select_style;
0128 G4UIcommand* add_style_parameter;
0129 G4UIcommand* list_styles;
0130 G4UIcommand* print_style;
0131 };
0132
0133 Messenger* fMessenger;
0134 };
0135
0136 #endif