Geant4-11
Public Member Functions | Private Attributes
G4ModelColourMap< T > Class Template Reference

#include <G4ModelColourMap.hh>

Public Member Functions

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

Private Attributes

std::map< T, G4ColourfMap
 

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

Definition at line 104 of file G4ModelColourMap.hh.

105{ return fMap; }
std::map< T, G4Colour > 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:57

References G4endl.

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)
Definition: G4Exception.cc:35
std::ostringstream G4ExceptionDescription
Definition: G4Exception.hh:40
static G4bool GetColour(const G4String &key, G4Colour &result)
Definition: G4Colour.cc:161
void Set(const T &, const G4Colour &)

References G4Exception(), G4Colour::GetColour(), JustWarning, and G4ArrayOps::Set().

Field Documentation

◆ fMap

template<typename T >
std::map<T, G4Colour> G4ModelColourMap< T >::fMap
private

Definition at line 61 of file G4ModelColourMap.hh.


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