Changeset 2234 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- Oct 28, 2002, 6:53:22 PM (23 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/pihisto2d.cc
r2231 r2234 41 41 UseDyn(); 42 42 UseFrac(); 43 SetStats(); 43 44 SetName("Histo2DDrw"); 44 45 // PIHisto2D has specific control tools … … 187 188 printf(" Dyn=%g,%g Frac=%g,%g LogSc=%g H=%p\n" 188 189 ,mHMin,mHMax,mFracMin,mFracMax,mLogScale,mHisto); 189 if(lp <1) return;190 mHisto->PrintStatus();190 if(lp>=1) mHisto->PrintStatus(); 191 fflush(stdout); 191 192 } 192 193 … … 278 279 279 280 // gestion epaisseur de ligne 280 if (GetGraphicAtt().GetLineAtt() == PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 281 PILineAtt LineAtt = GetGraphicAtt().GetLineAtt(); 282 if(LineAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine); 281 283 282 284 // gestion Markers ou plot avec des points. … … 369 371 g->SelForeground(coul); 370 372 g->SelFontSzPt(FontSize,FontAtt); 373 g->SelLine(LineAtt); 371 374 if (cmap) delete cmap; 372 375 373 376 // Fin du dessin, ecriture de la statistique. 374 DrawStats(g);377 if(stats) DrawStats(g); 375 378 } 376 379 … … 457 460 //| . ==> 0<valeur<1 458 461 //|------------------------------------------ 459 //| C1111111111222222222233333333460 //| C01234567890123456789012345678901234567462 //| 1111111111222222222233333333 463 //| 01234567890123456789012345678901234567 461 464 //| " .+23456789ABCDEFGHIJKLMNOPQRSTUVWXYZ*" 462 465 //|------------------------------------------ … … 486 489 // ,dx,dy,dxg,dyg,np); 487 490 return np; 491 } 492 493 //++ 494 int PIHisto2D::DecodeOptionString(vector<string> & opt, bool rmdecopt) 495 // 496 // Decodage des options 497 //-- 498 { 499 int optsz1 = opt.size(); 500 if(optsz1<1) return(0); 501 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 502 if(optsz1-ndec1<1) return(ndec1); // si tout a ete decode 503 504 vector<string> udopt; // On gardera ici les options non decodees 505 unsigned int k = 0; 506 int ndec = opt.size(); 507 bool listopt=false; 508 for( k=0; k<opt.size(); k++ ) { 509 string opts = opt[k]; 510 if(opts=="h2help") { 511 string info; GetOptionsHelpInfo(info); 512 size_t q = info.find("PIHisto2D"); 513 if(q<info.length()-1) cout<<info.substr(q)<<endl; 514 } else if(opts=="h2list") { 515 listopt=true; 516 } else if(opts=="sta" || opts=="stat" || opts=="stats") { 517 SetStats(true); 518 } else if( opts=="nsta" || opts=="nstat" 519 || opts=="nostat" || opts=="nostats") { 520 SetStats(false); 521 } else if(opts.substr(0,8)=="h2scale=") { 522 unsigned short t=TypScale(); float ls=LogScale(); 523 if(opts.substr(8,3)=="lin") t=0; 524 else if(opts.substr(8,3)=="log") 525 {t=1; sscanf(opts.c_str(),"h2scale=log,%g",&ls);} 526 UseScale(t,ls); 527 } else if(opts.substr(0,7)=="h2disp=") { 528 unsigned short t=TypDisplay(); float fpts=FPoints(); 529 if(opts.substr(7,3)=="var") t=0; 530 else if(opts.substr(7,3)=="hbk") t=2; 531 else if(opts.substr(7,3)=="img") t=3; 532 else if(opts.substr(7,3)=="pts") 533 {t=1; sscanf(opts.c_str(),"h2disp=pts,%g",&fpts);} 534 UseDisplay(t,fpts); 535 } else if(opts.substr(0,6)=="h2dyn=") { 536 float hmin=HMin(),hmax=HMax(); size_t q = opts.find(','); 537 sscanf(opts.c_str(),"h2dyn=%g",&hmin); 538 if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"%g",&hmax); 539 UseDyn(hmin,hmax); 540 } else if(opts.substr(0,7)=="h2frac=") { 541 float fmin=FMin(),fmax=FMax(); size_t q = opts.find(','); 542 sscanf(opts.c_str(),"h2frac=%g",&fmin); 543 if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"%g",&fmax); 544 UseFrac(fmin,fmax); 545 } else if(opts.substr(0,6)=="h2col=") { 546 bool fcol=Color(); CMapId cmid=ColMap(); bool rmap=IsColMapRev(); 547 if(opts.find(",rev")<opts.length()-1) rmap=true; 548 if(opts.find(",nor")<opts.length()-1) rmap=false; 549 for(int k=0; k<PIColorMap::NumberStandardColorMaps(); k++) { 550 string cn=PIColorMap::GetStandardColorMapName(k); 551 for(unsigned int j=0; j<cn.length(); j++) cn[j]=tolower(cn[j]); 552 if(opts.find(cn)<opts.length()-1) 553 {fcol=true; cmid=PIColorMap::GetStandardColorMapId(k); break;} 554 } 555 UseColors(fcol,cmid,rmap); 556 } else { 557 ndec--; 558 // S'il faut supprimer les options decodees 559 if (rmdecopt) udopt.push_back(opts); 560 } 561 } 562 // S'il faut supprimer les options decodees, on remplace l'argument opt 563 // par le vecteur des options non decodees. 564 if (rmdecopt) opt = udopt; 565 // Liste des options si demande 566 if(listopt) Print(); 567 return(ndec+ndec1); 568 } 569 570 //++ 571 void PIHisto2D::GetOptionsHelpInfo(string& info) 572 // 573 // Help relatif au options 574 //-- 575 { 576 // On recupere d'abord la chaine info de la classe de base 577 PIDrawer::GetOptionsHelpInfo(info); 578 info += " ---- PIHisto2D options help info (see also ALT-O): \n" ; 579 info += "- h2help: get this help text\n"; 580 info += "- h2list: list choosen options\n"; 581 info += "- sta,stat,stats: activate statistic display\n"; 582 info += " nsta,nstat,nostat,nostats: deactivate statistic display\n"; 583 info += "- h2disp=typ[,fracpts]: choose display type\n"; 584 info += " typ=var: variable size boxes\n"; 585 info += " typ=hbk: \"a la hbook2\"\n"; 586 info += " typ=img: image like (use \"h2col\" for color map)\n"; 587 info += " typ=pts: point clouds (fracpts=max possible fraction\n"; 588 info += " of used pixels per bin [0,1])\n"; 589 info += "- h2scale=lin/log[,logscale]: choose linear or logarithmic scale\n"; 590 info += "- h2dyn=[hmin][,hmax]: choose histogramme range for display\n"; 591 info += "- h2col=[colname][,colsigne] : color table\n"; 592 info += " colname: name of color table (ex: grey32,midas_heat,...)\n"; 593 info += " (see general graphicatt description)\n"; 594 info += " colsigne: reverse (\"rev\") or normal (\"nor\") color table\n"; 595 info += "- h2frac=[fmin][,fmax]: choose sub-range display [0,1]\n"; 596 return; 488 597 } 489 598 … … 625 734 mOPop[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 626 735 627 // Menu du choix de s couleurs736 // Menu du choix de la table des couleurs 628 737 cpy += bsy+spy; 629 738 mOPop[2] = new PIOptMenu(this,"optmen-h2d-3",2*bsx,bsy,cpx,cpy); -
trunk/SophyaPI/PIext/pihisto2d.h
r2231 r2234 13 13 14 14 #include "histos2.h" 15 #include "pidrawer.h" 15 16 #include "piscdrawwdg.h" 16 17 … … 30 31 virtual void Draw(PIGraphicUC* g,double xmin,double ymin,double xmax,double ymax); 31 32 32 // AppendTextInfo a faire un jour - Reza 21/01/2002 33 // virtual void AppendTextInfo(string& info, double xmin, double ymin, double xmax, double ymax); 33 //AppendTextInfo a faire un jour - Reza 21/01/2002 34 //virtual void AppendTextInfo(string& info,double xmin,double ymin 35 // ,double xmax,double ymax); 34 36 37 // Ce que fait l'action de clic avec la souris 35 38 virtual void GetClickInfo(string& info, double x, double y 36 39 ,double x0=0.,double y0=0.,bool fgdiff=false); … … 38 41 virtual void UpdateLimits(); 39 42 virtual void DrawStats(PIGraphicUC* g); 43 inline void SetStats(bool fg=true) {stats=fg;} 40 44 41 // Methode permettant l'affichage d'une fenetre de controle specialisee45 // Methode permettant l'affichage d'une fenetre de controle specialisee 42 46 virtual void ShowControlWindow(PIBaseWdgGen* wdg); 43 // Desactivation de la fenetre de controle specialisee47 // Desactivation de la fenetre de controle specialisee 44 48 virtual void DeactivateControlWindow(PIBaseWdgGen* wdg); 45 49 50 // Methode de decodage des options 51 virtual int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 52 virtual void GetOptionsHelpInfo(string& info); 53 54 // Methodes inline 46 55 inline Histo2D* Histogram() {return(mHisto);} 47 56 inline bool Color() {return(mFgCol);} … … 62 71 63 72 Histo2D* mHisto; 64 bool mAdDO; 73 bool mAdDO; bool stats; 65 74 bool mFgCol; CMapId mCmap; bool mRevCmap; 66 75 unsigned short mTypScal; float mLogScale;
Note:
See TracChangeset
for help on using the changeset viewer.