#include <G4VScoreColorMap.hh>
Inheritance diagram for G4VScoreColorMap:
Public Member Functions | |
G4VScoreColorMap (G4String mName) | |
virtual | ~G4VScoreColorMap () |
virtual void | GetMapColor (G4double val, G4double color[4])=0 |
G4String | GetName () const |
void | SetFloatingMinMax (G4bool vl=true) |
G4bool | IfFloatMinMax () const |
void | SetMinMax (G4double minVal, G4double maxVal) |
G4double | GetMin () const |
G4double | GetMax () const |
virtual void | DrawColorChart (G4int nPoint=5) |
virtual void | DrawColorChartBar (G4int nPoint) |
virtual void | DrawColorChartText (G4int nPoint) |
void | SetPSUnit (G4String &unit) |
void | SetPSName (G4String &psName) |
Protected Attributes | |
G4String | fName |
G4bool | ifFloat |
G4double | fMinVal |
G4double | fMaxVal |
G4VVisManager * | fVisManager |
G4String | fPSUnit |
G4String | fPSName |
Definition at line 37 of file G4VScoreColorMap.hh.
G4VScoreColorMap::G4VScoreColorMap | ( | G4String | mName | ) |
G4VScoreColorMap::~G4VScoreColorMap | ( | ) | [virtual] |
void G4VScoreColorMap::DrawColorChart | ( | G4int | nPoint = 5 |
) | [virtual] |
Definition at line 49 of file G4VScoreColorMap.cc.
References DrawColorChartBar(), DrawColorChartText(), fVisManager, G4cerr, G4endl, and G4VVisManager::GetConcreteInstance().
Referenced by G4ScoringCylinder::Draw(), G4ScoringBox::Draw(), G4ScoringCylinder::DrawColumn(), and G4ScoringBox::DrawColumn().
00049 { 00050 00051 fVisManager = G4VVisManager::GetConcreteInstance(); 00052 if(!fVisManager) { 00053 G4cerr << "G4VScoringMesh::DrawColorChart(): no visualization system" << G4endl; 00054 return; 00055 } 00056 00057 DrawColorChartBar(_nPoint); 00058 DrawColorChartText(_nPoint); 00059 }
void G4VScoreColorMap::DrawColorChartBar | ( | G4int | nPoint | ) | [virtual] |
Reimplemented in G4ScoreLogColorMap.
Definition at line 61 of file G4VScoreColorMap.cc.
References G4VVisManager::Draw2D(), fVisManager, GetMapColor(), GetMax(), GetMin(), and G4Visible::SetVisAttributes().
Referenced by DrawColorChart().
00061 { 00062 00063 G4double min = this->GetMin(); 00064 G4double max = this->GetMax(); 00065 G4double smin = -0.89, smax = smin + 0.05*(_nPoint)*0.83, step=0.001; 00066 G4double c[4]; 00067 for(G4double y = smin; y < smax; y+=step) { 00068 G4double ra = (y-smin)/(smax-smin), rb = 1.-ra; 00069 G4Polyline line; 00070 line.push_back(G4Point3D(-0.96, y, 0.)); 00071 line.push_back(G4Point3D(-0.91, y, 0.)); 00072 this->GetMapColor((ra*max+rb*min)/(ra+rb), c); 00073 G4Colour col(c[0], c[1], c[2]); 00074 G4VisAttributes att(col); 00075 line.SetVisAttributes(&att); 00076 fVisManager->Draw2D(line); 00077 } 00078 00079 }
void G4VScoreColorMap::DrawColorChartText | ( | G4int | nPoint | ) | [virtual] |
Reimplemented in G4ScoreLogColorMap.
Definition at line 80 of file G4VScoreColorMap.cc.
References G4VVisManager::Draw2D(), fPSName, fPSUnit, fVisManager, GetMapColor(), GetMax(), GetMin(), CLHEP::detail::n, G4VMarker::SetScreenSize(), and G4Visible::SetVisAttributes().
Referenced by DrawColorChart().
00080 { 00081 00082 G4double min = this->GetMin(); 00083 G4double max = this->GetMax(); 00084 G4double c[4]; 00085 G4Colour black(0., 0., 0.); 00086 for(int n = 0; n < _nPoint; n++) { 00087 G4double a = n/(_nPoint-1.), b = 1.-a; 00088 G4double v = (a*max + b*min)/(a+b); 00089 // background color 00090 for(int l = 0; l < 21; l++) { 00091 G4Polyline line; 00092 line.push_back(G4Point3D(-0.908, -0.905+0.05*n+0.002*l, 0.)); 00093 line.push_back(G4Point3D(-0.705, -0.905+0.05*n+0.002*l, 0.)); 00094 G4VisAttributes attblack(black); 00095 line.SetVisAttributes(&attblack); 00096 fVisManager->Draw2D(line); 00097 } 00098 // text 00099 //char cstring[80]; 00100 //std::sprintf(cstring, "%8.2e", v); 00101 //G4String value(cstring); 00102 std::ostringstream oss; 00103 oss << std::setw(8) << std::setprecision(1) << std::scientific << v; 00104 std::string str = oss.str(); 00105 G4String value(str.c_str()); 00106 00107 G4Text text(value, G4Point3D(-0.9, -0.9+0.05*n, 0)); 00108 G4double size = 12.; 00109 text.SetScreenSize(size); 00110 this->GetMapColor(v, c); 00111 G4Colour color(c[0], c[1], c[2]); 00112 G4VisAttributes att(color); 00113 text.SetVisAttributes(&att); 00114 00115 fVisManager->Draw2D(text); 00116 } 00117 00118 // draw ps name 00119 // background 00120 G4int lpsname = 20;//fPSName.size(); 00121 if(lpsname > 0) { 00122 for(int l = 0; l < 22; l++) { 00123 G4Polyline line; 00124 line.push_back(G4Point3D(-0.9, -0.965+0.002*l, 0.)); 00125 line.push_back(G4Point3D(-0.9+0.025*lpsname, -0.965+0.002*l, 0.)); 00126 G4VisAttributes attblack(black); 00127 //G4VisAttributes attblack(G4Colour(.5, .5, 1.)); 00128 line.SetVisAttributes(&attblack); 00129 fVisManager->Draw2D(line); 00130 } 00131 // ps name 00132 G4Text txtpsname(fPSName, G4Point3D(-0.9, -0.96, 0.)); 00133 G4double size = 12.; 00134 txtpsname.SetScreenSize(size); 00135 G4Colour color(1., 1., 1.); 00136 G4VisAttributes att(color); 00137 txtpsname.SetVisAttributes(&att); 00138 fVisManager->Draw2D(txtpsname); 00139 } 00140 00141 // draw unit 00142 // background 00143 G4int len = fPSUnit.size(); 00144 if(len > 0) { 00145 for(int l = 0; l < 21; l++) { 00146 G4Polyline line; 00147 line.push_back(G4Point3D(-0.7, -0.9+0.002*l, 0.)); 00148 line.push_back(G4Point3D(-0.7+0.3, -0.9+0.002*l, 0.)); 00149 G4VisAttributes attblack(black); 00150 //G4VisAttributes attblack(G4Colour(.5, .5, .5)); 00151 line.SetVisAttributes(&attblack); 00152 fVisManager->Draw2D(line); 00153 } 00154 // unit 00155 G4String psunit = "[" + fPSUnit + "]"; 00156 G4Text txtunit(psunit, G4Point3D(-0.69, -0.9, 0.)); 00157 G4double size = 12.; 00158 txtunit.SetScreenSize(size); 00159 G4Colour color(1., 1., 1.); 00160 G4VisAttributes att(color); 00161 txtunit.SetVisAttributes(&att); 00162 fVisManager->Draw2D(txtunit); 00163 } 00164 00165 }
Implemented in G4DefaultLinearColorMap, and G4ScoreLogColorMap.
Referenced by G4ScoringCylinder::Draw(), G4ScoringBox::Draw(), DrawColorChartBar(), DrawColorChartText(), G4ScoringCylinder::DrawColumn(), and G4ScoringBox::DrawColumn().
G4double G4VScoreColorMap::GetMax | ( | ) | const [inline] |
Definition at line 66 of file G4VScoreColorMap.hh.
References fMaxVal.
Referenced by DrawColorChartBar(), and DrawColorChartText().
00067 { return fMaxVal; }
G4double G4VScoreColorMap::GetMin | ( | ) | const [inline] |
Definition at line 64 of file G4VScoreColorMap.hh.
References fMinVal.
Referenced by DrawColorChartBar(), and DrawColorChartText().
00065 { return fMinVal; }
G4String G4VScoreColorMap::GetName | ( | ) | const [inline] |
Definition at line 47 of file G4VScoreColorMap.hh.
References fName.
Referenced by G4ScoringManager::G4ScoringManager(), and G4ScoringManager::RegisterScoreColorMap().
00048 { return fName; }
G4bool G4VScoreColorMap::IfFloatMinMax | ( | ) | const [inline] |
Definition at line 51 of file G4VScoreColorMap.hh.
References ifFloat.
Referenced by G4ScoringCylinder::Draw(), G4ScoringBox::Draw(), G4ScoringCylinder::DrawColumn(), and G4ScoringBox::DrawColumn().
00052 { return ifFloat; }
void G4VScoreColorMap::SetFloatingMinMax | ( | G4bool | vl = true |
) | [inline] |
Definition at line 49 of file G4VScoreColorMap.hh.
References ifFloat.
Referenced by G4ScoringMessenger::SetNewValue().
00050 { ifFloat = vl; }
Definition at line 53 of file G4VScoreColorMap.hh.
References fMaxVal, fMinVal, G4cerr, and G4endl.
Referenced by G4ScoringCylinder::Draw(), G4ScoringBox::Draw(), G4ScoringCylinder::DrawColumn(), G4ScoringBox::DrawColumn(), and G4ScoringMessenger::SetNewValue().
00054 { 00055 if(minVal >= maxVal) 00056 { G4cerr << "WARNING: G4VScoreColoMap::SetMinMax() : minimum is larger than or equal to maximum. Verify values you set, [" 00057 << minVal << ", " << maxVal << "]" << G4endl; 00058 fMinVal = maxVal; fMaxVal = minVal; 00059 } 00060 else { 00061 fMinVal = minVal; fMaxVal = maxVal; 00062 } 00063 }
void G4VScoreColorMap::SetPSName | ( | G4String & | psName | ) | [inline] |
Definition at line 78 of file G4VScoreColorMap.hh.
References fPSName.
Referenced by G4ScoringCylinder::Draw(), G4ScoringBox::Draw(), G4ScoringCylinder::DrawColumn(), and G4ScoringBox::DrawColumn().
00078 {fPSName = psName;}
void G4VScoreColorMap::SetPSUnit | ( | G4String & | unit | ) | [inline] |
Definition at line 77 of file G4VScoreColorMap.hh.
References fPSUnit.
Referenced by G4ScoringCylinder::Draw(), G4ScoringBox::Draw(), G4ScoringCylinder::DrawColumn(), and G4ScoringBox::DrawColumn().
00077 {fPSUnit = unit;}
G4double G4VScoreColorMap::fMaxVal [protected] |
Definition at line 84 of file G4VScoreColorMap.hh.
Referenced by G4ScoreLogColorMap::DrawColorChartBar(), G4ScoreLogColorMap::DrawColorChartText(), G4ScoreLogColorMap::GetMapColor(), G4DefaultLinearColorMap::GetMapColor(), GetMax(), and SetMinMax().
G4double G4VScoreColorMap::fMinVal [protected] |
Definition at line 83 of file G4VScoreColorMap.hh.
Referenced by G4ScoreLogColorMap::DrawColorChartBar(), G4ScoreLogColorMap::DrawColorChartText(), G4ScoreLogColorMap::GetMapColor(), G4DefaultLinearColorMap::GetMapColor(), GetMin(), and SetMinMax().
G4String G4VScoreColorMap::fName [protected] |
G4String G4VScoreColorMap::fPSName [protected] |
Definition at line 87 of file G4VScoreColorMap.hh.
Referenced by DrawColorChartText(), G4ScoreLogColorMap::DrawColorChartText(), and SetPSName().
G4String G4VScoreColorMap::fPSUnit [protected] |
Definition at line 86 of file G4VScoreColorMap.hh.
Referenced by DrawColorChartText(), G4ScoreLogColorMap::DrawColorChartText(), and SetPSUnit().
G4VVisManager* G4VScoreColorMap::fVisManager [protected] |
Definition at line 85 of file G4VScoreColorMap.hh.
Referenced by DrawColorChart(), DrawColorChartBar(), G4ScoreLogColorMap::DrawColorChartBar(), DrawColorChartText(), and G4ScoreLogColorMap::DrawColorChartText().
G4bool G4VScoreColorMap::ifFloat [protected] |
Definition at line 82 of file G4VScoreColorMap.hh.
Referenced by IfFloatMinMax(), and SetFloatingMinMax().