Changeset 2250 in Sophya for trunk/SophyaPI/PIGcont
- Timestamp:
- Nov 7, 2002, 11:12:39 AM (23 years ago)
- Location:
- trunk/SophyaPI/PIGcont
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIGcont/picntools.cc
r1919 r2250 70 70 } 71 71 72 72 73 /* --Methode-- */ 73 74 void PICnTools::HidePICnTools() … … 130 131 bsy = 0.85*bsy; spy = 0.85*spy; 131 132 132 mLab[0] = new PILabel(this, " Couleurs des contours", 2*bsx, 1.25*bsy, cpx, cpy);133 mLab[0] = new PILabel(this, " Couleurs ", 2*bsx, 1.25*bsy, cpx, cpy); 133 134 mLab[0]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 134 135 … … 199 200 200 201 201 202 202 cpx = 2*spx; // current position 203 203 cpy += spy+bsy; … … 274 274 cpx = 2*spx; 275 275 cpy += spy+bsy; 276 mLab[1] = new PILabel(this, " Label des contours ", 2*bsx, 1.25*bsy, cpx, cpy);276 mLab[1] = new PILabel(this, " Labels ", 2*bsx, 1.25*bsy, cpx, cpy); 277 277 mLab[1]->SetBinding(PIBK_elastic,PIBK_elastic, PIBK_elastic,PIBK_elastic); 278 278 cpx += spx+2*bsx; … … 334 334 cpx = 2*spx; 335 335 cpy += spy+bsyo; 336 mLab[2] = new PILabel(this, " Options de calcul des contours", 3*bsx, bsy, cpx, cpy);336 mLab[2] = new PILabel(this, " params du calcul ", 3*bsx, bsy, cpx, cpy); 337 337 mLab[2]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 338 338 … … 357 357 cpx = 2*spx; 358 358 359 mLab[3] = new PILabel(this, " # Contours", bsx, bsy, cpx, cpy);359 mLab[3] = new PILabel(this, "Nombre", bsx, bsy, cpx, cpy); 360 360 mLab[3]->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); 361 361 cpx += spx+bsx; … … 484 484 mCkb[1]->SetState(mCurCDrw->IsMarkOn()); 485 485 mCkb[2]->SetState(mCurCDrw->IsLabelOn()); 486 486 if(mCkb[2]->GetState()==false){ 487 mOpt[4]->SetUnSensitive(); 488 mOpt[6]->SetUnSensitive(); 489 mOpt[7]->SetUnSensitive(); 490 }else { 491 mOpt[4]->SetSensitive(); 492 mOpt[6]->SetSensitive(); 493 mOpt[7]->SetSensitive(); 494 } 495 496 497 if(mCkb[1]->GetState()==false) { 498 mOpt[3]->SetUnSensitive(); 499 mOpt[2]->SetUnSensitive(); 500 }else{ 501 mOpt[3]->SetSensitive(); 502 mOpt[2]->SetSensitive(); 503 } 504 505 506 if(mCkb[0]->GetState()==false) 507 mOpt[5]->SetUnSensitive(); 508 else 509 mOpt[5]->SetSensitive(); 487 510 488 511 int ii,jj,kk; 489 512 PIColors fc = dr->GetGraphicAtt().GetFgColor(); 490 513 for(kk=0; kk<MYNMXCOLORS; kk++) 491 if (fc == cols[kk]) { mOpt[0]->SetValue(100+kk); break; } 514 if (fc == cols[kk]) 515 { mOpt[0]->SetValue(100+kk); break; } 516 517 492 518 CMapId cmi = dr->GetGraphicAtt().GetColMapId(); 493 if (cmi == CMAP_OTHER) mOpt[1]->SetValue(200); 494 else for(kk=0; kk<PIColorMap::NumberStandardColorMaps(); kk++) 495 if (cmi == PIColorMap::GetStandardColorMapId(kk)) { mOpt[1]->SetValue(201+kk); break; } 519 double zmin=0; 520 double zmax=1.; 521 if(mCurCDrw!=NULL){ 522 zmin = mCurCDrw->Zmin(); 523 zmax = mCurCDrw->Zmax(); 524 } 525 526 if (cmi == CMAP_OTHER) { 527 mOpt[1]->SetValue(200); 528 mCurCDrw->GetGraphicAtt().SetColMapId(CMAP_OTHER); 529 cmapv->SetColMapId(CMAP_OTHER,false, zmin , zmax,true); 530 }else for(kk=0; kk<PIColorMap::NumberStandardColorMaps(); kk++) 531 if (cmi == PIColorMap::GetStandardColorMapId(kk)) { 532 mOpt[1]->SetValue(201+kk); 533 cmapv->SetColMapId(PIColorMap::GetStandardColorMapId(kk),false, zmin , zmax,true); 534 break; 535 } 536 496 537 PIMarker mk = dr->GetGraphicAtt().GetMarker(); 497 538 for(kk=0; kk<12; kk++) … … 682 723 if (k == 0){ 683 724 mCurCDrw->GetGraphicAtt().SetColMapId(CMAP_OTHER); 684 725 cmapv->SetColMapId(CMAP_OTHER,false, zmin , zmax,true); 726 685 727 }else{ 686 728 mCurCDrw->GetGraphicAtt().SetColMapId(PIColorMap::GetStandardColorMapId(k-1)); … … 729 771 if (k == 0){ 730 772 cmapv->SetColMapId(CMAP_OTHER,false, zmin , zmax,true); 773 731 774 }else{ 775 732 776 cmapv->SetColMapId(PIColorMap::GetStandardColorMapId(k-1),false , zmin , zmax,true); 733 777 } … … 738 782 if(mCkb[0]->GetState()==false) 739 783 mOpt[5]->SetUnSensitive(); 740 else 784 else 741 785 mOpt[5]->SetSensitive(); 742 786 -
trunk/SophyaPI/PIGcont/pigncont.cc
r1919 r2250 565 565 for(int i=0 ; i<k ; i++)My_Levels[i] = ptr[i]; 566 566 } 567 //++ 568 // void SetMyLevels(vector<double>vec) 569 // Setting du tableau des niveaux des contours 570 //Inputs 571 //| 572 //| vector <double> vec : vecteur des niveaux 573 //-- 574 void 575 GNUPlotContour::SetMyLevels(vector <double> vec){ 576 577 if(My_Levels!=NULL) delete My_Levels; 578 int sz = vec.size(); 579 assert (sz>0); 580 581 My_Levels = new double[sz]; 582 for(int i=0 ; i<sz ; i++) 583 My_Levels[i] = vec[i]; 584 } 567 585 568 586 //++ … … 639 657 if(_nti!=NULL){delete _nti ; _nti=NULL;} 640 658 } 659 DeactivateControlWindow(NULL); 641 660 //if (mColorMap!=NULL){delete mColorMap; mColorMap=NULL;} 642 661 } … … 762 781 } 763 782 783 //++ 784 void PIContourDrawer::DeactivateControlWindow(PIBaseWdgGen* wdg) 785 // 786 // Desactivation de la fenetre de controle specialisee 787 //-- 788 { 789 // si wdg != NULL, c'est un Detach (Drawer detache du PIBaseWdg 790 // si wdg == NULL, c'est un delete du PIHisto2D (du PIDrawer) 791 792 PICnTools::SetCurrentBaseWdg(NULL); 793 PICnTools::SetCurrentCnDrw(NULL); 794 PICnTools::HidePICnTools(); 795 796 return; 797 } 798 764 799 765 800 /* --Methode-- */ … … 793 828 mLabelOn = false; 794 829 } 795 796 797 830 831 int PIContourDrawer::DecodeOptionString(vector<string> & opt, bool rmdecopt) 832 { 833 // inspire de int PINTuple::DecodeOptionString 834 // OP 11/2002 LAL Orsay 835 836 int ndec = opt.size(); 837 if (ndec < 1) return(0); 838 839 840 cout << " PIDrawer::DecodeOptionString : ndec = "<< ndec <<endl; 841 // On appelle d'abord le decodage de la classe PIDrawer de laquelle 842 // on herite. (Pas obligatoire) on decode donc ici les attributs de 843 // couleur, fontes ... 844 int ndec1 = PIDrawer::DecodeOptionString(opt, rmdecopt); 845 cout << " PIDrawer::DecodeOptionString apres PIDrawer::DecodeOptionString : ndec = " 846 << ndec1 <<"<>" << ndec <<endl; 847 if( ndec - ndec1 < 1 ) return(ndec1); // si tout a ete decode 848 849 vector<string> udopt; // On gardera ici les options non decodees 850 int iopt = 0; 851 ndec = opt.size(); 852 int recalc = 0; 853 for (iopt = 0 ; iopt<ndec ; iopt++){ 854 855 string sopt = opt[iopt]; 856 if( sopt.find_first_of("=") != string::npos ){ 857 // options avec = 858 string deb = sopt.substr(0,sopt.find_first_of("=")); 859 cout << " option avec = : "<<deb<<" "<<sopt<<endl; 860 if( (deb =="ncont") || (deb =="nc") ){ // # de contours 861 string fin = sopt.substr(sopt.find_first_of("=")+1 , string::npos); 862 cout <<" fin "<<fin<<endl; 863 int nlev = atoi(fin.c_str()); 864 this->SetNLevel(nlev); 865 this->SetCntLevelKind(LEVELS_NUM); 866 recalc =1; 867 }else if(deb=="niv"||deb=="lev"){ // hauteur des niveaux 868 string fin = sopt.substr(sopt.find_first_of("=")+1 , string::npos); 869 char * buff = strdup(fin.c_str()); 870 char *tmp; 871 tmp = strtok(buff,","); 872 873 if(tmp==NULL){ 874 cerr<< " PICOntourDrawer::DecodeOptionString ERREUR decodage des niveaux impossible " << buff <<endl; 875 876 }else { 877 878 vector <double> ztmp; 879 while(tmp!=NULL){ 880 ztmp.push_back(atof(tmp)); 881 tmp = strtok(NULL,","); 882 } 883 int nlev = ztmp.size(); 884 cout << " PICOntourDrawer::DecodeOptionString "<<nlev<<" niveaux decodes "<<endl; 885 this->SetCntLevelKind(LEVELS_DISCRETE); 886 this->SetNLevel(nlev); 887 this->SetMyLevels(ztmp); 888 recalc =1; 889 } 890 }else if(deb=="lstep" ){ // niveaux incrementaux : args = nombre,depart,pas 891 string fin = sopt.substr(sopt.find_first_of("=")+1 , string::npos); 892 char * buff = strdup(fin.c_str()); 893 char *tmp; 894 tmp = strtok(buff,","); 895 896 if(tmp==NULL){ 897 cerr<< " PICOntourDrawer::DecodeOptionString ERREUR decodage nvx/incr. impossible " << buff <<endl; 898 }else{ 899 900 vector <double> ztmp; 901 while(tmp!=NULL){ 902 ztmp.push_back(atof(tmp)); 903 tmp = strtok(NULL,","); 904 } 905 if(ztmp.size() !=2) { 906 cerr<< " PICOntourDrawer::DecodeOptionString ERREUR nb params incorrect(incr) " << buff <<endl; 907 }else{ 908 vector <double> zlev; 909 zlev.push_back(ztmp[1]); 910 zlev.push_back(ztmp[2]); 911 this->SetCntLevelKind(LEVELS_INCREMENTAL); 912 this->SetNLevel( (int) ztmp[0]); 913 this->SetMyLevels(zlev); 914 recalc=1; 915 } 916 } 917 918 }else{ 919 cout<<"PICOntourDrawer::DecodeOptionString ERREUR option "<<sopt<<" non reconnue "<<endl; 920 ndec--; 921 if (rmdecopt) udopt.push_back( sopt ); 922 } 923 }else{ //options sans "=" 924 if( sopt == "labon" ) 925 this->SetLabelOn(); 926 else if (sopt == "bspline" ){ 927 this->SetCntKind(CONTOUR_KIND_BSPLINE); 928 recalc = 1; 929 }else if (sopt == "3spl" ){ 930 this->SetCntKind(CONTOUR_KIND_CUBIC_SPL); 931 recalc = 1; 932 } 933 else{ 934 cout<<"PICOntourDrawer::DecodeOptionString ERREUR option "<<sopt<<" non reconnue "<<endl; 935 ndec--; 936 if (rmdecopt) udopt.push_back(sopt); 937 } 938 } 939 940 }// FIN DE LA BOUCLE SUR LES OPTIONS 941 942 if(recalc==1){ 943 // il faut (re)calculer les contours 944 cout << " PICOntourDrawer::DecodeOptionString(re)calcul des contours "<<endl; 945 this->CalcContour(); 946 } 947 this->Refresh(); 948 949 950 // 951 952 // S'il faut supprimer les options decodees, on remplace l'argument opt 953 // par le vecteur des options non decodees. 954 if (rmdecopt) opt = udopt; 955 956 return(ndec+ndec1); 957 958 } 959 960 961 -
trunk/SophyaPI/PIGcont/pigncont.h
r1919 r2250 28 28 const double *Levels(){return My_Levels;}; 29 29 void SetMyLevels(double *ptr,int k); 30 void SetMyLevels(vector <double> vec); 30 31 int NLevels(){return Contour_Levels;}; 31 32 void SetNLevel(int n){Contour_Levels=n;}; … … 35 36 void SetCntKind(t_contour_kind kind){Contour_kind = kind;}; 36 37 t_contour_kind GetCntKind(){return Contour_kind ;}; 38 37 39 38 40 NTuple * & MyIso(){return _myiso;}; … … 76 78 virtual bool IsMarkOn(); 77 79 virtual bool IsLabelOn(); 78 virtual void SetLineOn(bool );79 virtual void SetMarkOn(bool );80 virtual void SetLabelOn(bool );80 virtual void SetLineOn(bool b=true); 81 virtual void SetMarkOn(bool b=true); 82 virtual void SetLabelOn(bool b=true); 81 83 82 84 //Init attributs graphiques … … 87 89 // Methode permettant l'affichage d'une fenetre de controle specialisee 88 90 virtual void ShowControlWindow(PIBaseWdgGen* wdg); 91 // Desactivation de la fenetre de controle specialisee 92 virtual void DeactivateControlWindow(PIBaseWdgGen* wdg); 93 // Methode permettant de decoder des options a partir de chaines 94 int DecodeOptionString(vector<string> & opt, bool rmdecopt=true); 89 95 90 96
Note:
See TracChangeset
for help on using the changeset viewer.