BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes
BDSColours Class Reference

Colour class that holds all colours used in BDSIM. More...

#include <BDSColours.hh>

Collaboration diagram for BDSColours:
Collaboration graph

Public Types

typedef std::tuple< G4double, G4double, G4double, G4double > BDSColourKey
 

Public Member Functions

G4Colour * GetColour (G4double red, G4double green, G4double blue, G4double alpha=1)
 Get a cached anonymous colour by values.
 
G4Colour * GetColour (const G4String &type, G4bool normaliseTo255=true)
 Get colour from name.
 
void DefineColour (const G4String &name, G4double red, G4double green, G4double blue, G4double alpha=1, G4bool normaliseTo255=true)
 Define a new colour.
 
void Print ()
 

Static Public Member Functions

static BDSColoursInstance ()
 singleton pattern
 

Private Member Functions

 BDSColours ()
 Private constructor as singleton.
 

Private Attributes

std::map< G4int, G4String > magnetName
 
std::map< G4String, G4Colour * > colours
 A map of the colour for each type or component by name.
 
std::map< BDSColourKey, G4Colour * > anonymousColours
 

Static Private Attributes

static BDSColoursinstance = nullptr
 

Detailed Description

Colour class that holds all colours used in BDSIM.

Definition at line 33 of file BDSColours.hh.

Member Typedef Documentation

◆ BDSColourKey

typedef std::tuple<G4double, G4double, G4double, G4double> BDSColours::BDSColourKey

Definition at line 36 of file BDSColours.hh.

Constructor & Destructor Documentation

◆ ~BDSColours()

BDSColours::~BDSColours ( )

Definition at line 40 of file BDSColours.cc.

◆ BDSColours()

BDSColours::BDSColours ( )
private

Private constructor as singleton.

Definition at line 45 of file BDSColours.cc.

References colours, magnetName, and Print().

Referenced by Instance().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Function Documentation

◆ DefineColour()

void BDSColours::DefineColour ( const G4String &  name,
G4double  red,
G4double  green,
G4double  blue,
G4double  alpha = 1,
G4bool  normaliseTo255 = true 
)

Define a new colour.

Definition at line 160 of file BDSColours.cc.

References colours, BDS::EnsureInLimits(), and Print().

Referenced by GetColour(), and BDSComponentFactory::PrepareColours().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetColour() [1/2]

G4Colour * BDSColours::GetColour ( const G4String &  type,
G4bool  normaliseTo255 = true 
)

Get colour from name.

Definition at line 231 of file BDSColours.cc.

References colours, DefineColour(), and BDS::StrContains().

Here is the call graph for this function:

◆ GetColour() [2/2]

G4Colour * BDSColours::GetColour ( G4double  red,
G4double  green,
G4double  blue,
G4double  alpha = 1 
)

◆ Instance()

BDSColours * BDSColours::Instance ( )
static

◆ Print()

void BDSColours::Print ( )

Print out a full list of colours using Sphinx rst table syntax. Looks nice and easy to regenerate table for the manual.

Definition at line 187 of file BDSColours.cc.

References colours.

Referenced by BDSColours(), DefineColour(), and BDSExecOptions::Parse().

Here is the caller graph for this function:

Field Documentation

◆ anonymousColours

std::map<BDSColourKey, G4Colour*> BDSColours::anonymousColours
private

A map of colours with no name. Can only be retrieved by a tuple of their values - an optimisation for repeated loading of the same colours in GDML that we don't care about naming.

Definition at line 78 of file BDSColours.hh.

Referenced by GetColour().

◆ colours

std::map<G4String, G4Colour*> BDSColours::colours
private

A map of the colour for each type or component by name.

Definition at line 73 of file BDSColours.hh.

Referenced by BDSColours(), DefineColour(), GetColour(), and Print().

◆ instance

BDSColours * BDSColours::instance = nullptr
staticprivate

Definition at line 66 of file BDSColours.hh.

◆ magnetName

std::map<G4int, G4String> BDSColours::magnetName
private

A map of the magnet name for which order it is, which can be used to access the appropriate colour map

Definition at line 70 of file BDSColours.hh.

Referenced by BDSColours().


The documentation for this class was generated from the following files: