Changeset 3342 in Sophya


Ignore:
Timestamp:
Oct 8, 2007, 9:46:38 AM (18 years ago)
Author:
ansari
Message:

Methodes GetOptionsHelpInfo() et OptionToString() code pour le traceur de contour PIContourDrawer , Reza 08/10/2007

Location:
trunk/SophyaPI/PIGcont
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaPI/PIGcont/pigncont.cc

    r2615 r3342  
    430430//--
    431431GNUPlotContour::~GNUPlotContour(){
    432  cout << " destructeur de GNUPlotContour "<<endl;
     432  //cout << " destructeur de GNUPlotContour "<<endl;
    433433 
    434434 struct iso_curve *iso_cur;
     
    516516
    517517 if(_contours) {
    518    cout << " GNUPlotContour::CalcContour(): destruction des contours "<<_contours<<endl;
     518   //cout << " GNUPlotContour::CalcContour(): destruction des contours "<<_contours<<endl;
    519519   struct gnuplot_contours *cntcur = _contours;
    520520   /******
    521521   struct gnuplot_contours *cntold;
    522522   while(cntcur) {
    523    cout << " GNUPlotContour::CalcContour(): destruction des contours "<< cntcur<<endl;
     523   //cout << " GNUPlotContour::CalcContour(): destruction des contours "<< cntcur<<endl;
    524524     cntold = cntcur;
    525525     cntcur = cntold->next;
     
    804804
    805805/* --Methode-- */
    806 bool PIContourDrawer::IsLabelOn(){
     806bool PIContourDrawer::IsLabelOn() const
     807{
    807808  return (mLabelOn);
    808809}
    809810
    810 bool PIContourDrawer::IsLineOn(){
     811bool PIContourDrawer::IsLineOn() const
     812{
    811813  return (mLineOn);
    812814}
    813815
    814 bool PIContourDrawer::IsMarkOn(){
     816bool PIContourDrawer::IsMarkOn() const
     817{
    815818  return (mMarkOn);
    816819}
    817820
    818 void PIContourDrawer::SetLabelOn(bool state){
     821void PIContourDrawer::SetLabelOn(bool state)
     822{
    819823  mLabelOn = state;
    820824}
     
    843847
    844848
    845   cout << " PIDrawer::DecodeOptionString  : ndec = "<< ndec <<endl;
     849  //  cout << " PIDrawer::DecodeOptionString  : ndec = "<< ndec <<endl;
    846850  // On appelle d'abord le decodage de la classe PIDrawer de laquelle
    847851  // on herite. (Pas obligatoire) on decode donc ici les attributs de
    848852  // couleur, fontes ...
    849853  int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt);
    850   cout << " PIDrawer::DecodeOptionString apres PIDrawer::DecodeOptionString : ndec = "
    851        << ndec1 <<"<>" << ndec <<endl;
     854  //cout << " PIDrawer::DecodeOptionString apres PIDrawer::DecodeOptionString : ndec = "
     855  //     << ndec1 <<"<>" << ndec <<endl;
    852856  if( ndec - ndec1 < 1 ) return(ndec1);  // si tout a ete decode
    853857
     
    862866      // options avec =
    863867      string deb = sopt.substr(0,sopt.find_first_of("="));
    864       cout << " option avec =  : "<<deb<<" "<<sopt<<endl;
     868      // cout << " option avec =  : "<<deb<<" "<<sopt<<endl;
    865869      if( (deb =="ncont") || (deb =="nc") ){ // # de contours
    866870        string fin =  sopt.substr(sopt.find_first_of("=")+1 , string::npos);
    867         cout <<" fin "<<fin<<endl;
     871        // cout <<" fin "<<fin<<endl;
    868872        int nlev = atoi(fin.c_str());
    869873        this->SetNLevel(nlev);
     
    887891          }
    888892          int nlev = ztmp.size();
    889           cout << "  PICOntourDrawer::DecodeOptionString "<<nlev<<" niveaux decodes "<<endl;
     893          // cout << "  PICOntourDrawer::DecodeOptionString "<<nlev<<" niveaux decodes "<<endl;
    890894          this->SetCntLevelKind(LEVELS_DISCRETE);
    891895          this->SetNLevel(nlev);
     
    929933      if( sopt == "labon" )
    930934        this->SetLabelOn();
     935      else if ( sopt == "laboff" )
     936        this->SetLabelOn(false);
     937      else if ( sopt == "autolevels" )
     938        this->SetCntLevelKind(LEVELS_AUTO);
     939      else if (sopt == "linear" ){
     940        this->SetCntKind(CONTOUR_KIND_BSPLINE);
     941        recalc = 1;
     942      }
    931943      else if (sopt == "bspline" ){
    932944        this->SetCntKind(CONTOUR_KIND_BSPLINE);
    933945        recalc = 1;
    934       }else if (sopt == "3spl" ){
     946      }else if ((sopt == "3spl" )||(sopt == "cubicspl")) {
    935947        this->SetCntKind(CONTOUR_KIND_CUBIC_SPL);
    936948        recalc = 1;
     
    963975}
    964976
    965 
    966  
     977// Methode ajoute en Oct 2007 - Reza
     978int PIContourDrawer::OptionToString(vector<string> & opt) const
     979{
     980 PIDrawer::OptionToString(opt);
     981
     982 if (GetCntKind()==CONTOUR_KIND_LINEAR)  opt.push_back("linear");
     983 else if (GetCntKind()==CONTOUR_KIND_BSPLINE)  opt.push_back("bspline");
     984 else if (GetCntKind()==CONTOUR_KIND_CUBIC_SPL)  opt.push_back("cubicspl");
     985
     986 if (IsLabelOn()) opt.push_back("labon");
     987 else opt.push_back("laboff");
     988
     989 return 1;
     990}
     991
     992void PIContourDrawer::GetOptionsHelpInfo(string& info)
     993{
     994  info += " ---- PIContourDrawer options help info : \n" ;
     995  info += " autolevels : automatic selection of levels and number of contours \n";
     996  info += " ncont=nLevel (or nc=NLevel) : sets the number of contour\n";
     997  info += " lev=v1,v2,v3... (or niv=v1,v2,v3...) set the number and levels of contours\n";
     998  info += " lstep=nLev,start,step : define incremental levels \n";
     999  info += " labon/laboff : display of contour level values on/off \n";
     1000  info += " linear/bspline/cubicspl=3spl : select contour kind \n";
     1001// On recupere ensuite la chaine info de la classe de base
     1002  PIDrawer::GetOptionsHelpInfo(info);
     1003  return;
     1004}
     1005
     1006
     1007
     1008 
  • trunk/SophyaPI/PIGcont/pigncont.h

    r2250 r3342  
    3333  int NContours(){return _npolys;};
    3434  void SetCntLevelKind(t_contour_levels_kind kind){Contour_Levels_kind = kind;};
    35   t_contour_levels_kind GetCntLevelKind(){return Contour_Levels_kind ;};
     35  t_contour_levels_kind GetCntLevelKind() const {return Contour_Levels_kind ;};
    3636  void SetCntKind(t_contour_kind kind){Contour_kind = kind;};
    37   t_contour_kind GetCntKind(){return Contour_kind ;};
     37  t_contour_kind GetCntKind() const {return Contour_kind ;};
    3838
    3939
     
    7575  virtual void      Draw(PIGraphicUC* g, double xmin, double ymin, double xmax, double ymax);
    7676  virtual void      UpdateLimits();
    77   virtual bool      IsLineOn();
    78   virtual bool      IsMarkOn()
    79   virtual bool      IsLabelOn();
     77  virtual bool      IsLineOn() const;
     78  virtual bool      IsMarkOn() const
     79  virtual bool      IsLabelOn() const;
    8080  virtual void      SetLineOn(bool b=true);
    8181  virtual void      SetMarkOn(bool b=true);
     
    9292  virtual void DeactivateControlWindow(PIBaseWdgGen* wdg);
    9393//   Methode permettant de decoder des options a partir de chaines
    94   int        DecodeOptionString(vector<string> & opt, bool rmdecopt=true);
     94  virtual int        DecodeOptionString(vector<string> & opt, bool rmdecopt=true);
     95  virtual int        OptionToString(vector<string> & opt) const;
     96//   Texte d'aide des options disponibles
     97  virtual void       GetOptionsHelpInfo(string& info);
    9598
    9699
Note: See TracChangeset for help on using the changeset viewer.