36red (r), green (gr), blue (b), alpha (a)
38 if( red > 1.0 ){red = 1.0;}
if( red < 0.0 ){red = 0.0;}
39 if( green > 1.0 ){green = 1.0;}
if( green < 0.0 ){green = 0.0;}
40 if( blue > 1.0 ){blue = 1.0;}
if( blue < 0.0 ){blue = 0.0;}
41 if( alpha > 1.0 ){alpha = 1.0;}
if( alpha < 0.0 ){alpha = 0.0;}
45red (v.x()), green (v.y()), blue (v.z()), alpha (1.)
47 if( red > 1.0 ){red = 1.0;}
if( red < 0.0 ){red = 0.0;}
48 if( green > 1.0 ){green = 1.0;}
if( green < 0.0 ){green = 0.0;}
49 if( blue > 1.0 ){blue = 1.0;}
if( blue < 0.0 ){blue = 0.0;}
55 if( red > 1.0 ){red = 1.0;}
if( red < 0.0 ){red = 0.0;}
61 if( green > 1.0 ){green = 1.0;}
if( green < 0.0 ){green = 0.0;}
67 if( blue > 1.0 ){blue = 1.0;}
if( blue < 0.0 ){blue = 0.0;}
73 if( alpha > 1.0 ){alpha = 1.0;}
if( alpha < 0.0 ){alpha = 0.0;}
81 os <<
'(' << c.red <<
',' << c.green <<
',' << c.blue
82 <<
',' << c.alpha <<
')';
85 std::map<G4String, G4Colour>::const_reverse_iterator ri;
86 for (ri = colourMap.rbegin(); ri != colourMap.rend(); ++ri) {
87 if (c == ri->second) {
88 os <<
" (" << ri->first <<
')';
97 return (red != c.red) ||
103std::map<G4String, G4Colour> G4Colour::fColourMap;
104G4bool G4Colour::fInitColourMap =
false;
110 static G4bool first =
true;
114 (
"G4Colour::AddToMap(const G4String& key, const G4Colour& colour)",
116 "Attempt to add to colour map from non-master thread.");
124 if (fColourMap.find(myKey) == fColourMap.end()) fColourMap[myKey] = colour;
127 ed <<
"G4Colour with key " << myKey <<
" already exists." <<
G4endl;
129 (
"G4Colour::AddToMap(const G4String& key, const G4Colour& colour)",
131 "Colour key exists");
137 if (fInitColourMap)
return;
139 fInitColourMap =
true;
163 std::map<G4String, G4Colour>::const_iterator iter = fColourMap.find(myKey);
166 if (iter == fColourMap.cend())
return false;
168 result = iter->second;
183 if (red < rhs.red)
return true;
184 if (red == rhs.red) {
185 if (green < rhs.green)
return true;
186 if (green == rhs.green) {
187 if (blue < rhs.blue)
return true;
188 if (blue == rhs.blue) {
189 if (alpha < rhs.alpha)
return true;
std::ostream & operator<<(std::ostream &os, const G4Colour &c)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
CLHEP::Hep3Vector G4ThreeVector
static G4bool GetColour(const G4String &key, G4Colour &result)
static void AddToMap(const G4String &key, const G4Colour &colour)
static void InitialiseColourMap()
static const std::map< G4String, G4Colour > & GetMap()
G4bool operator!=(const G4Colour &c) const
static G4Colour Magenta()
G4Colour(G4double r_=1., G4double g_=1., G4double b_=1., G4double a_=1.)
G4bool operator<(const G4Colour &rhs) const
G4String to_lower_copy(G4String str)
Return lowercased copy of string.