BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
BDSColours.hh
1/*
2Beam Delivery Simulation (BDSIM) Copyright (C) Royal Holloway,
3University of London 2001 - 2022.
4
5This file is part of BDSIM.
6
7BDSIM is free software: you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published
9by the Free Software Foundation version 3 of the License.
10
11BDSIM is distributed in the hope that it will be useful, but
12WITHOUT ANY WARRANTY; without even the implied warranty of
13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14GNU General Public License for more details.
15
16You should have received a copy of the GNU General Public License
17along with BDSIM. If not, see <http://www.gnu.org/licenses/>.
18*/
19#ifndef BDSCOLOURS_H
20#define BDSCOLOURS_H
21
22#include "globals.hh" // geant4 types / globals
23
24#include <map>
25
26class G4Colour;
27
33{
34public:
35 static BDSColours* Instance();
36
38
40 G4Colour* GetColour(const G4String& type,
41 G4bool normaliseTo255 = true);
42
44 void DefineColour(const G4String& name,
45 G4double red,
46 G4double green,
47 G4double blue,
48 G4double alpha = 1,
49 G4bool normaliseTo255 = true);
50
53 void Print();
54
55private:
56 BDSColours();
57 static BDSColours* instance;
58
61 std::map<G4int, G4String> magnetName;
62
64 std::map<G4String, G4Colour*> colours;
65};
66
67#endif
Colour class that holds all colours used in BDSIM.
Definition: BDSColours.hh:33
static BDSColours * Instance()
singleton pattern
Definition: BDSColours.cc:33
G4Colour * GetColour(const G4String &type, G4bool normaliseTo255=true)
Get colour from name.
Definition: BDSColours.cc:202
void DefineColour(const G4String &name, G4double red, G4double green, G4double blue, G4double alpha=1, G4bool normaliseTo255=true)
Define a new colour.
Definition: BDSColours.cc:152
BDSColours()
Private constructor as singleton.
Definition: BDSColours.cc:45
void Print()
Definition: BDSColours.cc:179
std::map< G4int, G4String > magnetName
Definition: BDSColours.hh:61
std::map< G4String, G4Colour * > colours
A map of the colour for each type or component by name.
Definition: BDSColours.hh:64