#include <G4VisCommandsSet.hh>
Inheritance diagram for G4VisCommandSetTextColour:
Public Member Functions | |
G4VisCommandSetTextColour () | |
virtual | ~G4VisCommandSetTextColour () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 54 of file G4VisCommandsSet.hh.
G4VisCommandSetTextColour::G4VisCommandSetTextColour | ( | ) |
Definition at line 154 of file G4VisCommandsSet.cc.
References G4UIparameter::SetDefaultValue(), G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().
00155 { 00156 G4bool omitable; 00157 fpCommand = new G4UIcommand("/vis/set/textColour", this); 00158 fpCommand->SetGuidance 00159 ("Defines colour and opacity for future \"/vis/scene/add/text\" commands."); 00160 fpCommand->SetGuidance("Default: blue and opaque."); 00161 G4UIparameter* parameter; 00162 parameter = new G4UIparameter ("red", 's', omitable = true); 00163 parameter->SetGuidance 00164 ("Red component or a string, e.g., \"cyan\" (green and blue parameters are ignored)."); 00165 parameter->SetDefaultValue ("0."); 00166 fpCommand->SetParameter (parameter); 00167 parameter = new G4UIparameter ("green", 'd', omitable = true); 00168 parameter->SetDefaultValue (0.); 00169 fpCommand->SetParameter (parameter); 00170 parameter = new G4UIparameter ("blue", 'd', omitable = true); 00171 parameter->SetDefaultValue (1.); 00172 fpCommand->SetParameter (parameter); 00173 parameter = new G4UIparameter ("alpha", 'd', omitable = true); 00174 parameter->SetDefaultValue (1.); 00175 parameter->SetGuidance ("Opacity"); 00176 fpCommand->SetParameter (parameter); 00177 }
G4VisCommandSetTextColour::~G4VisCommandSetTextColour | ( | ) | [virtual] |
G4String G4VisCommandSetTextColour::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 184 of file G4VisCommandsSet.cc.
00185 { 00186 return G4String(); 00187 }
void G4VisCommandSetTextColour::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 189 of file G4VisCommandsSet.cc.
References G4VisManager::confirmations, G4UIcommand::ConvertToDouble(), G4VVisCommand::fCurrentTextColour, G4VVisCommand::fpVisManager, G4cout, G4endl, G4Colour::GetBlue(), G4Colour::GetColour(), G4Colour::GetGreen(), G4Colour::GetRed(), G4VisManager::GetVerbosity(), and G4VisManager::warnings.
00190 { 00191 G4VisManager::Verbosity verbosity = fpVisManager->GetVerbosity(); 00192 00193 G4String redOrString; 00194 G4double green, blue, opacity; 00195 std::istringstream iss(newValue); 00196 iss >> redOrString >> green >> blue >> opacity; 00197 00198 G4Colour colour(0,0,1,1); // Default blue and opaque. 00199 if (std::isalpha(redOrString(0))) { 00200 if (!G4Colour::GetColour(redOrString, colour)) { 00201 if (verbosity >= G4VisManager::warnings) { 00202 G4cout << "WARNING: Text colour \"" << redOrString 00203 << "\" not found. Defaulting to blue and opaque." 00204 << G4endl; 00205 } 00206 } 00207 } else { 00208 colour = G4Colour 00209 (G4UIcommand::ConvertToDouble(redOrString), green, blue); 00210 } 00211 // Add opacity 00212 fCurrentTextColour = G4Colour 00213 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity); 00214 00215 if (verbosity >= G4VisManager::confirmations) { 00216 G4cout << 00217 "Colour for future \"/vis/scene/add/text\" commands has been set to " 00218 << fCurrentTextColour << '.' 00219 << G4endl; 00220 } 00221 }