Geant4-11
Data Structures | Static Public Member Functions | Static Private Attributes
G4OpenGLFontBaseStore Class Reference

#include <G4OpenGLFontBaseStore.hh>

Data Structures

struct  FontInfo
 

Static Public Member Functions

static void AddFontBase (G4VViewer *, G4int fontBase, G4double size, const G4String &fontName, G4int width)
 
static const FontInfoGetFontInfo (G4VViewer *, G4double size)
 

Static Private Attributes

static std::map< G4VViewer *, std::vector< FontInfo > > fFontBaseMap
 

Detailed Description

Definition at line 41 of file G4OpenGLFontBaseStore.hh.

Member Function Documentation

◆ AddFontBase()

void G4OpenGLFontBaseStore::AddFontBase ( G4VViewer viewer,
G4int  fontBase,
G4double  size,
const G4String fontName,
G4int  width 
)
static

Definition at line 34 of file G4OpenGLFontBaseStore.cc.

37 {
38 fFontBaseMap[viewer].push_back(FontInfo(fontName, size, fontBase, width));
39}
static std::map< G4VViewer *, std::vector< FontInfo > > fFontBaseMap

References fFontBaseMap.

Referenced by G4OpenGLXViewer::CreateFontLists().

◆ GetFontInfo()

const G4OpenGLFontBaseStore::FontInfo & G4OpenGLFontBaseStore::GetFontInfo ( G4VViewer viewer,
G4double  size 
)
static

Definition at line 42 of file G4OpenGLFontBaseStore.cc.

43 {
44 std::map<G4VViewer*,std::vector<FontInfo> >::const_iterator i =
45 fFontBaseMap.find(viewer);
46 if (i != fFontBaseMap.end()) {
47 G4double sizeDiscrepancy = 9999.;
48 std::vector<FontInfo>::const_iterator j, k;
49 for (j = i->second.begin(); j != i->second.end(); ++j) {
50 G4double d = std::abs(size - j->fSize);
51 if (d < sizeDiscrepancy) {
52 sizeDiscrepancy = d;
53 k = j;
54 }
55 }
56 return *k;
57 } else {
58 // No font found for requested viewer.
59 static const FontInfo nullFontInfo; // Default struct, fontBase = -1;
60 return nullFontInfo;
61 }
62}
double G4double
Definition: G4Types.hh:83

References fFontBaseMap.

Referenced by G4OpenGLXViewer::DrawText().

Field Documentation

◆ fFontBaseMap

std::map< G4VViewer *, std::vector< G4OpenGLFontBaseStore::FontInfo > > G4OpenGLFontBaseStore::fFontBaseMap
staticprivate

Definition at line 59 of file G4OpenGLFontBaseStore.hh.

Referenced by AddFontBase(), and GetFontInfo().


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