Changeset 3132 in Sophya for trunk/SophyaPI/PIext/pihisto.cc


Ignore:
Timestamp:
Jan 12, 2007, 2:26:57 PM (19 years ago)
Author:
ansari
Message:

introduction methode P1DHistoWrapper::DecodeOptionString et son implementation par defaut, Reza 12/01/2007

File:
1 edited

Legend:

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

    r3125 r3132  
    99#include <typeinfo>
    1010
    11 //RZDEL #include "sopnamsp.h"
    1211#include "pihisto.h"
     12
     13//------ Implementation classe P1DHistoWrapper
     14P1DHistoWrapper::P1DHistoWrapper()
     15: mScale(1.) , mOff(0.)
     16{
     17}
     18
     19P1DHistoWrapper::~P1DHistoWrapper()
     20{
     21}
     22
     23int P1DHistoWrapper::GetStatInfoAsText(vector<string> & /* text */ )
     24{
     25  return 0;
     26}
     27
     28int P1DHistoWrapper::DecodeOptionString(vector<string> & opt, bool rmdecopt)
     29{
     30  if(opt.size() < 1) return(0);
     31
     32  vector<string> udopt;  // On gardera ici les options non decodees
     33  unsigned int k = 0;
     34  int ndec = opt.size();
     35  for( k=0; k<opt.size(); k++ ) {
     36    string & opts = opt[k];
     37    if(opts.substr(0,7) == "hs1") {
     38      mScale = 1.;  mOff = 0.;
     39    }
     40    else if(opts.substr(0,7) == "hscale=") {
     41      mScale = atof(opts.substr(7).c_str());
     42    }
     43    else if(opt[k].substr(0,8) == "hoffset=") {
     44      mOff = atof(opts.substr(8).c_str());
     45    }
     46    else {
     47      ndec--;
     48      // S'il faut supprimer les options decodees
     49      if (rmdecopt)  udopt.push_back(opts);
     50    }
     51  }
     52  // S'il faut supprimer les options decodees, on remplace l'argument opt
     53  // par le vecteur des options non decodees.
     54  if (rmdecopt)  opt = udopt;
     55  return(ndec);
     56}
     57
    1358
    1459//++
     
    212257    }
    213258  }
     259
    214260  // S'il faut supprimer les options decodees, on remplace l'argument opt
    215261  // par le vecteur des options non decodees.
    216262  if (rmdecopt)  opt = udopt;
    217   return(ndec+ndec1);
     263
     264  // Decodage des options par le histo-wrapper
     265  int ndec2 = 0;
     266  if ( ( optsz1-ndec1-ndec > 0) && (mHisto) ) {
     267    ndec2 = mHisto->DecodeOptionString(opt, rmdecopt);
     268  }
     269  return(ndec+ndec1+ndec2);
    218270}
    219271
     
    246298info += "  statposoff=OffsetX,OffsetY : Position offset for Stats drawing \n";
    247299info += "       as a fraction of total size \n";
     300info += " ---- HistoWrapper options : \n" ;
     301info += "  hscale=value  : multiplicative factor (in Y) \n" ;
     302info += "  hoffset=value : additive coefficient  (in Y) \n" ;
     303info += "  hs1 : set hscale=1 hoffset=0  (default) \n" ;
    248304// On recupere ensuite la chaine info de la classe de base
    249305PIDrawer::GetOptionsHelpInfo(info);
Note: See TracChangeset for help on using the changeset viewer.