Geant4 11.2.2
Toolkit for the simulation of the passage of particles through matter
Loading...
Searching...
No Matches
G4ModelColourMap< T > Class Template Reference

#include <G4ModelColourMap.hh>

Public Member Functions

 G4ModelColourMap ()
 
virtual ~G4ModelColourMap ()
 
void Set (const T &, const G4Colour &)
 
void Set (const T &, const G4String &)
 
G4Colouroperator[] (const T &quantity)
 
const std::map< T, G4Colour > & GetBasicMap () const
 
bool GetColour (const T &, G4Colour &) const
 
void Print (std::ostream &ostr) const
 

Detailed Description

template<typename T>
class G4ModelColourMap< T >

Definition at line 40 of file G4ModelColourMap.hh.

Constructor & Destructor Documentation

◆ G4ModelColourMap()

template<typename T >
G4ModelColourMap< T >::G4ModelColourMap ( )

Definition at line 70 of file G4ModelColourMap.hh.

70{}

◆ ~G4ModelColourMap()

template<typename T >
G4ModelColourMap< T >::~G4ModelColourMap ( )
virtual

Definition at line 73 of file G4ModelColourMap.hh.

73{}

Member Function Documentation

◆ GetBasicMap()

template<typename T >
const std::map< T, G4Colour > & G4ModelColourMap< T >::GetBasicMap ( ) const

Definition at line 104 of file G4ModelColourMap.hh.

105{ return fMap; }

Referenced by G4TrajectoryDrawByEncounteredVolume::Draw().

◆ GetColour()

template<typename T >
bool G4ModelColourMap< T >::GetColour ( const T & quantity,
G4Colour & colour ) const

Definition at line 109 of file G4ModelColourMap.hh.

110{
111 typename std::map<T, G4Colour>::const_iterator iter = fMap.find(quantity);
112
113 if (iter != fMap.end()) {
114 colour = iter->second;
115 return true;
116 }
117
118 return false;
119}

Referenced by G4TrajectoryDrawByCharge::Draw(), G4TrajectoryDrawByEncounteredVolume::Draw(), G4TrajectoryDrawByOriginVolume::Draw(), and G4TrajectoryDrawByParticleID::Draw().

◆ operator[]()

template<typename T >
G4Colour & G4ModelColourMap< T >::operator[] ( const T & quantity)

Definition at line 67 of file G4ModelColourMap.hh.

67{return fMap[quantity];}

◆ Print()

template<typename T >
void G4ModelColourMap< T >::Print ( std::ostream & ostr) const

Definition at line 123 of file G4ModelColourMap.hh.

124{
125 typename std::map<T, G4Colour>::const_iterator iter = fMap.begin();
126
127 while (iter != fMap.end()) {
128 ostr<< iter->first <<" : "<< iter->second <<G4endl;
129 iter++;
130 }
131}
#define G4endl
Definition G4ios.hh:67

Referenced by G4TrajectoryDrawByCharge::Print(), G4TrajectoryDrawByEncounteredVolume::Print(), G4TrajectoryDrawByOriginVolume::Print(), and G4TrajectoryDrawByParticleID::Print().

◆ Set() [1/2]

template<typename T >
void G4ModelColourMap< T >::Set ( const T & quantity,
const G4Colour & colour )

◆ Set() [2/2]

template<typename T >
void G4ModelColourMap< T >::Set ( const T & quantity,
const G4String & colour )

Definition at line 77 of file G4ModelColourMap.hh.

78{
79 G4Colour myColour;
80
81 // Will not setup the map if colour key does not exist
82 if (!G4Colour::GetColour(colour, myColour)) {
84 ed << "G4Colour with key "<<colour<<" does not exist ";
86 ("G4ColourMap::Set(Charge charge, const G4String& colour)",
87 "modeling0108", JustWarning, ed);
88 return;
89 }
90
91
92 // Will not modify myColour if colour key does not exist
93 Set(quantity, myColour);
94}
@ JustWarning
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
std::ostringstream G4ExceptionDescription
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition G4Colour.cc:155
void Set(const T &, const G4Colour &)

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