#include <G4ModelApplyCommandsT.hh>
Inheritance diagram for G4ModelCmdApplyStringColour< M >:
Public Member Functions | |
G4ModelCmdApplyStringColour (M *model, const G4String &placement, const G4String &cmdName) | |
virtual | ~G4ModelCmdApplyStringColour () |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Protected Member Functions | |
virtual void | Apply (const G4String &, const G4Colour &)=0 |
G4UIcommand * | StringCommand () |
G4UIcommand * | ComponentCommand () |
Definition at line 51 of file G4ModelApplyCommandsT.hh.
G4ModelCmdApplyStringColour< M >::G4ModelCmdApplyStringColour | ( | M * | model, | |
const G4String & | placement, | |||
const G4String & | cmdName | |||
) |
Definition at line 77 of file G4ModelApplyCommandsT.hh.
References G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().
00078 :G4VModelCommand<M>(model, placement) 00079 { 00080 //Set variable colour through a string 00081 G4String dir = placement+"/"+model->Name()+"/"+cmdName; 00082 G4UIparameter* param(0); 00083 00084 fpStringCmd = new G4UIcommand(dir, this); 00085 fpStringCmd->SetGuidance("Set variable colour through a string"); 00086 00087 param = new G4UIparameter("Variable", 's', false); 00088 fpStringCmd->SetParameter(param); 00089 00090 param = new G4UIparameter("Value", 's', false); 00091 fpStringCmd->SetParameter(param); 00092 00093 //Set variable colour through RGBA components 00094 G4String componentDir = dir+"RGBA"; 00095 00096 fpComponentCmd = new G4UIcommand(componentDir, this); 00097 fpComponentCmd->SetGuidance("Set variable colour through red, green, blue and alpha components"); 00098 param = new G4UIparameter("Variable", 's', false); 00099 fpComponentCmd->SetParameter(param); 00100 00101 param = new G4UIparameter("Red component", 'd', false); 00102 fpComponentCmd->SetParameter(param); 00103 00104 param = new G4UIparameter("Green component", 'd', false); 00105 fpComponentCmd->SetParameter(param); 00106 00107 param = new G4UIparameter("Blue component", 'd', false); 00108 fpComponentCmd->SetParameter(param); 00109 00110 param = new G4UIparameter("Alpha component", 'd', false); 00111 fpComponentCmd->SetParameter(param); 00112 }
G4ModelCmdApplyStringColour< M >::~G4ModelCmdApplyStringColour | ( | ) | [virtual] |
virtual void G4ModelCmdApplyStringColour< M >::Apply | ( | const G4String & | , | |
const G4Colour & | ||||
) | [protected, pure virtual] |
Implemented in G4ModelCmdSetStringColour< M >.
Referenced by G4ModelCmdApplyStringColour< M >::SetNewValue().
G4UIcommand* G4ModelCmdApplyStringColour< M >::ComponentCommand | ( | ) | [inline, protected] |
void G4ModelCmdApplyStringColour< M >::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 122 of file G4ModelApplyCommandsT.hh.
References G4InuclParticleNames::alpha, G4ModelCmdApplyStringColour< M >::Apply(), G4Exception(), G4Colour::GetColour(), G4VVisManager::GetConcreteInstance(), JustWarning, and G4VVisManager::NotifyHandlers().
00123 { 00124 G4Colour myColour; 00125 G4String parameter; 00126 00127 if (cmd == fpStringCmd) { 00128 G4String colour; 00129 std::istringstream is (newValue); 00130 is >> parameter >> colour; 00131 00132 // Colour key should exist 00133 if (!G4Colour::GetColour(colour, myColour)) { 00134 G4ExceptionDescription ed; 00135 ed << "G4Colour with key "<<colour<<" does not exist "; 00136 G4Exception 00137 ("G4ModelCmdApplyStringColour<M>::SetNewValue", 00138 "modeling0106", JustWarning, ed); 00139 return; 00140 } 00141 } 00142 00143 if (cmd == fpComponentCmd) { 00144 G4double red(0), green(0), blue(0), alpha(0); 00145 std::istringstream is (newValue); 00146 is >> parameter >> red >> green >> blue >> alpha; 00147 00148 G4Colour colour(red, green, blue, alpha); 00149 myColour = colour; 00150 } 00151 00152 Apply(parameter, myColour); 00153 G4VVisManager* visManager = G4VVisManager::GetConcreteInstance(); 00154 if (visManager) visManager->NotifyHandlers(); 00155 }
G4UIcommand* G4ModelCmdApplyStringColour< M >::StringCommand | ( | ) | [inline, protected] |