Changeset 2237 in Sophya for trunk/SophyaPI/PIext


Ignore:
Timestamp:
Oct 30, 2002, 12:54:57 AM (23 years ago)
Author:
cmv
Message:

decode option v2 cmv 30/10/2002

File:
1 edited

Legend:

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

    r2234 r2237  
    268268
    269269// gestion Couleurs.
     270PIColors fgcoul = GetGraphicAtt().GetFgColor();
     271PIColors bgcoul = GetGraphicAtt().GetBgColor();
    270272PIColorMap* cmap=NULL;
    271 PIColors coul = g->GetForeground();
    272273int ncol = 0;
    273274if (mFgCol) {
     
    280281// gestion epaisseur de ligne
    281282PILineAtt LineAtt = GetGraphicAtt().GetLineAtt();
    282 if(LineAtt == PI_NotDefLineAtt)  g->SelLine(PI_ThinLine);
     283if(LineAtt == PI_NotDefLineAtt) GetGraphicAtt().SetLineAtt(PI_ThinLine);
    283284
    284285// gestion Markers ou plot avec des points.
    285 PIMarker Mk = g->GetMarker();
    286 int MkSz = g->GetMarkerSize();
     286PIMarker Mk = GetGraphicAtt().GetMarker();
     287int MkSz = GetGraphicAtt().GetMarkerSize();
    287288int npt = 1;
    288289if(mTypDisp==1) {
     
    292293
    293294// gestion Font.
    294 PIFontAtt FontAtt = g->GetFont().GetFontAtt();
    295 int FontSize = g->GetFont().GetFontSize();
     295PIFontAtt FontAtt = GetGraphicAtt().GetFontAtt();
     296int FontSize = GetGraphicAtt().GetFontSzPt();
    296297if(mTypDisp==2) {
    297298  double dxg,dyg,dg;
     
    299300  dg =(dxg<dyg) ? dxg : dyg;
    300301  int npix = (int) (dg*0.9); if(npix<8) npix = 8;
    301   //printf("PIHisto2D::Draw_Font H dx=%g dy=%g, G dx=%g dy=%g, npix = %g,%d\n"
    302   //      ,dx,dy,dxg,dyg,dg,npix);
    303   g->SelFontSzPt(npix,PI_RomanFont);
     302  g->SelFontSzPt(npix,FontAtt);
    304303  fracmin = 0;
    305304}
    306 
    307 // Print();
    308305
    309306// Plot de l'histogramme
     
    358355    double x = left0 + dx/2.;
    359356    double y = bottom0 + dy/2.;
    360     g->DrawString(x,y,c);
     357    g->DrawString(x,y,c,PI_HorizontalCenter|PI_VerticalCenter);
    361358  } else if(mTypDisp==3) {
    362359    //..... carres de tailles fixes (avec gestion de continuite)
     
    368365
    369366// Remise dans les conditions ulterieures pour la suite du graphique.
    370 g->SelMarker(MkSz,Mk);
    371 g->SelForeground(coul);
     367GetGraphicAtt().SetMarkerAtt(MkSz,Mk);
     368GetGraphicAtt().SetColAtt(fgcoul,bgcoul);
    372369g->SelFontSzPt(FontSize,FontAtt);
    373 g->SelLine(LineAtt);
     370GetGraphicAtt().SetLineAtt(LineAtt);
    374371if (cmap) delete cmap;
    375372
     
    497494//--
    498495{
     496  // Decodage des options generales pidrawer
    499497  int optsz1 = opt.size();
    500498  if(optsz1<1) return(0);
     
    502500  if(optsz1-ndec1<1) return(ndec1);  // si tout a ete decode
    503501
     502  // Options generales pidrawer interessant le display Histo2D
     503  bool rev;
     504  if(GetGraphicAtt().GetColMapId(rev) != CMAP_OTHER) {
     505    UseColors(true,GetGraphicAtt().GetColMapId(),rev);
     506  } else UseColors(false);
     507
     508  // Decodage des options propres au display Histo2D
    504509  vector<string> udopt;  // On gardera ici les options non decodees
    505510  unsigned int k = 0;
     
    543548      if(q<opts.length()-1) sscanf(opts.substr(q+1).c_str(),"%g",&fmax);
    544549      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);
    556550   } else {
    557551      ndec--;
     
    560554    }
    561555  }
     556
    562557  // S'il faut supprimer les options decodees, on remplace l'argument opt
    563558  // par le vecteur des options non decodees.
    564559  if (rmdecopt)  opt = udopt;
     560
    565561  // Liste des options si demande
    566562  if(listopt) Print();
     563
    567564  return(ndec+ndec1);
    568565}
     
    589586info += "- h2scale=lin/log[,logscale]: choose linear or logarithmic scale\n";
    590587info += "- 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";
     588info += "- use general key to define color table (ex: grey32,midas_heat,...)\n";
     589info += "            (see general graphicatt description)\n";
     590info += "- use key \"revcmap\" to reverse color table\n";
    595591info += "- h2frac=[fmin][,fmax]: choose sub-range display [0,1]\n";
    596592return;
     
    830826 if(dbg) printf("H2WinArg::Show() mH2DDrw=%p\n",mH2DDrw);
    831827 // Pour recuperer les valeurs du Drawer sur lequel on fait ALT-O
    832  /*
    833  if(mH2DDrw) {
    834    mFgCol = mH2DDrw->Color();
    835    mCmap = mH2DDrw->ColMap(); mRevCmap = mH2DDrw->IsColMapRev();
    836    mTypScal = mH2DDrw->TypScale(); mLogScale = mH2DDrw->LogScale();
    837    mTypDisp = mH2DDrw->TypDisplay(); mFPoints = mH2DDrw->FPoints();
    838    mHMin = mH2DDrw->HMin(); mHMax = mH2DDrw->HMax();
    839    mFracMin = mH2DDrw->FMin(); mFracMax = mH2DDrw->FMax();
    840    SetText();
    841  }
    842  */
    843828 PIWindow::Show();
    844829 return;
Note: See TracChangeset for help on using the changeset viewer.