#include <G4VisCommandsGeometrySet.hh>
Inheritance diagram for G4VisCommandGeometrySetColour:
Public Member Functions | |
G4VisCommandGeometrySetColour () | |
virtual | ~G4VisCommandGeometrySetColour () |
G4String | GetCurrentValue (G4UIcommand *command) |
void | SetNewValue (G4UIcommand *command, G4String newValue) |
Definition at line 179 of file G4VisCommandsGeometrySet.hh.
G4VisCommandGeometrySetColour::G4VisCommandGeometrySetColour | ( | ) |
Definition at line 101 of file G4VisCommandsGeometrySet.cc.
References G4UIparameter::SetDefaultValue(), G4UIparameter::SetGuidance(), G4UIcommand::SetGuidance(), and G4UIcommand::SetParameter().
00102 { 00103 G4bool omitable; 00104 fpCommand = new G4UIcommand("/vis/geometry/set/colour", this); 00105 fpCommand->SetGuidance("Sets colour of logical volume(s)."); 00106 fpCommand->SetGuidance("\"all\" sets all logical volumes."); 00107 fpCommand->SetGuidance 00108 ("Optionally propagates down hierarchy to given depth."); 00109 G4UIparameter* parameter; 00110 parameter = new G4UIparameter ("logical-volume-name", 's', omitable = true); 00111 parameter->SetDefaultValue("all"); 00112 fpCommand->SetParameter(parameter); 00113 parameter = new G4UIparameter("depth", 'd', omitable = true); 00114 parameter->SetDefaultValue(0); 00115 parameter->SetGuidance 00116 ("Depth of propagation (-1 means unlimited depth)."); 00117 fpCommand->SetParameter(parameter); 00118 parameter = new G4UIparameter("red", 's', omitable = true); 00119 parameter->SetDefaultValue("1."); 00120 parameter->SetGuidance 00121 ("Red component or a string, e.g., \"blue\", in which case succeeding colour components are ignored."); 00122 fpCommand->SetParameter(parameter); 00123 parameter = new G4UIparameter("green", 'd', omitable = true); 00124 parameter->SetDefaultValue(1.); 00125 fpCommand->SetParameter(parameter); 00126 parameter = new G4UIparameter("blue", 'd', omitable = true); 00127 parameter->SetDefaultValue(1.); 00128 fpCommand->SetParameter(parameter); 00129 parameter = new G4UIparameter("opacity", 'd', omitable = true); 00130 parameter->SetDefaultValue(1.); 00131 fpCommand->SetParameter(parameter); 00132 }
G4VisCommandGeometrySetColour::~G4VisCommandGeometrySetColour | ( | ) | [virtual] |
G4String G4VisCommandGeometrySetColour::GetCurrentValue | ( | G4UIcommand * | command | ) | [virtual] |
void G4VisCommandGeometrySetColour::SetNewValue | ( | G4UIcommand * | command, | |
G4String | newValue | |||
) | [virtual] |
Reimplemented from G4UImessenger.
Definition at line 145 of file G4VisCommandsGeometrySet.cc.
References G4UIcommand::ConvertToDouble(), G4cout, G4endl, G4Colour::GetBlue(), G4Colour::GetColour(), G4Colour::GetGreen(), G4Colour::GetRed(), and G4VisManager::warnings.
00146 { 00147 G4String name, redOrString; 00148 G4int requestedDepth; 00149 G4double green, blue, opacity; 00150 std::istringstream iss(newValue); 00151 iss >> name >> requestedDepth >> redOrString >> green >> blue >> opacity; 00152 G4Colour colour(1,1,1,1); // Default white and opaque. 00153 const size_t iPos0 = 0; 00154 if (std::isalpha(redOrString[iPos0])) { 00155 if (!G4Colour::GetColour(redOrString, colour)) { 00156 if (fpVisManager->GetVerbosity() >= G4VisManager::warnings) { 00157 G4cout << "WARNING: Colour \"" << redOrString 00158 << "\" not found. Defaulting to white and opaque." 00159 << G4endl; 00160 } 00161 } 00162 } else { 00163 colour = G4Colour(G4UIcommand::ConvertToDouble(redOrString), green, blue); 00164 } 00165 colour = G4Colour 00166 (colour.GetRed(), colour.GetGreen(), colour.GetBlue(), opacity); 00167 00168 G4VisCommandGeometrySetColourFunction setColour(colour); 00169 Set(name, setColour, requestedDepth); 00170 }