Changeset 2229 in Sophya for trunk/SophyaPI/PIext/pihisto.cc
- Timestamp:
- Oct 24, 2002, 11:17:29 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pihisto.cc
r1971 r2229 38 38 mAdDO = ad; // Flag pour suppression automatique de mHisto 39 39 SetStats(true); 40 SetError(0); 40 41 SetName("HistoDrw"); 41 42 } … … 43 44 PIHisto::~PIHisto() 44 45 { 45 if 46 if(mAdDO) delete mHisto; 46 47 } 47 48 … … 64 65 hmin -= v1; hmax += v1; 65 66 } 66 if(hmax<=hmin) hmax +=1.;67 if(hmax<=hmin) hmax = hmin+1.; 67 68 SetLimits(mHisto->XMin(), mHisto->XMax(), hmin, hmax); 68 // SetAxesFlags(kBoxAxes | kExtTicks | kLabels); NE PAS faire Reza 11/9969 69 } 70 70 … … 74 74 if (axesFlags != kAxesNone) DrawAxes(g); 75 75 76 bool oktrace = false; 77 if (!mHisto) return; 78 79 if((GetGraphicAtt().GetMarker() != PI_NotDefMarker) || 80 (typeid(*mHisto) == typeid(HProf)) ) { 81 // Marqeurs definis OU HProf => marqueurs+Erreurs si il y en a 82 mHisto->UpdateHisto(); // pour le cas ou c'est un HProf 83 if(GetGraphicAtt().GetLineAtt() == PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 84 double x1,y1, x2,y2; 76 if (!mHisto) return; 77 78 if( typeid(*mHisto)==typeid(HProf) ) mHisto->UpdateHisto(); 79 80 bool drawmarker=false, drawerr=false, oktrace=false; 81 // Tracer les marqueurs si demande ou si HProf 82 if( (GetGraphicAtt().GetMarker() != PI_NotDefMarker) || 83 (typeid(*mHisto) == typeid(HProf)) ) drawmarker = true; 84 if(error==0) { // Gestion automatique des erreurs 85 // Tracer les erreurs si HProf 86 if( typeid(*mHisto)==typeid(HProf) ) drawerr=true; 87 // Trace les erreurs si marqueurs demandes 88 if(drawmarker) drawerr=true; 89 } else if(error>0) drawerr=true; 90 91 // Trace des marqeurs 92 if(drawmarker) { 93 double x1,y1; oktrace = true; 94 for(int i=0; i<mHisto->NBins(); i++) { 95 x1 = mHisto->BinCenter(i); 96 y1 = (*mHisto)(i); 97 g->DrawMarker(x1,y1); 98 } 99 } 100 101 // Trace des erreurs 102 // Si Marqeurs definis OU HProf => marqueurs+Erreurs si il y en a 103 if(drawerr) { 104 if(GetGraphicAtt().GetLineAtt()==PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 105 double x1,x2,y1,y2; oktrace = true; 85 106 double bw = mHisto->BinWidth(); 86 107 for(int i=0; i<mHisto->NBins(); i++) { … … 96 117 g->DrawLine(x1,y2, x2, y2); 97 118 } 98 // le marqueur 99 x1 = mHisto->BinCenter(i); 100 y1 = (*mHisto)(i); 101 g->DrawMarker(x1,y1); 102 } 103 oktrace = true; 104 } 119 } 120 } 121 122 // Trace de la ligne continue 105 123 if(GetGraphicAtt().GetLineAtt() != PI_NotDefLineAtt) { 106 double x1,y1, x2, y2; 124 double x1,y1, x2, y2; oktrace = true; 107 125 x1 = mHisto->BinLowEdge(0); 108 126 y1 = 0; … … 117 135 } 118 136 y2 = 0; g->DrawLine(x1,y1, x2, y2); 119 oktrace = true; 120 } 137 } 138 139 // Si rien n'a ete trace 121 140 if( !oktrace ) { 122 141 for(int i=0; i<mHisto->NBins(); i++) { … … 126 145 double height = (*mHisto)(i); 127 146 g->DrawFBox(left,bottom,width,height); 128 g->DrawLine(left, bottom, left, bottom + height); // Au moins une ligne... 129 } 130 } 147 g->DrawLine(left, bottom, left, bottom+height); // Au moins une ligne... 148 } 149 } 150 151 // Trace/Ecriture des statistiques 131 152 // A faire a la fin - DrawStats change l'attribut de ligne 132 153 if(stats) DrawStats(g); … … 136 157 PIHisto::DecodeOptionString(vector<string> & opt, bool rmdecopt) 137 158 { 138 if (opt.size() < 1) return(0); 159 int optsz1 = opt.size(); 160 if(optsz1<1) return(0); 139 161 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 140 if ((opt.size() - ndec1) <1) return(ndec1); // si tout a ete decode162 if(optsz1-ndec1<1) return(ndec1); // si tout a ete decode 141 163 142 164 vector<string> udopt; // On gardera ici les options non decodees … … 145 167 for( k=0; k<opt.size(); k++ ) { 146 168 string opts = opt[k]; 147 if (opts == "stat") SetStats(true); 148 else if (opts == "nostat") SetStats(false); 169 if(opts=="sta" || opts=="stat" || opts=="stats") SetStats(true); 170 else if( opts=="nsta" || opts=="nstat" 171 || opts=="nostat" || opts=="nostats") SetStats(false); 172 else if(opts=="err") SetError(1); 173 else if(opts=="noerr") SetError(-1); 174 else if(opts=="autoerr") SetError(0); 149 175 else { 150 176 ndec--; … … 152 178 if (rmdecopt) udopt.push_back(opts); 153 179 } 154 } 180 } 155 181 // S'il faut supprimer les options decodees, on remplace l'argument opt 156 182 // par le vecteur des options non decodees. 157 183 if (rmdecopt) opt = udopt; 158 return(ndec+ndec1); 184 return(ndec+ndec1); 185 } 186 187 void 188 PIHisto::GetOptionsHelpInfo(string& info) 189 { 190 // On recupere d'abord la chaine info de la classe de base 191 PIDrawer::GetOptionsHelpInfo(info); 192 info += " ---- PIHisto options help info : \n" ; 193 info += "- sta,stat,stats: activate statistic display\n"; 194 info += " nsta,nstat,nostat,nostats: deactivate statistic display\n"; 195 info += "- err / nerr : draw, do not draw error bars\n"; 196 info += " autoerr : draw error bars if Marker drawing requested OR Profile histo\n"; 197 return; 159 198 } 160 199
Note:
See TracChangeset
for help on using the changeset viewer.