#include <G4ModelApplyCommandsT.hh>
Inheritance diagram for G4ModelCmdApplyColour< M >:
Public Member Functions | |
G4ModelCmdApplyColour (M *model, const G4String &placement, const G4String &cmdName) | |
virtual | ~G4ModelCmdApplyColour () |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Protected Member Functions | |
virtual void | Apply (const G4Colour &)=0 |
G4UIcommand * | StringCommand () |
G4UIcommand * | ComponentCommand () |
Definition at line 160 of file G4ModelApplyCommandsT.hh.
G4ModelCmdApplyColour< M >::G4ModelCmdApplyColour | ( | M * | model, | |
const G4String & | placement, | |||
const G4String & | cmdName | |||
) |
Definition at line 186 of file G4ModelApplyCommandsT.hh.
References G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().
00187 :G4VModelCommand<M>(model, placement) 00188 { 00189 //Set colour through a string 00190 G4String dir = placement+"/"+model->Name()+"/"+cmdName; 00191 G4UIparameter* param(0); 00192 00193 fpStringCmd = new G4UIcommand(dir, this); 00194 fpStringCmd->SetGuidance("Set colour through a string"); 00195 00196 param = new G4UIparameter("Variable", 's', false); 00197 fpStringCmd->SetParameter(param); 00198 00199 //Set colour through RGBA components 00200 G4String componentDir = dir+"RGBA"; 00201 00202 fpComponentCmd = new G4UIcommand(componentDir, this); 00203 fpComponentCmd->SetGuidance("Set colour through red, green, blue and alpha components"); 00204 fpComponentCmd->SetGuidance("Four inputs are expected."); 00205 00206 param = new G4UIparameter("Red component", 'd', false); 00207 fpComponentCmd->SetParameter(param); 00208 00209 param = new G4UIparameter("Green component", 'd', false); 00210 fpComponentCmd->SetParameter(param); 00211 00212 param = new G4UIparameter("Blue component", 'd', false); 00213 fpComponentCmd->SetParameter(param); 00214 00215 param = new G4UIparameter("Alpha component", 'd', false); 00216 fpComponentCmd->SetParameter(param); 00217 }
G4ModelCmdApplyColour< M >::~G4ModelCmdApplyColour | ( | ) | [virtual] |
virtual void G4ModelCmdApplyColour< M >::Apply | ( | const G4Colour & | ) | [protected, pure virtual] |
Implemented in G4ModelCmdSetDefaultColour< M >, G4ModelCmdSetAuxPtsColour< M >, G4ModelCmdSetStepPtsColour< M >, and G4ModelCmdSetLineColour< M >.
Referenced by G4ModelCmdApplyColour< M >::SetNewValue().
G4UIcommand* G4ModelCmdApplyColour< M >::ComponentCommand | ( | ) | [inline, protected] |
void G4ModelCmdApplyColour< M >::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 227 of file G4ModelApplyCommandsT.hh.
References G4InuclParticleNames::alpha, G4ModelCmdApplyColour< M >::Apply(), G4Exception(), G4Colour::GetColour(), G4VVisManager::GetConcreteInstance(), JustWarning, and G4VVisManager::NotifyHandlers().
00228 { 00229 G4Colour myColour; 00230 00231 if (cmd == fpStringCmd) { 00232 G4String colour; 00233 std::istringstream is (newValue); 00234 is >> colour; 00235 00236 // Colour key should exist 00237 if (!G4Colour::GetColour(colour, myColour)) { 00238 G4ExceptionDescription ed; 00239 ed << "G4Colour with key "<<colour<<" does not exist "; 00240 G4Exception 00241 ("G4ModelCmdApplyColour<M>::SetNewValue", 00242 "modeling0107", JustWarning, ed); 00243 return; 00244 } 00245 } 00246 00247 if (cmd == fpComponentCmd) { 00248 G4double red(0), green(0), blue(0), alpha(0); 00249 std::istringstream is (newValue); 00250 is >> red >> green >> blue >> alpha; 00251 00252 G4Colour colour(red, green, blue, alpha); 00253 myColour = colour; 00254 } 00255 00256 Apply(myColour); 00257 G4VVisManager* visManager = G4VVisManager::GetConcreteInstance(); 00258 if (visManager) visManager->NotifyHandlers(); 00259 }
G4UIcommand* G4ModelCmdApplyColour< M >::StringCommand | ( | ) | [inline, protected] |