MCPcopy Create free account
hub / github.com/Geant4/geant4 / DrawColorChartText

Method DrawColorChartText

source/digits_hits/utils/src/G4VScoreColorMap.cc:85–179  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83}
84
85void G4VScoreColorMap::DrawColorChartText(G4int _nPoint)
86{
87 G4double min = this->GetMin();
88 G4double max = this->GetMax();
89 G4double c[4];
90 G4Colour black(0.1, 0.1, 0.1, 0.8);
91
92 fVisManager->BeginDraw2D();
93
94 for(G4int n = 0; n < _nPoint; n++)
95 {
96 G4double a = n / (_nPoint - 1.), b = 1. - a;
97 G4double v = (a * max + b * min) / (a + b);
98 // background color
99
100 for(G4int l = 0; l < 21; l++)
101 {
102 G4Polyline line;
103 line.push_back(G4Point3D(-0.9, -0.905 + 0.05 * n + 0.002 * l, 0.));
104 line.push_back(G4Point3D(-0.75, -0.905 + 0.05 * n + 0.002 * l, 0.));
105 G4VisAttributes attblack(black);
106 line.SetVisAttributes(&attblack);
107 fVisManager->Draw2D(line);
108 }
109
110 // text
111 std::ostringstream oss;
112 oss << std::setw(8) << std::setprecision(1) << std::scientific << v;
113 G4String value = oss.str();
114
115 G4Text text(value, G4Point3D(-0.9, -0.9 + 0.05 * n, 0.4));
116 G4double size = 12.;
117 text.SetScreenSize(size);
118 this->GetMapColor(v, c);
119 G4Colour color(c[0], c[1], c[2], 1.);
120 G4VisAttributes att(color);
121 text.SetVisAttributes(&att);
122
123 fVisManager->Draw2D(text);
124 }
125
126 // draw ps name
127 // background
128 G4double lpsname = 2. + fPSName.size() * 0.95;
129 if(lpsname > 0)
130 {
131 for(G4int l = 0; l < 22; l++)
132 {
133 G4Polyline line;
134 line.push_back(G4Point3D(-0.92, -0.965 + 0.002 * l, 0.));
135 line.push_back(
136 G4Point3D(-0.92 + 0.025 * lpsname, -0.965 + 0.002 * l, 0.));
137 G4VisAttributes attblack(black);
138 line.SetVisAttributes(&attblack);
139 fVisManager->Draw2D(line);
140 }
141
142 // ps name

Callers

nothing calls this directly

Calls 9

GetMinMethod · 0.95
GetMaxMethod · 0.95
BeginDraw2DMethod · 0.80
Draw2DMethod · 0.80
EndDraw2DMethod · 0.80
push_backMethod · 0.45
SetVisAttributesMethod · 0.45
GetMapColorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected