Changeset 1919 in Sophya for trunk/SophyaPI/PIGcont/picntools.cc


Ignore:
Timestamp:
Mar 6, 2002, 5:46:47 PM (24 years ago)
Author:
perderos
Message:

correction de bugs dans setting des niveaux + changement du defaut du trace
OP 06-03-2002

File:
1 edited

Legend:

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

    r1905 r1919  
    531531t_contour_levels_kind lvkind = dr->GetCntLevelKind()  ;
    532532for (ii=0 ; ii<4 ; ii++)
    533   if(crbe_algo[ii]==kind)
     533  if(lev_kind[ii]==lvkind)
    534534    {mOpt[9]->SetValue(910+ii); break;}
    535535
     
    538538sprintf(txt,"%d",nlv);
    539539mTxt[0]->SetText(txt); 
    540 // cout << " nlv "<<nlv<< endl;
     540
    541541if(dr->Levels()!=NULL){
    542542  string strg=" ";
    543543  for(int kk=0 ; kk<nlv ; kk++) {
    544     cout << " dr->Level("<<kk<<") "<<endl;
     544    //cout << " dr->Level("<<kk<<") "<<endl;
    545545    cout <<dr->Level(kk)<<endl;
    546     sprintf(txt,"%g",dr->Level(kk));
     546    if (kk!=nlv-1)
     547       sprintf(txt,"%g ,",dr->Level(kk));
     548    else
     549      sprintf(txt,"%g",dr->Level(kk));
     550
    547551    strg += txt;
    548552  }
     
    569573int k,ii,jj,kk;
    570574
    571 k = mOpt[8]->GetValue()-900; // type de ligne
     575k = mOpt[8]->GetValue()-900; // type de contour
    572576dr->SetCntKind(crbe_algo[k]);
    573577
     
    576580
    577581string str=mTxt[0]->GetText();
     582
    578583ii=atoi(str.c_str());
    579 dr->SetNLevel(ii);
     584if(ii>0)
     585  dr->SetNLevel(ii);
     586else
     587  cerr<< " PICnTools::SetCalcParm ERREUR noombre de contours <=0 "<<ii<<endl;
    580588char *buff;
    581589char *tmp;
    582590str=mTxt[1]->GetText();
     591
    583592buff=strdup(str.c_str());
    584593double * zlev=NULL;
     
    587596  zlev = new double[2];
    588597  tmp = strtok(buff,",");
     598  if(tmp ==NULL) {
     599    cerr<< " PICnTools::SetCalcParm ERREUR decodage des niveaux impossible avec " << buff <<endl;
     600    return;
     601  }
    589602  zlev[0] = atof(tmp);
     603 
    590604  tmp = strtok(NULL,",");
     605  if(tmp ==NULL) {
     606    cerr<< " PICnTools::SetCalcParm ERREUR decodage des niveaux impossible avec " << buff <<endl;
     607    return;
     608  }
    591609  zlev[1]= atof(tmp);
    592610  dr->SetMyLevels(zlev,2);
     
    596614  zlev = new double[ii];
    597615  tmp = strtok(buff,",");
     616  if(tmp ==NULL) {
     617    cerr<< " PICnTools::SetCalcParm ERREUR decodage des niveaux impossible dans  " << buff <<endl;
     618    return;
     619  }
     620  int cntr = 0;
    598621  for(jj=0 ; jj<ii ; jj++){
    599622      zlev[jj]= atof(tmp);
    600       cout << " jj "<<zlev[jj]<<endl;
    601       tmp = strtok(NULL,",");
     623      cntr++;
     624      //cout << " jj "<<zlev[jj]<<endl;
     625      tmp = strtok(NULL,"," );
     626      if(tmp == NULL) {
     627       
     628        break;
     629      }
     630      cout << " tmp = <"<<tmp<<"<"<<endl;
     631
     632  }
     633  if(cntr<ii) {
     634    cerr<< " PICnTools::SetCalcParm ERREUR decodage des niveaux "<<cntr
     635        <<" trouves sur "<<ii<<" dans " << buff <<endl;
     636    return;
     637
    602638  }
    603639  dr->SetMyLevels(zlev,ii);
     
    605641
    606642
    607 }
     643}  
    608644
    609645//
Note: See TracChangeset for help on using the changeset viewer.