|
BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Colour class that holds all colours used in BDSIM. More...
#include <BDSColours.hh>

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 BDSColours * | Instance () |
| 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 BDSColours * | instance = nullptr |
Colour class that holds all colours used in BDSIM.
Definition at line 33 of file BDSColours.hh.
| typedef std::tuple<G4double, G4double, G4double, G4double> BDSColours::BDSColourKey |
Definition at line 36 of file BDSColours.hh.
| BDSColours::~BDSColours | ( | ) |
Definition at line 40 of file BDSColours.cc.
|
private |
Private constructor as singleton.
Definition at line 45 of file BDSColours.cc.
References colours, magnetName, and Print().
Referenced by Instance().


| 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().


| 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().

| G4Colour * BDSColours::GetColour | ( | G4double | red, |
| G4double | green, | ||
| G4double | blue, | ||
| G4double | alpha = 1 |
||
| ) |
Get a cached anonymous colour by values.
Definition at line 210 of file BDSColours.cc.
References anonymousColours, and BDS::EnsureInLimits().
Referenced by BDSColourFromMaterial::BDSColourFromMaterial(), BDSMagnetOuterInfo::BDSMagnetOuterInfo(), BDSDump::Build(), BDSGaborLens::BuildBeamPipe(), BDSGaborLens::BuildOuter(), BDSCollimator::CheckParameters(), BDSCollimatorBeamMask::CheckParameters(), BDSTipCollimator::CheckParameters(), BDSCollimatorJaw::CheckParameters(), BDSCollimatorTipJaw::CheckParameters(), BDSMagnetOuterFactory::CreateExternal(), BDSMagnetOuterFactoryLHC::CreateLHCDipole(), BDSMagnetOuterFactoryPolesBase::CreateLogicalVolumesCoil(), BDSMagnetOuterFactoryCylindrical::CreateSolenoid(), BDSColourFromMaterial::GetColour(), BDSComponentFactory::PrepareColour(), and BDSCavityFactoryBase::SetVisAttributes().


|
static |
singleton pattern
Definition at line 33 of file BDSColours.cc.
References BDSColours().
Referenced by BDSGeometryFactoryBase::ApplyColourMapping(), BDSColourFromMaterial::BDSColourFromMaterial(), BDSMagnetOuterInfo::BDSMagnetOuterInfo(), BDSGasCapillary::Build(), BDSGasJet::Build(), BDSUndulator::Build(), BDSDump::Build(), BDSGaborLens::BuildBeamPipe(), BDSMuonCooler::BuildContainerLogicalVolume(), BDSGaborLens::BuildOuter(), BDSCollimator::CheckParameters(), BDSCollimatorBeamMask::CheckParameters(), BDSTipCollimator::CheckParameters(), BDSCollimatorJaw::CheckParameters(), BDSCollimatorTipJaw::CheckParameters(), BDSMagnetOuterFactory::CreateExternal(), BDSMagnetOuterFactoryLHC::CreateLHCDipole(), BDSMagnetOuterFactoryBase::CreateLogicalVolumes(), BDSMagnetOuterFactoryPolesBase::CreateLogicalVolumesCoil(), BDSMagnetOuterFactoryLHC::CreateQuadrupole(), BDSMagnetOuterFactoryCylindrical::CreateSolenoid(), BDSColourFromMaterial::GetColour(), BDSExecOptions::Parse(), BDSComponentFactory::PrepareColour(), BDSComponentFactory::PrepareColours(), BDSScreenFrame::SetDefaultVisAtts(), BDSCrystalFactory::SetVisAttributes(), BDSCavityFactoryBase::SetVisAttributes(), BDSTunnelFactoryBase::SetVisAttributes(), BDSBeamPipeFactoryBase::SetVisAttributes(), BDSBeamPipeFactoryLHCDetailed::SetVisAttributes(), BDSVisManager::StartSession(), BDSIM::~BDSIM(), and BDSIMLink::~BDSIMLink().


| 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().

|
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().
|
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().
|
staticprivate |
Definition at line 66 of file BDSColours.hh.
|
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().