Geant4
10.03.p01
Main Page
Related Pages
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Pages
G4Colour.hh
Go to the documentation of this file.
1
//
2
// ********************************************************************
3
// * License and Disclaimer *
4
// * *
5
// * The Geant4 software is copyright of the Copyright Holders of *
6
// * the Geant4 Collaboration. It is provided under the terms and *
7
// * conditions of the Geant4 Software License, included in the file *
8
// * LICENSE and available at http://cern.ch/geant4/license . These *
9
// * include a list of copyright holders. *
10
// * *
11
// * Neither the authors of this software system, nor their employing *
12
// * institutes,nor the agencies providing financial support for this *
13
// * work make any representation or warranty, express or implied, *
14
// * regarding this software system or assume any liability for its *
15
// * use. Please see the license in the file LICENSE and URL above *
16
// * for the full disclaimer and the limitation of liability. *
17
// * *
18
// * This code implementation is the result of the scientific and *
19
// * technical work of the GEANT4 collaboration. *
20
// * By using, copying, modifying or distributing the software (or *
21
// * any work based on the software) you agree to acknowledge its *
22
// * use in resulting scientific publications, and indicate your *
23
// * acceptance of all terms of the Geant4 Software license. *
24
// ********************************************************************
25
//
26
//
27
// $Id: G4Colour.hh 78955 2014-02-05 09:45:46Z gcosmo $
28
//
29
//
30
// John Allison 20th October 1996
31
32
// Class Description:
33
// Class G4Colour has 4 fields, which represent the RGBA (red, green, blue,
34
// and alpha) components of colour. Each component takes a value between
35
// 0 and 1. If an irrelevant value, i.e., a value less than 0 or greater
36
// than 1, is given as an argument of the constructor, such a value is
37
// automatically clipped to 0 or 1. Alpha is opacity (1 = opaque).
38
//
39
// A G4Colour object is instantiated by giving red, green, and blue
40
// components to its constructor, i.e.,
41
//
42
// G4Colour::G4Colour ( G4double r = 1.0,
43
// G4double g = 1.0,
44
// G4double b = 1.0,
45
// G4double a = 1.0);
46
// // 0<=red, green, blue <= 1.0
47
//
48
// The default value of each component is 1.0. That is to say, the default
49
// colour is "white". For example, colours which are often used can be
50
// instantiated as follows:
51
//
52
// G4Colour white () ; // white
53
// G4Colour white (1.0, 1.0, 1.0) ; // white
54
// G4Colour gray (0.5, 0.5, 0.5) ; // gray
55
// G4Colour black (0.0, 0.0, 0.0) ; // black
56
// G4Colour brown (0.45,0.25,0.0) ; // G4 logo brown
57
// G4Colour red (1.0, 0.0, 0.0) ; // red
58
// G4Colour green (0.0, 1.0, 0.0) ; // green
59
// G4Colour blue (0.0, 0.0, 1.0) ; // blue
60
// G4Colour cyan (0.0, 1.0, 1.0) ; // cyan
61
// G4Colour magenta (1.0, 0.0, 1.0) ; // magenta
62
// G4Colour yellow (1.0, 1.0, 0.0) ; // yellow
63
//
64
// For convenience, static member functions are also defined for the above colours.
65
//
66
// After instantiation of a G4Colour object, you can access to its components
67
// with the following access functions:
68
//
69
// G4double G4Colour::GetRed () const ; // Get the red component.
70
// G4double G4Colour::GetGreen () const ; // Get the green component.
71
// G4double G4Colour::GetBlue () const ; // Get the blue component.
72
//
73
// Class Description - End:
74
75
#ifndef G4COLOUR_HH
76
#define G4COLOUR_HH
77
78
#include "
globals.hh
"
79
#include "
G4ThreeVector.hh
"
80
#include <iostream>
81
#include <map>
82
83
class
G4Colour
{
84
85
friend
std::ostream&
operator <<
(std::ostream&,
const
G4Colour
&);
86
87
public
:
// With description
88
89
G4Colour
(
G4double
r = 1.,
G4double
g
= 1.,
G4double
b = 1.,
90
G4double
a = 1.);
91
92
G4Colour
(
G4ThreeVector
);
93
// Converts the components of the 3-vector into red, green, blue.
94
// The opacity, alpha = 1.
95
96
operator
G4ThreeVector
();
97
// Converts red, green, blue into the components of a 3-vector.
98
99
G4bool
operator !=
(
const
G4Colour
& c)
const
;
100
G4bool
operator ==
(
const
G4Colour
& c)
const
{
return
!(
operator !=
(c));}
101
G4Colour
&
operator +=
(
const
G4Colour
&) {
return
*
this
;}
// Dummy
102
G4double
GetRed
()
const
;
103
G4double
GetGreen
()
const
;
104
G4double
GetBlue
()
const
;
105
G4double
GetAlpha
()
const
;
// alpha = opacity = 1. - transparency.
106
107
static
G4Colour
White
();
108
static
G4Colour
Gray
();
109
static
G4Colour
Grey
();
110
static
G4Colour
Black
();
111
static
G4Colour
Brown
();
// G4 logo brown
112
static
G4Colour
Red
();
113
static
G4Colour
Green
();
114
static
G4Colour
Blue
();
115
static
G4Colour
Cyan
();
116
static
G4Colour
Magenta
();
117
static
G4Colour
Yellow
();
118
119
static
void
AddToMap
(
const
G4String
& key,
const
G4Colour
& colour);
120
// Add user defined colour to colour map with given key. Standard
121
// colours are added to map by default.
122
123
static
G4bool
GetColour
(
const
G4String
& key,
G4Colour
&
result
);
124
// Get colour for given key. Returns false if key doesn't exist
125
// in colour map, leaving result unchanged. Colour map
126
// is not sensitive to key case.
127
128
static
const
std::map<G4String, G4Colour>&
GetMap
();
129
130
private
:
131
G4double
red, green, blue, alpha;
132
133
static
G4ThreadLocal
std::map<G4String, G4Colour> *fColourMap;
134
static
G4ThreadLocal
G4bool
fInitColourMap;
135
static
void
InitialiseColourMap();
136
137
};
138
139
inline
G4double
G4Colour::GetRed
()
const
{
return
red;}
140
inline
G4double
G4Colour::GetGreen
()
const
{
return
green;}
141
inline
G4double
G4Colour::GetBlue
()
const
{
return
blue;}
142
inline
G4double
G4Colour::GetAlpha
()
const
{
return
alpha;}
143
inline
G4Colour
G4Colour::White
() {
return
G4Colour
(1.0, 1.0, 1.0);}
144
inline
G4Colour
G4Colour::Gray
() {
return
G4Colour
(0.5, 0.5, 0.5);}
145
inline
G4Colour
G4Colour::Grey
() {
return
G4Colour
(0.5, 0.5, 0.5);}
146
inline
G4Colour
G4Colour::Black
() {
return
G4Colour
(0.0, 0.0, 0.0);}
147
inline
G4Colour
G4Colour::Brown
() {
return
G4Colour
(0.45,0.25,0.0);}
148
inline
G4Colour
G4Colour::Red
() {
return
G4Colour
(1.0, 0.0, 0.0);}
149
inline
G4Colour
G4Colour::Green
() {
return
G4Colour
(0.0, 1.0, 0.0);}
150
inline
G4Colour
G4Colour::Blue
() {
return
G4Colour
(0.0, 0.0, 1.0);}
151
inline
G4Colour
G4Colour::Cyan
() {
return
G4Colour
(0.0, 1.0, 1.0);}
152
inline
G4Colour
G4Colour::Magenta
() {
return
G4Colour
(1.0, 0.0, 1.0);}
153
inline
G4Colour
G4Colour::Yellow
() {
return
G4Colour
(1.0, 1.0, 0.0);}
154
155
#endif
result
G4double G4ParticleHPJENDLHEData::G4double result
Definition:
G4ParticleHPJENDLHEData.cc:257
G4Colour::Gray
static G4Colour Gray()
Definition:
G4Colour.hh:144
CLHEP::Hep3Vector
Definition:
ThreeVector.h:41
G4Colour::operator+=
G4Colour & operator+=(const G4Colour &)
Definition:
G4Colour.hh:101
G4Colour::GetAlpha
G4double GetAlpha() const
Definition:
G4Colour.hh:142
G4ThreeVector
CLHEP::Hep3Vector G4ThreeVector
Definition:
G4ThreeVector.hh:42
G4Colour::Green
static G4Colour Green()
Definition:
G4Colour.hh:149
G4Colour::GetColour
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition:
G4Colour.cc:126
G4Colour::Magenta
static G4Colour Magenta()
Definition:
G4Colour.hh:152
G4Colour
Definition:
G4Colour.hh:83
G4Colour::GetBlue
G4double GetBlue() const
Definition:
G4Colour.hh:141
G4Colour::Brown
static G4Colour Brown()
Definition:
G4Colour.hh:147
g
static constexpr double g
Definition:
G4SIunits.hh:183
G4ThreadLocal
#define G4ThreadLocal
Definition:
tls.hh:89
G4Colour::G4Colour
G4Colour(G4double r=1., G4double g=1., G4double b=1., G4double a=1.)
Definition:
G4Colour.cc:34
G4Colour::Black
static G4Colour Black()
Definition:
G4Colour.hh:146
G4Colour::operator<<
friend std::ostream & operator<<(std::ostream &, const G4Colour &)
Definition:
G4Colour.cc:55
G4Colour::GetRed
G4double GetRed() const
Definition:
G4Colour.hh:139
G4Colour::Grey
static G4Colour Grey()
Definition:
G4Colour.hh:145
G4bool
bool G4bool
Definition:
G4Types.hh:79
G4Colour::GetGreen
G4double GetGreen() const
Definition:
G4Colour.hh:140
G4Colour::AddToMap
static void AddToMap(const G4String &key, const G4Colour &colour)
Definition:
G4Colour.cc:86
G4Colour::Blue
static G4Colour Blue()
Definition:
G4Colour.hh:150
globals.hh
G4Colour::Cyan
static G4Colour Cyan()
Definition:
G4Colour.hh:151
G4Colour::Red
static G4Colour Red()
Definition:
G4Colour.hh:148
G4Colour::operator==
G4bool operator==(const G4Colour &c) const
Definition:
G4Colour.hh:100
G4Colour::GetMap
static const std::map< G4String, G4Colour > & GetMap()
Definition:
G4Colour.cc:147
G4double
double G4double
Definition:
G4Types.hh:76
G4ThreeVector.hh
G4Colour::Yellow
static G4Colour Yellow()
Definition:
G4Colour.hh:153
G4Colour::operator!=
G4bool operator!=(const G4Colour &c) const
Definition:
G4Colour.cc:71
G4String
Definition:
G4String.hh:60
G4Colour::White
static G4Colour White()
Definition:
G4Colour.hh:143
geant4.10.03.p01
source
graphics_reps
include
G4Colour.hh
Generated on Thu Mar 16 2017 22:37:56 for Geant4 by
1.8.5