Changeset 2383 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- May 16, 2003, 5:15:55 PM (22 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/nomgadapter.cc
r2322 r2383 66 66 cout << "NObjMgrAdapter::FillFromString() - Error : Not supported for " << s << endl; 67 67 return; 68 } 69 70 /* --Methode-- */ 71 string NObjMgrAdapter::GetInfoString(int /*lev*/) 72 { 73 char buff[128]; 74 sprintf("Type: %s @ %lx", typeid(*mObj).name(), (long)mObj); 75 return(buff); 68 76 } 69 77 -
trunk/SophyaPI/PIext/nomgadapter.h
r1315 r2383 43 43 virtual void FillFromString(); 44 44 45 // Returns a string with synthetic information about the object (lev-> Level of details) 46 virtual string GetInfoString(int lev=0); 47 45 48 virtual void ReadFits(string const & flnm); 46 49 virtual void SaveFits(string const & flnm); -
trunk/SophyaPI/PIext/nomhistadapter.cc
r2322 r2383 46 46 HProf * hp = dynamic_cast<HProf *>(mHis); 47 47 if(hp) return("HProf "); else return("Histo "); 48 } 49 50 /* --Methode-- */ 51 string NOMAdapter_Histo::GetInfoString(int lev) 52 { 53 char buff[128]; 54 string rs; 55 if (lev > 2) { 56 sprintf(buff, "Histo: NBin=%d XMin=%lg XMax=%lg\n", mHis->NBins(), 57 mHis->XMin(), mHis->XMax()); 58 rs += buff; 59 } 60 sprintf(buff, "Entries= %lg \n", mHis->NEntries()); 61 rs += buff; 62 if (lev > 0) { 63 sprintf(buff, "Overflow= %lg \n", mHis->NOver()); 64 rs += buff; 65 sprintf(buff, "Underflow= %lg \n", mHis->NUnder()); 66 rs += buff; 67 } 68 sprintf(buff, "Mean= %lg \n", mHis->Mean()); 69 rs += buff; 70 sprintf(buff, "Sigma= %lg \n", mHis->Sigma()); 71 rs += buff; 72 return rs; 48 73 } 49 74 -
trunk/SophyaPI/PIext/nomhistadapter.h
r1321 r2383 32 32 // virtual void SaveFits(string const & flnm); 33 33 virtual void SavePPF(POutPersist& s, string const & nom); 34 35 // Returns a string with synthetic information about the object 36 virtual string GetInfoString(int lev=0); 34 37 35 38 virtual void Print(ostream& os); -
trunk/SophyaPI/PIext/pihisto.cc
r2232 r2383 39 39 SetStats(); 40 40 SetError(); 41 SetStatPosOffset(); 41 42 SetName("HistoDrw"); 42 43 } … … 173 174 else if(opts=="noerr") SetError(-1); 174 175 else if(opts=="autoerr") SetError(0); 176 else if(opts.substr(0,11) == "statposoff=") { 177 float xo=0., yo=0.; 178 sscanf(opts.substr(11).c_str(),"%g,%g",&xo, &yo); 179 SetStatPosOffset(xo, yo); 180 } 175 181 else { 176 182 ndec--; … … 191 197 PIDrawer::GetOptionsHelpInfo(info); 192 198 info += " ---- PIHisto options help info : \n" ; 193 info += " -sta,stat,stats: activate statistic display\n";199 info += " sta,stat,stats: activate statistic display\n"; 194 200 info += " nsta,nstat,nostat,nostats: deactivate statistic display\n"; 195 info += " -err / nerr : draw, do not draw error bars\n";201 info += " err / nerr : draw, do not draw error bars\n"; 196 202 info += " autoerr : draw error bars if Marker drawing requested OR Profile histo\n"; 203 info += " statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n"; 204 info += " as a fraction of total size \n"; 197 205 return; 198 206 } … … 221 229 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 222 230 231 double ofpx = spoX*(XMax()-XMin()); 232 double ofpy = spoY*(YMax()-YMin()); 233 223 234 double xu, yu, cw; 224 235 // Les limites du cadre 225 236 xu = g->DeltaUCX(XMax(), -cellWidth); 226 237 yu = g->DeltaUCY(YMax(), -cellHeight); 227 g->DrawLine(xu,YMax(),xu,yu); 228 g->DrawLine(xu,yu,XMax(),yu); 238 double recw = XMax()-xu; 239 double rech = YMax()-yu; 240 xu += ofpx; yu += ofpy; 241 g->DrawBox(xu, yu, recw, rech); 229 242 230 243 // L'ecriture des labels (attention aux inversions possibles des axes!) … … 234 247 cw = (g->isAxeYDirUpDown()) ? -0.15*cH : -1.15*cH; 235 248 yu = g->DeltaUCY(YMax(),cw); 249 xu += ofpx; yu += ofpy; 236 250 g->DrawString(xu, yu,label1); 237 238 yu = g->DeltaUCY(YMax(),cw);239 240 241 yu = g->DeltaUCY(YMax(),cw);242 251 cw += -1.15*cH; 252 yu = g->DeltaUCY(YMax(),cw); yu += ofpy; 253 g->DrawString(xu, yu,label2); 254 cw += -1.15*cH; 255 yu = g->DeltaUCY(YMax(),cw); yu += ofpy; 256 g->DrawString(xu, yu,label3); 243 257 244 258 } -
trunk/SophyaPI/PIext/pihisto.h
r2229 r2383 15 15 virtual void UpdateLimits(); 16 16 inline void SetStats(bool fg=true) {stats=fg;} 17 inline void SetStatPosOffset(float ofx=-0.01, float ofy=-0.01) 18 {spoX=ofx; spoY=ofy; } 17 19 // fg=-1 pas de barre d'erreur, 1=barres d'erreurs, 18 20 // 0=barres d'erreurs automatiques: trace si HProf ou markeur demande … … 29 31 bool mAdDO; 30 32 bool stats,error; 33 float spoX, spoY; // Stat pos offset par rapport a position defaut 31 34 }; 32 35 -
trunk/SophyaPI/PIext/pihisto2d.cc
r2380 r2383 42 42 UseFrac(); 43 43 SetStats(); 44 SetStatPosOffset(); 44 45 SetName("Histo2DDrw"); 45 46 // PIHisto2D has specific control tools … … 427 428 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 428 429 430 double ofpx = spoX*(XMax()-XMin()); 431 double ofpy = spoY*(YMax()-YMin()); 432 429 433 double xu, yu, cw; 430 434 // Les limites du cadre 431 435 xu = g->DeltaUCX(XMax(), -cellWidth); 432 436 yu = g->DeltaUCY(YMax(), -cellHeight); 433 g->DrawLine(xu,YMax(),xu,yu); 434 g->DrawLine(xu,yu,XMax(),yu); 437 double recw = XMax()-xu; 438 double rech = YMax()-yu; 439 xu += ofpx; yu += ofpy; 440 g->DrawBox(xu, yu, recw, rech); 435 441 436 442 // L'ecriture des labels … … 439 445 cw = (g->isAxeYDirUpDown()) ? -0.1*cH : -1.1*cH; 440 446 yu = g->DeltaUCY(YMax(),cw); 447 xu += ofpx; yu += ofpy; 441 448 g->DrawString(xu,yu,label); 442 449 … … 524 531 || opts=="nostat" || opts=="nostats") { 525 532 SetStats(false); 533 } else if(opts.substr(0,11) == "statposoff=") { 534 float xo=0., yo=0.; 535 sscanf(opts.substr(11).c_str(),"%g,%g",&xo, &yo); 536 SetStatPosOffset(xo, yo); 526 537 } else if(opts.substr(0,8)=="h2scale=") { 527 538 unsigned short t=TypScale(); float ls=LogScale(); -
trunk/SophyaPI/PIext/pihisto2d.h
r2380 r2383 42 42 virtual void DrawStats(PIGraphicUC* g); 43 43 inline void SetStats(bool fg=true) {stats=fg;} 44 inline void SetStatPosOffset(float ofx=-0.01, float ofy=-0.01) 45 {spoX=ofx; spoY=ofy; } 44 46 45 47 // Methode permettant l'affichage d'une fenetre de controle specialisee … … 77 79 float mHMin,mHMax; 78 80 float mFracMin,mFracMax; 81 float spoX, spoY; // Stat pos offset par rapport a position defaut 79 82 }; 80 83 -
trunk/SophyaPI/PIext/pintuple.cc
r2373 r2383 46 46 mAdDO = ad; 47 47 SetStats(true); 48 SetStatPosOffset(); 48 49 ConnectPoints(false); 49 50 UseSizeScale(true, 5); … … 237 238 // Les labels et leurs longueurs -> largeur de la cellule 238 239 char label[64]; 239 sprintf(label, "N d= %d / Ntot= %d", nok, mNT->NbLines());240 sprintf(label, "N=%d (/%d)", nok, mNT->NbLines()); 240 241 double cellWidth = 1.1 * (double)g->CalcStringWidth(label); 241 242 double xu, yu, cw; 243 double ofpx = spoX*(XMax()-XMin()); 244 double ofpy = spoY*(YMax()-YMin()); 242 245 // Les limites du cadre 243 246 xu = g->DeltaUCX(XMax(), - cellWidth); 244 247 yu = g->DeltaUCY(YMax(), - cellHeight); 245 g->DrawLine(xu, YMax(), xu, yu); 246 g->DrawLine(xu, yu, XMax(), yu); 248 double recw = XMax()-xu; 249 double rech = YMax()-yu; 250 xu += ofpx; yu += ofpy; 251 g->DrawBox(xu, yu, recw, rech); 247 252 // L'ecriture des labels (attention aux inversions possibles des axes!) 248 253 cw = (g->isAxeXDirRtoL()) ? -0.05*cellWidth : -0.95*cellWidth; … … 250 255 cw = (g->isAxeYDirUpDown()) ? -0.1*cH : -1.1*cH; 251 256 yu = g->DeltaUCY(YMax(),cw); 257 xu += ofpx; yu += ofpy; 252 258 g->DrawString(xu,yu,label); 253 259 } … … 313 319 else if( opts=="nsta" || opts=="nstat" 314 320 || opts=="nostat" || opts=="nostats") SetStats(false); 321 else if(opts.substr(0,11) == "statposoff=") { 322 float xo=0., yo=0.; 323 sscanf(opts.substr(11).c_str(),"%g,%g",&xo, &yo); 324 SetStatPosOffset(xo, yo); 325 } 315 326 else if (opts == "connectpoints") ConnectPoints(true); 316 327 else if (opts == "noconnectpoints") ConnectPoints(false); … … 323 334 UseSizeScale(true, nbn); 324 335 } 336 325 337 else { 326 338 // Si option non decode … … 350 362 info += " sta,stat,stats: activate statistic display\n"; 351 363 info += " nsta,nstat,nostat,nostats: deactivate statistic display\n"; 364 info += " statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n"; 365 info += " as a fraction of total size \n"; 352 366 info += " connectpoints: The points are connected by a line \n"; 353 367 info += " noconnectpoints (this is the default) \n"; 354 368 info += " colorscale/nocolorscale (Use color scale for weight) \n"; 355 369 info += " sizescale/sizescale=nbins/nosizescale (Use marker size for weight) \n"; 356 info += " and usual color/line/marker/... attribute decoding\n";370 info += " (and usual color/line/marker/... attribute decoding) \n"; 357 371 return; 358 372 } -
trunk/SophyaPI/PIext/pintuple.h
r2373 r2383 35 35 36 36 inline void SetStats(bool fg=true) { stats = fg; } 37 inline void SetStatPosOffset(float ofx=-0.01, float ofy=-0.01) 38 {spoX=ofx; spoY=ofy; } 37 39 38 40 virtual void AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax); … … 56 58 bool stats; // true -> indication du nb de points 57 59 bool connectPts; // true -> les points sont relies par une ligne 60 float spoX, spoY; // Stat pos offset par rapport a position defaut 58 61 }; 59 62 -
trunk/SophyaPI/PIext/pistdimgapp.cc
r2350 r2383 44 44 static void hideInfoWindow(PIStdImgApp* app); 45 45 46 // Pour compter le nombre de display same a la suite 47 static int nb_disp_same = 0; 46 48 47 49 /* ........................................................... */ … … 628 630 // Les options 629 631 scd->DecodeOptionString(mDefaultAtt, false); 632 if (nb_disp_same > 0) { 633 vector<string> ostatpos; 634 int spo = nb_disp_same%4; 635 if (spo == 1) ostatpos.push_back("statposoff=-0.01,-0.26"); 636 else if (spo == 2) ostatpos.push_back("statposoff=-0.36,-0.01"); 637 else ostatpos.push_back("statposoff=-0.36,-0.26"); 638 scd->DecodeOptionString(ostatpos, true); 639 } 630 640 scd->DecodeOptionString(opts, true); 631 641 … … 720 730 // Les options 721 731 dr3->DecodeOptionString(mDefaultAtt, false); 732 if (nb_disp_same > 1) { 733 vector<string> ostatpos; 734 int spo = nb_disp_same%4; 735 if (spo == 1) ostatpos.push_back("statposoff=-0.01,-0.26"); 736 else if (spo == 2) ostatpos.push_back("statposoff=-0.36,-0.01"); 737 else ostatpos.push_back("statposoff=-0.36,-0.26"); 738 dr3->DecodeOptionString(ostatpos, true); 739 } 740 722 741 dr3->DecodeOptionString(opts, true); 723 742 … … 1444 1463 1445 1464 //DBG cerr << " DBG-Parse-B opts.size()=" << opts.size() << endl; 1465 if (rc == Disp_Same) nb_disp_same++; 1466 else nb_disp_same = 0; 1446 1467 return (rc); 1447 1468 }
Note:
See TracChangeset
for help on using the changeset viewer.