Changeset 1850 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Jan 7, 2002, 4:56:32 PM (24 years ago)
Author:
cmv
Message:

1-/ correction bug init. sur TypScal (pb vu par Marc switch Lineaire/Log10)
2-/ Amelioration du widget d'options (clic souris 3)
3-/ reverse color map

cmv 7/1/2002

Location:
trunk/SophyaPI/PIext
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIext/pihisto2d.cc

    r1645 r1850  
    11#include <stdio.h>
     2#include <stdlib.h>
    23#include "piapplgen.h"
    34#include "pihisto2d.h"
     
    2930//      Createur d'une classe de dessin pour l'histogramme 2D histo.
    3031//--
    31 : PIDrawer(), mHisto(histo)
    32 {
    33 mAdDO = ad;     // Flag pour suppression automatique de mHisto 
    34 
    35 mLogScale = 10.;
    36 mFPoints = 0.5;
    37 
     32: PIDrawer(), mHisto(histo), mAdDO(ad), mLogScale(10.), mFPoints(0.5)
     33{
     34// mAdDO : Flag pour suppression automatique de mHisto
     35// Attention: mFPoints n'est initialise que si on display par nuages de points
     36//            mLogScale n'est initialise que si on utilise une echelle log
     37UseScale();
    3838UseColors();
    3939UseDisplay();
     
    4848//--
    4949{
    50 if(mAdDO) delete mHisto;
    51 }
    52 
    53 //++
    54 void PIHisto2D::UseColors(bool fg, CMapId cmap)
     50if(mAdDO && mHisto!=NULL) delete mHisto;
     51}
     52
     53//++
     54void PIHisto2D::UseColors(bool fg,CMapId cmap,bool revcmap)
    5555//
    5656//      Choix de la couleur si fg=true avec la color map cmap.
     
    6161//      en couleur. Cette option est incontournable dans le cas
    6262//      d'un display par des carres de taille fixe.
     63//      revcmap doit etre mis a "true" si on veut avoir une color map
     64//      inversee.
    6365//| -**- gestion dans H2WinArg par menu deroulant Black&White etc...
    6466//--
    6567{
    66 mFgCol = fg; mCmap = cmap;
     68mFgCol = fg; mCmap = cmap; mRevCmap = revcmap;
    6769}
    6870
     
    8991//--
    9092{
    91 if(type==0) mTypScal = 0;
    92 if(type==1) {
    93   mTypScal = 1;
    94   if(logscale>1.) mLogScale = logscale;
    95 } else mTypScal = 0;
    96 }
    97 
    98 //++
    99 void PIHisto2D::UseDisplay(unsigned short type, float fnpt)
     93if(type==0)       mTypScal=0;
     94else if(type==1) {mTypScal=1; if(logscale>1.) mLogScale=logscale;}
     95else              mTypScal=0;
     96}
     97
     98//++
     99void PIHisto2D::UseDisplay(unsigned short type,float fnpt)
    100100//
    101101//      Type de Display
     
    112112//--
    113113{
    114 if(fnpt<0.) fnpt=0; else if(fnpt>1.) fnpt=1.;
    115 if(type==0)        mTypDisp = 0;
    116 else if(type==1) { mTypDisp = 1; mFPoints = fnpt;}
    117 else if(type==2)   mTypDisp = 2;
    118 else if(type==3)   mTypDisp = 3;
    119 else               mTypDisp = 1;
    120 }
    121 
    122 //++
    123 void PIHisto2D::UseDyn(float hmin, float hmax)
     114if(type==0) mTypDisp = 0;
     115else if(type==1) {
     116  mTypDisp = 1;
     117  if(fnpt<0.) mFPoints = 0.;
     118    else if(fnpt>1.) mFPoints = 1.;
     119      else mFPoints = fnpt;
     120}
     121else if(type==2) mTypDisp = 2;
     122else if(type==3) mTypDisp = 3;
     123else             mTypDisp = 1;
     124}
     125
     126//++
     127void PIHisto2D::UseDyn(float hmin,float hmax)
    124128//
    125129//      Gestion de la dynamique a representer:
     
    133137//--
    134138{
    135 if(hmin>=hmax) {hmin = mHisto->VMin(); hmax = mHisto->VMax();}
     139if(mHisto)
     140  if(hmin>=hmax) {hmin = mHisto->VMin(); hmax = mHisto->VMax();}
    136141if(hmin>=hmax) hmax = hmin+1.;
    137142mHMin = hmin; mHMax = hmax;
     
    139144
    140145//++
    141 void PIHisto2D::UseFrac(float frmin, float frmax)
     146void PIHisto2D::UseFrac(float frmin,float frmax)
    142147//
    143148//      Pour definir la fraction de la dynamique a dessiner:
     
    167172//--
    168173{
    169 printf("PIHisto2D::Print FgCol=%d Cmap=%d TypScal=%d TypDisp=%d (FPoints=%g)\n"
    170       ,(int)mFgCol,(int)mCmap,mTypScal,mTypDisp,mFPoints);
     174printf("PIHisto2D::Print FgCol=%d Cmap=%d (Rev=%d) TypScal=%d TypDisp=%d (FPoints=%g)\n"
     175      ,(int)mFgCol,(int)mCmap,(int)mRevCmap,mTypScal,mTypDisp,mFPoints);
    171176printf("                 Dyn=%g,%g Frac=%g,%g LogSc=%g H=%lx\n"
    172177      ,mHMin,mHMax,mFracMin,mFracMax,mLogScale,(long)mHisto);
     
    182187//--
    183188{
    184   if(!mHisto) return;
    185   SetLimits(mHisto->XMin(), mHisto->XMax(), mHisto->YMin() , mHisto->YMax());
    186 //  SetAxesFlags(kBoxAxes | kExtTicks | kLabels);   Ne pas faire - Reza 11/99
    187 }
    188 
    189 //++
    190 void PIHisto2D::Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax)
     189 if(!mHisto) return;
     190 SetLimits(mHisto->XMin(), mHisto->XMax(), mHisto->YMin() , mHisto->YMax());
     191}
     192
     193//++
     194void PIHisto2D::Draw(PIGraphicUC* g,double xmin,double ymin,double xmax,double ymax)
    191195//
    192196//      Dessin de l'histogramme.
     
    210214//--
    211215{
    212 
    213216if (axesFlags != kAxesNone) DrawAxes(g);
    214217
     
    228231int ncol = 0;
    229232if (mFgCol) {
    230   cmap = new PIColorMap(mCmap); ncol = cmap->NCol();
     233  cmap = new PIColorMap(mCmap);
     234  cmap->ReverseColorIndex(mRevCmap);
     235  ncol = cmap->NCol();
    231236  if(mTypDisp==3) fracmin=-1.;
    232237}
     
    261266
    262267// Plot de l'histogramme
    263 for (int i=0; i<mHisto->NBinX(); i++)
    264 for (int j=0; j<mHisto->NBinY(); j++) {
     268for(int i=0; i<mHisto->NBinX(); i++)
     269  for(int j=0; j<mHisto->NBinY(); j++) {
    265270
    266271  r_8 left0,bottom0;
     
    449454: PIScDrawWdg(par,nom,sx,sy,px,py)
    450455{
    451 if (!h2dWinArg) h2dWinArg = new H2WinArg(this);
     456if(!h2dWinArg) h2dWinArg = new H2WinArg(this);
    452457nb_h2dWinArg++;
    453458if(dbg) printf("PIH2DWdg::PIH2DWdg %lx h2dWinArg=%lx %d\n"
     
    465470{
    466471nb_h2dWinArg--;
    467 if (nb_h2dWinArg == 0) {
     472if(nb_h2dWinArg == 0) {
    468473  h2dWinArg->Hide();
    469474  delete h2dWinArg;
     
    472477if(dbg) printf("PIH2DWdg::~PIH2DWdg h2dWinArg=%lx %d\n"
    473478              ,(long)h2dWinArg,nb_h2dWinArg);
    474 if (mPih) delete mPih;
     479if(mPih) delete mPih;
    475480}
    476481
     
    481486//--
    482487{
    483 if (!histo) return;
    484 if (mPih)  delete mPih;
     488if(!histo) return;
     489if(mPih)  delete mPih;
    485490mPih = new PIHisto2D(histo, true);
    486491AddScDrawer(mPih);
     
    494499//--
    495500{
    496 if (!pih2) return;
    497 if (mPih)  delete mPih;
     501if(!pih2) return;
     502if(mPih)  delete mPih;
    498503mPih = pih2;
    499504AddScDrawer(mPih);
     
    511516char str[128];
    512517
    513 if ((!mPih) || (!mPih->Histogram())) {
     518if((!mPih) || (!mPih->Histogram())) {
    514519  sprintf(str,"X=%g Y=%g ???",x,y);
    515520  return((string)str);
     
    617622//|     et de l'histogramme.
    618623//--
    619 : PIWindow((PIMsgHandler *)par, "Options", PIWK_dialog,250,260,150,150)
     624: PIWindow((PIMsgHandler *)par,"Options",PIWK_dialog,250,260,150,150)
     625, mH2Wdg(NULL)
     626, mFgCol(false), mCmap(CMAP_GREYINV32), mRevCmap(false)
     627, mTypScal(0)  , mLogScale(10.)
     628, mTypDisp(0)  , mFPoints(0.5)
     629, mHMin(1.)    , mHMax(-1.)
     630, mFracMin(0.1), mFracMax(0.9)
    620631{
    621632string sdum;
    622633if(dbg) printf("H2WinArg::H2WinArg %lx par=%lx\n",(long)this,(long)par);
    623 
    624 mH2Wdg = NULL;
    625 
    626 // Valeurs par defaut
    627 mFgCol    = false;
    628 mCmap     = CMAP_GREYINV32;
    629 mTypScal  = 0;
    630 mTypDisp  = 0;
    631 mFPoints  = 0.5;
    632 mHMin     = 1.;
    633 mHMax     = -1.;
    634 mFracMin  = 0.1;
    635 mFracMax  = 0.9;
    636 mLogScale = 10.;
    637634
    638635// Taille automatique
     
    642639int spy = (bsy>=5) ? bsy/5 : 1;    // intervalle entre lettres Y
    643640int wszx = 5*spx+bsx+int(2.5*bsx); // Taille fenetre en X
    644 int wszy = 11*spy+8.5*bsy;           // Taille fenetre en Y
     641int wszy = 11*spy+int(8.5*bsy);    // Taille fenetre en Y
    645642SetSize(wszx, wszy);
    646643
    647644// menu du style de display des bins
    648645  int cpx = 2*spx, cpy = 2*spy;
    649 mOPop[0] = new PIOptMenu(this, "optmen-h2d-1" ,2*bsx,bsy,cpx,cpy);
    650 mOPop[0]->AppendItem("Carres Var."  , 6101);
    651 mOPop[0]->AppendItem("....."        , 6102);
    652 mOPop[0]->AppendItem(".+12..Z*"     , 6103);
    653 mOPop[0]->AppendItem("Carres Pleins", 6104);
     646mOPop[0] = new PIOptMenu(this,"optmen-h2d-1",2*bsx,bsy,cpx,cpy);
     647mOPop[0]->AppendItem("Carres Var."  ,6101);
     648mOPop[0]->AppendItem("....."        ,6102);
     649mOPop[0]->AppendItem(".+12..Z*"     ,6103);
     650mOPop[0]->AppendItem("Carres Pleins",6104);
    654651sdum = "Carres Var."; mOPop[0]->SetValueStr(sdum);
    655652mOPop[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     
    657654// Menu du choix de la dynamique
    658655  cpy += bsy+spy;
    659 mOPop[1] = new PIOptMenu(this, "optmen-h2d-2",2*bsx,bsy,cpx,cpy);
    660 mOPop[1]->AppendItem("Lineaire", 6201);
    661 mOPop[1]->AppendItem("Log10"   , 6202);
     656mOPop[1] = new PIOptMenu(this,"optmen-h2d-2",2*bsx,bsy,cpx,cpy);
     657mOPop[1]->AppendItem("Lineaire",6201);
     658mOPop[1]->AppendItem("Log10"   ,6202);
    662659sdum = "Lineaire"; mOPop[1]->SetValueStr(sdum);
    663660mOPop[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     
    665662// Menu du choix des couleurs
    666663  cpy += bsy+spy;
    667 mOPop[2] = new PIOptMenu(this, "optmen-h2d-3",2*bsx,bsy,cpx,cpy);
     664mOPop[2] = new PIOptMenu(this,"optmen-h2d-3",2*bsx,bsy,cpx,cpy);
    668665mOPop[2]->AppendItem("Black&White",7000);
    669 mCasc[0] = new PIMenu(mOPop[2]->Menu(), "PIStd-128Col");
    670 mCasc[1] = new PIMenu(mOPop[2]->Menu(), "MIDAS-CMap");
     666mCasc[0] = new PIMenu(mOPop[2]->Menu(),"PIStd-128Col");
     667mCasc[1] = new PIMenu(mOPop[2]->Menu(),"MIDAS-CMap");
    671668int kcc,nsct1=5,nsct2=9,nsct3=PIColorMap::NumberStandardColorMaps()-1;
    672669for(kcc=0; kcc<nsct1; kcc++)
     
    679676mOPop[2]->AppendPDMenu(mCasc[1]);
    680677for(kcc=nsct3; kcc<PIColorMap::NumberStandardColorMaps(); kcc++)
    681 mOPop[2]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(),7001+kcc);
     678  mOPop[2]->AppendItem(PIColorMap::GetStandardColorMapName(kcc).c_str(),7001+kcc);
    682679mOPop[2]->SetValue(7000);
    683680mOPop[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    684681
     682// Reverse color map
     683  cpy += bsy+spy;
     684mCkb = new PICheckBox(this,"Reverse CMap",8001,2*bsx,bsy,cpx,cpy);
     685mCkb->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
     686
    685687// Labels et zones de saisie texte
    686   cpy += 2*(bsy+spy);
    687 mLab[0] = new PILabel(this, "     Dyn: ",bsx,bsy,cpx,cpy);
     688  cpy += bsy+spy;
     689mLab[0] = new PILabel(this,"     Dyn: ",bsx,bsy,cpx,cpy);
    688690mLab[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    689 mText[0] = new PIText(this, "Dynamique" ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
     691mText[0] = new PIText(this,"Dynamique",int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
    690692mText[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    691693  cpy += bsy+spy;
    692 mLab[1] = new PILabel(this, "    Frac: ",bsx,bsy,cpx,cpy);
     694mLab[1] = new PILabel(this,"    Frac: ",bsx,bsy,cpx,cpy);
    693695mLab[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    694 mText[1] = new PIText(this, "Fraction"  ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
     696mText[1] = new PIText(this,"Fraction",int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
    695697mText[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    696698  cpy += bsy+spy;
    697 mLab[2] = new PILabel(this, " LogScal: ",bsx,bsy,cpx,cpy);
     699mLab[2] = new PILabel(this," LogScal: ",bsx,bsy,cpx,cpy);
    698700mLab[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    699 mText[2] = new PIText(this, "LogScale"  ,int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
     701mText[2] = new PIText(this,"LogScale",int(2.5*bsx),bsy,cpx+bsx+spx,cpy);
    700702mText[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    701 SetText();
    702703
    703704// Labels et curseur mobile
    704705cpy += bsy+spy;
    705 mLab[3] = new PILabel(this, "   PerPt: ",bsx,bsy,cpx,cpy+0.25*bsy);
     706mLab[3] = new PILabel(this,"   PerPt: ",bsx,bsy,cpx,cpy+int(0.25*bsy));
    706707mLab[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    707708mPScal = new PIScale(this,"FracPoints",6401,kSDirLtoR
    708                         ,int(2.5*bsx),1.25*bsy,cpx+bsx+spx,cpy);
     709                        ,int(2.5*bsx),int(1.25*bsy),cpx+bsx+spx,cpy);
    709710mPScal->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    710711mPScal->SetMinMax(0,100);
    711 int imfp = mFPoints*100.f; mPScal->SetValue(imfp);
     712SetText();
    712713
    713714// Boutons
    714715  cpx = 2*bsx+5*spx, cpy = 2*spy;
    715 mBut[0] = new PIButton(this, "Apply",  6001,bsx,bsy,cpx,cpy);
     716mBut[0] = new PIButton(this,"Apply",6001,bsx,bsy,cpx,cpy);
    716717mBut[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    717718  cpy += bsy+spy;
    718 mBut[1] = new PIButton(this, "Dismiss",6002,bsx,bsy,cpx,cpy);
     719mBut[1] = new PIButton(this,"Dismiss",6002,bsx,bsy,cpx,cpy);
    719720mBut[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    720721  cpy += bsy+spy;
    721 mBut[2] = new PIButton(this, "Get"  ,  6003,bsx,bsy,cpx,cpy);
     722mBut[2] = new PIButton(this,"Get",6003,bsx,bsy,cpx,cpy);
    722723mBut[2]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    723724  cpy += bsy+spy;
    724 mBut[3] = new PIButton(this, "Print",  6004,bsx,bsy,cpx,cpy);
     725mBut[3] = new PIButton(this,"Print",6004,bsx,bsy,cpx,cpy);
    725726mBut[3]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic);
    726727// FinishCreate();
     
    740741for(i=0;i<4;i++) delete mLab[i];
    741742for(i=0;i<3;i++) delete mText[i];
     743delete mCkb;
    742744delete mPScal;
    743745}
     
    758760mText[2]->SetText(str);
    759761
    760 if(mTypDisp==0)      { sdum="Carres Var.";   mOPop[0]->SetValueStr(sdum);}
    761 else if(mTypDisp==1) { sdum=".....";         mOPop[0]->SetValueStr(sdum);}
    762 else if(mTypDisp==2) { sdum=".+12..Z*";      mOPop[0]->SetValueStr(sdum);}
    763 else if(mTypDisp==3) { sdum="Carres Pleins"; mOPop[0]->SetValueStr(sdum);}
    764 
    765 if(mTypScal==0)      { sdum="Lineaire"; mOPop[1]->SetValueStr(sdum);}
    766 else if(mTypScal==1) { sdum="Log10";    mOPop[1]->SetValueStr(sdum);}
     762if(mTypDisp==0)      {sdum="Carres Var.";   mOPop[0]->SetValueStr(sdum);}
     763else if(mTypDisp==1) {sdum=".....";         mOPop[0]->SetValueStr(sdum);}
     764else if(mTypDisp==2) {sdum=".+12..Z*";      mOPop[0]->SetValueStr(sdum);}
     765else if(mTypDisp==3) {sdum="Carres Pleins"; mOPop[0]->SetValueStr(sdum);}
     766
     767if(mTypScal==0)      {sdum="Lineaire"; mOPop[1]->SetValueStr(sdum);}
     768else if(mTypScal==1) {sdum="Log10";    mOPop[1]->SetValueStr(sdum);}
    767769
    768770if(!mFgCol) {mOPop[2]->SetValue(7000);}
     
    772774      {mOPop[2]->SetValue(7001+kk); break;}
    773775}
     776mCkb->SetState(mRevCmap);
     777
     778mPScal->SetValue(int(mFPoints*100.));
    774779
    775780if(dbg)printf("H2WinArg::SetText\n");
    776 }
    777 
    778 //++
    779 void H2WinArg::GetText()
    780 //
    781 //      Gestion des fenetres de saisie de texte.
    782 //--
    783 {
    784 sscanf(mText[0]->GetText().c_str(),"%g %g",&mHMin,&mHMax);
    785 sscanf(mText[1]->GetText().c_str(),"%g %g",&mFracMin,&mFracMax);
    786 sscanf(mText[2]->GetText().c_str(),"%g",&mLogScale);
    787 if(dbg) printf("H2WinArg::GetText\n");
    788781}
    789782
     
    806799{
    807800if(dbg) printf("PIH2DWdg::Process(%d-%d , %lx ...) \n"
    808               ,(int)UserMsg(msg),(int)ModMsg(msg), (long)sender);
     801              ,(int)UserMsg(msg),(int)ModMsg(msg),(long)sender);
    809802
    810803if(!mH2Wdg) return;
     
    813806
    814807int opt = UserMsg(msg);
    815      if (opt == 6101) { mTypDisp = 0; }
    816 else if (opt == 6102) { mTypDisp = 1; }
    817 else if (opt == 6103) { mTypDisp = 2; }
    818 else if (opt == 6104) { mTypDisp = 3; }
    819 
    820 else if (opt == 6201) { mTypScal = 0; }
    821 else if (opt == 6202) { mTypScal = 1; }
    822 
    823 else if (opt == 7000) { mFgCol = false; }
    824 
    825 else if (opt >= 7001 && opt <8000) {
     808     if(opt == 6101) {mTypDisp = 0;}
     809else if(opt == 6102) {mTypDisp = 1;}
     810else if(opt == 6103) {mTypDisp = 2;}
     811else if(opt == 6104) {mTypDisp = 3;}
     812
     813else if(opt == 6201) {mTypScal = 0;}
     814else if(opt == 6202) {mTypScal = 1;}
     815
     816else if(opt == 7000) {mFgCol = false;}
     817
     818else if(opt >= 7001 && opt <8000) {
    826819  int k  = opt-7001;
    827820  mFgCol = true;
     
    829822}
    830823
    831 else if (opt == 6401) mFPoints = mPScal->GetValue()/100.;
    832 
    833 else if (opt==6001) {
    834   GetText();
    835   mpih->UseColors(mFgCol, mCmap);
     824else if(opt == 8001) mRevCmap = mCkb->GetState();
     825
     826else if(opt == 6401) mFPoints = mPScal->GetValue()/100.;
     827
     828else if(opt==6001) {
     829  sscanf(mText[0]->GetText().c_str(),"%g %g",&mHMin,&mHMax);
     830  sscanf(mText[1]->GetText().c_str(),"%g %g",&mFracMin,&mFracMax);
     831  sscanf(mText[2]->GetText().c_str(),"%g",&mLogScale);
     832  mpih->UseColors(mFgCol,mCmap,mRevCmap);
    836833  mpih->UseScale(mTypScal,mLogScale);
    837834  mpih->UseDisplay(mTypDisp,mFPoints);
     
    840837  mH2Wdg->Refresh();  // On rafraichit le dessin (tout le PIScDrawWdg)
    841838}
    842 else if (opt==6002) {
    843   this->Hide();
    844 }
     839else if(opt==6002) this->Hide();
    845840else if (opt==6003) {
    846   mFgCol    = mpih->Color();
    847   mCmap     = mpih->ColMap();
    848   mTypScal  = mpih->TypScale();
    849   mTypDisp  = mpih->TypDisplay();
    850   mFPoints  = mpih->FPoints();
    851   mHMin     = mpih->HMin();
    852   mHMax     = mpih->HMax();
    853   mFracMin  = mpih->FMin();
    854   mFracMax  = mpih->FMax();
    855   mLogScale = mpih->LogScale();
     841  mFgCol = mpih->Color(); mCmap = mpih->ColMap();
     842                          mRevCmap = mpih->IsColMapRev();
     843  mTypScal = mpih->TypScale(); mLogScale = mpih->LogScale();
     844  mTypDisp = mpih->TypDisplay(); mFPoints = mpih->FPoints();
     845  mHMin = mpih->HMin(); mHMax = mpih->HMax();
     846  mFracMin = mpih->FMin(); mFracMax = mpih->FMax();
    856847  SetText();
    857848}
    858 else if (opt==6004) {
    859   mpih->Print(2);
    860 }
     849else if(opt==6004) mpih->Print(2);
    861850
    862851if(dbg) {
    863   printf("H2WinArg::Process opt=%d col=%d,%d scal=%d disp=%d npt=%g\n"
    864         ,opt,(int) mFgCol,(int) mCmap,mTypScal,mTypDisp,mFPoints);
     852  printf("H2WinArg::Process opt=%d col=%d,%d,%d scal=%d disp=%d npt=%g\n"
     853        ,opt,(int)mFgCol,(int)mCmap,(int)mRevCmap,mTypScal,mTypDisp,mFPoints);
    865854  printf("                  min,max= %g,%g frac= %g,%g logsc= %g\n"
    866855        ,mHMin,mHMax,mFracMin,mFracMax,mLogScale);
  • trunk/SophyaPI/PIext/pihisto2d.h

    r1297 r1850  
    1818class PIHisto2D : public PIDrawer {
    1919public:
    20                      PIHisto2D(Histo2D* histo, bool ad=false);
    21   virtual            ~PIHisto2D();
    22           void       UseColors(bool fg=false, CMapId cmap=CMAP_GREYINV32);
    23           void       UseScale(unsigned short type=0,float logscale=10.);
    24           void       UseDisplay(unsigned short type=0, float fnpt=0.5);
    25           void       UseDyn(float hmin=1., float hmax=-1.);
    26           void       UseFrac(float frmin=0.1, float frmax=0.9);
    27           void       Print(int lp=0);
    28   virtual void       Draw(PIGraphicUC* g,double xmin,double ymin,double xmax,double ymax);
    29   virtual void       UpdateLimits();
    30   virtual void       DrawStats(PIGraphicUC* g);
     20  PIHisto2D(Histo2D* histo, bool ad=false);
     21  virtual ~PIHisto2D();
    3122
    32   inline Histo2D*       Histogram() { return(mHisto); }
    33   inline bool           Color() { return(mFgCol); }
    34   inline CMapId         ColMap() { return(mCmap); }
    35   inline unsigned short TypScale() { return(mTypScal); }
    36   inline unsigned short TypDisplay() { return(mTypDisp); }
    37   inline float          FPoints() { return(mFPoints); }
    38   inline float          HMax() { return(mHMax);}
    39   inline float          HMin() { return(mHMin);}
    40   inline float          FMax() { return(mFracMax);}
    41   inline float          FMin() { return(mFracMin);}
    42   inline float          LogScale() { return(mLogScale);}
     23  void UseColors(bool fg=false,CMapId cmap=CMAP_GREYINV32,bool revcmap=false);
     24  void UseScale(unsigned short type=0,float logscale=10.);
     25  void UseDisplay(unsigned short type=0,float fnpt=0.5);
     26  void UseDyn(float hmin=1.,float hmax=-1.);
     27  void UseFrac(float frmin=0.1,float frmax=0.9);
     28  void Print(int lp=0);
     29
     30  virtual void Draw(PIGraphicUC* g,double xmin,double ymin,double xmax,double ymax);
     31  virtual void UpdateLimits();
     32  virtual void DrawStats(PIGraphicUC* g);
     33
     34  inline Histo2D*       Histogram()   {return(mHisto);}
     35  inline bool           Color()       {return(mFgCol);}
     36  inline CMapId         ColMap()      {return(mCmap);}
     37  inline bool           IsColMapRev() {return(mRevCmap);}
     38  inline unsigned short TypScale()    {return(mTypScal);}
     39  inline unsigned short TypDisplay()  {return(mTypDisp);}
     40  inline float          FPoints()     {return(mFPoints);}
     41  inline float          HMax()        {return(mHMax);}
     42  inline float          HMin()        {return(mHMin);}
     43  inline float          FMax()        {return(mFracMax);}
     44  inline float          FMin()        {return(mFracMin);}
     45  inline float          LogScale()    {return(mLogScale);}
    4346
    4447protected:
     
    4851  Histo2D* mHisto;
    4952  bool mAdDO;
    50   bool mFgCol;
    51   CMapId mCmap;
    52   unsigned short mTypScal;
    53   unsigned short mTypDisp;
    54   float mFPoints;
     53  bool mFgCol; CMapId mCmap; bool mRevCmap;
     54  unsigned short mTypScal; float mLogScale;
     55  unsigned short mTypDisp; float mFPoints;
    5556  float mHMin,mHMax;
    5657  float mFracMin,mFracMax;
    57   float mLogScale;
    5858};
    5959
     
    6161class PIH2DWdg : public PIScDrawWdg {
    6262public:
    63                      PIH2DWdg(PIContainerGen *par, const char *nom, int sx=300, int sy=300,
    64                               int px=0, int py=0);
    65                      ~PIH2DWdg();
     63  PIH2DWdg(PIContainerGen *par,const char *nom,int sx=300,int sy=300,int px=0,int py=0);
     64  ~PIH2DWdg();
    6665
    67   void               SetHisto(Histo2D* histo);
    68   void               SetPIHisto(PIHisto2D* pih2);
    69   inline PIHisto2D*  GetPIHisto() {return mPih;}
     66  void SetHisto(Histo2D* histo);
     67  void SetPIHisto(PIHisto2D* pih2);
    7068
    71   virtual string     GetClickText(double x, double y);
    72   virtual void       ActivateSpecializedControls();   // Pour activer des controles specifiques
    73   virtual void       But3Press(int x, int y);
     69  inline PIHisto2D* GetPIHisto() {return mPih;}
     70
     71  virtual string GetClickText(double x, double y);
     72  virtual void   ActivateSpecializedControls(); // Pour activer des controles specifiques
     73  virtual void   But3Press(int x, int y);
    7474
    7575protected:
    7676  PIHisto2D*  mPih;
    77 
    7877};
    7978
     
    8180class H2WinArg : public PIWindow {
    8281public :
    83                H2WinArg(PIH2DWdg *par);
    84                ~H2WinArg();
    85           void SetPIH2DWdg(PIH2DWdg* h2wdg);
    86           void SetText();
    87           void GetText();
    88   virtual void Process(PIMessage msg, PIMsgHandler* sender, void* data=NULL);
     82  H2WinArg(PIH2DWdg *par);
     83  ~H2WinArg();
     84
     85  void SetPIH2DWdg(PIH2DWdg* h2wdg);
     86  void SetText();
     87
     88  virtual void Process(PIMessage msg,PIMsgHandler* sender,void* data=NULL);
    8989
    9090protected:
     
    9797  PIText    * mText[3];
    9898  PIScale   * mPScal;
     99  PICheckBox* mCkb;
    99100
    100   bool mFgCol;
    101   CMapId mCmap;
    102   unsigned short mTypScal;
    103   unsigned short mTypDisp;
    104   float mFPoints;
     101  bool mFgCol; CMapId mCmap; bool mRevCmap;
     102  unsigned short mTypScal; float mLogScale;
     103  unsigned short mTypDisp; float mFPoints;
    105104  float mHMin,mHMax;
    106105  float mFracMin,mFracMax;
    107   float mLogScale;
    108106};
    109107
Note: See TracChangeset for help on using the changeset viewer.