Changeset 295 in Sophya for trunk/SophyaPI/PIext
- Timestamp:
- May 13, 1999, 12:12:51 PM (26 years ago)
- Location:
- trunk/SophyaPI/PIext
- Files:
-
- 9 added
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/SophyaPI/PIext/basexecut.cc
r293 r295 195 195 196 196 // >>>>>>>>>>> Affichage des objets 197 else if ( (kw == "disp") || (kw == "surf") ) {198 if (tokens.size() < 1) { cout << "Usage: disp/surf nameobj [opt]" << endl; return(0); }197 else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) { 198 if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); } 199 199 string opt = "n"; 200 200 if (tokens.size() > 1) opt = tokens[1]; 201 201 if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt); 202 202 else if (kw == "surf") mObjMgr->DisplaySurf3D(tokens[0], opt); 203 else if (kw == "imag") mObjMgr->DisplayImage(tokens[0], opt); 203 204 } 204 205 … … 478 479 mpiac->RegisterCommand(kw, usage, this); 479 480 481 kw = "listobjs"; 482 usage = "Prints the list of objects"; 483 usage += "\n Usage: listobjs"; 484 mpiac->RegisterCommand(kw, usage, this); 480 485 kw = "rename"; 481 486 usage = "Rename an object \n Usage: rename nameobj namenew"; … … 512 517 usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]"; 513 518 usage += "\n Related commands: surf nt2d nt3d "; 519 mpiac->RegisterCommand(kw, usage, this); 520 kw = "imag"; 521 usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]"; 522 usage += "\n Related commands: disp surf nt2d nt3d "; 514 523 mpiac->RegisterCommand(kw, usage, this); 515 524 kw = "surf"; -
trunk/SophyaPI/PIext/dlftypes.h
r293 r295 16 16 typedef double (* DlFunctionOfX) (double x); 17 17 typedef double (* DlFunctionOfXY) (double x, double y); 18 typedef int (* PlotExprFunc) ( float* x, float* rx, float* ry, float* rz, float* wt);18 typedef int (* PlotExprFunc) (double* x, double* rx, double* ry, double* rz, double* wt); 19 19 typedef void (* DlUserProcFunction) (vector<string>& args); 20 20 typedef void (* DlFunction) (); -
trunk/SophyaPI/PIext/nobjmgr.cc
r293 r295 3 3 #include <ctype.h> 4 4 5 #include <typeinfo> 5 6 #include <iostream.h> 6 7 #include <string> … … 20 21 #include "pistdimgapp.h" 21 22 22 #include "pclassids.h"23 #include "poly.h"24 #include "dvlist.h"25 23 #include "matrix.h" 26 24 #include "cvector.h" … … 29 27 #ifdef SANS_EVOLPLANCK 30 28 #include "fitsimage.h" 31 #include "zfidu.h"32 29 #endif 33 30 … … 35 32 #include "fct2dfit.h" 36 33 37 #include "pi mgadapter.h"34 #include "pisurfdr.h" 38 35 #include "pipodrw.h" 39 40 36 #include "pihisto.h" 41 37 #include "hisprof.h" 42 38 #include "pihisto2d.h" 43 39 #include "pintuple.h" 44 #include "pisurfdr.h"45 40 #include "pintup3d.h" 46 41 #include "pigfd1.h" 47 42 #include "pigfd2.h" 48 43 49 // Si le module StarReco++ a ete compile (Pour les StarList, Transfo, etc ...50 #ifdef SANS_EVOLPLANCK51 #include "pistlist.h"52 #include "transfo.h"53 #endif54 44 55 45 //++ … … 74 64 // ...... Gestion des objets nommes, variables globales ............ 75 65 struct nobj_item { 76 PPersist* obj; 66 AnyDataObj* obj; 67 NObjMgrAdapter* obja; 77 68 int num; 78 69 list<int> wrsid; … … 162 153 //-- 163 154 //++ 164 // void AddObj( PPersist* obj, string& nom)155 // void AddObj(AnyDataObj* obj, string& nom) 165 156 // Ajoute l'objet "obj" à la liste, identifié par "nom". 166 157 // Si un objet de même nom existe, l'ancien objet est renommé en concaténant … … 171 162 // Supprime l'ensemble des objets dont le nom correspond au patron "patt". 172 163 // Le patron peut contenir les caractères "*" et "?" . Les objets sont détruits si "fgd==true" 173 // PPersist* GetObj(string const& nom)164 // AnyDataObj* GetObj(string const& nom) 174 165 // Retourne l'objet identifié par "nom" dans la liste. Retourne "NULL" si "nom" n'est 175 166 // pas dans la liste. … … 182 173 183 174 /* --Methode-- */ 184 void NamedObjMgr::AddObj( PPersist* obj, string& nom)175 void NamedObjMgr::AddObj(AnyDataObj* obj, string& nom, bool) 185 176 { 186 177 … … 198 189 199 190 myNObj++; 200 if (nom.length() < 1) nom = servnobjm->PClassIdToShortClassName(obj->ClassId());191 if (nom.length() < 1) nom = typeid(*obj).name(); 201 192 NObjList::iterator it = myObjs->find(nom); 202 193 if (it != myObjs->end()) { // l'objet existe deja … … 210 201 nobj_item no; 211 202 no.obj = obj; 203 no.obja = servnobjm->GetAdapter(obj); // L'adaptateur 212 204 no.num = myNObj; 213 205 (*myObjs)[(*lastobj)] = no; 214 206 if (myImgApp) { 215 string str = (*lastobj) + " (T= " + servnobjm->PClassIdToClassName(obj->ClassId()) + ")" ;207 string str = (*lastobj) + " (T= " + typeid(*obj).name() + ")" ; 216 208 (myImgApp->ObjMgrW())->AddObj(str.c_str(), myNObj+1000); 217 209 } 218 210 219 211 cout << "NamedObjMgr::AddObj() Object " << (*lastobj) << " ( " 220 << servnobjm->PClassIdToClassName(obj->ClassId()) << " ) added (Total= " << myObjs->size() << ")" << endl;212 << typeid(*obj).name() << " ) added (Total= " << myObjs->size() << ")" << endl; 221 213 return; 222 214 } … … 234 226 (myImgApp->ObjMgrW())->DelObj((*it).second.num+1000); 235 227 } 228 delete (*it).second.obj; // destruction de l'adaptateur 236 229 if (fgd) delete (*it).second.obj; 237 230 myObjs->erase(it); … … 256 249 257 250 /* --Methode-- */ 258 PPersist* NamedObjMgr::GetObj(string const& nom)251 AnyDataObj* NamedObjMgr::GetObj(string const& nom) 259 252 { 260 253 NObjList::iterator it = myObjs->find(nom); … … 264 257 265 258 /* --Methode-- */ 259 NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string const& nom) 260 { 261 NObjList::iterator it = myObjs->find(nom); 262 if (it == myObjs->end()) return(NULL); 263 return((*it).second.obja); 264 } 265 266 /* --Methode-- */ 266 267 void NamedObjMgr::RenameObj(string const& nom, string& nomnew) 267 268 { 268 PPersist* obj = GetObj(nom);269 AnyDataObj* obj = GetObj(nom); 269 270 if (obj == NULL) return; 270 271 DelObj(nom, false); … … 309 310 if (!ok) return; 310 311 if (nobj.length()<1) nobj = servnobjm->FileName2Name(flnm); 311 AddObj(obj , nobj);312 AddObj(obj->DataObj(), nobj); 312 313 return; 313 314 } … … 336 337 if (!ok) return; 337 338 nom = ""; 338 AddObj(obj , nom);339 AddObj(obj->DataObj(), nom); 339 340 } 340 341 … … 353 354 ok = false; 354 355 } ENDTRY; 355 if (ok) AddObj(obj , nom);356 if (ok) AddObj(obj->DataObj(), nom); 356 357 } 357 358 … … 376 377 if (obj) { 377 378 string nom = servnobjm->FileName2Name(flnm); 378 AddObj(obj , nom);379 AddObj(obj->DataObj(), nom); 379 380 } 380 381 else ReadObj((*ppin), -1); … … 404 405 if (ok) { 405 406 if (nobj.length()<1) nobj = servnobjm->FileName2Name(flnm); 406 AddObj(( PPersist*)obj, nobj);407 AddObj((AnyDataObj*)obj, nobj); 407 408 } 408 409 return; … … 414 415 void NamedObjMgr::SaveObj(string const& nom, POutPersist& s) 415 416 { 416 PPersist* obj=NULL;417 obj = GetObj(nom);418 if (obj == NULL) return;417 NObjMgrAdapter* obja=NULL; 418 obja = GetObjAdapter(nom); 419 if (obja == NULL) return; 419 420 printf("NamedObjMgr::SaveObj(%s, ) (Type=%s) \n", 420 nom.c_str(), servnobjm->PClassIdToClassName(obj->ClassId())); 421 string nm = nom; // A cause de const 422 obj->Write(s, key_for_write, nm); 423 key_for_write++; 421 nom.c_str(), typeid(*(obja->GetDataObj())).name()); 422 obja->SavePPF(s, nom); 424 423 return; 425 424 } … … 446 445 void NamedObjMgr::SaveFits(string const& nom, string const & flnm) 447 446 { 448 449 #ifndef SANS_EVOLPLANCK 450 printf("NamedObjMgr::SaveFITS( NON-Disponible EVOL-PLANCK) \n"); 451 return; 452 453 #else 454 455 PPersist* obj=NULL; 456 obj = GetObj(nom); 457 if (obj == NULL) return; 458 int cid = obj->ClassId(); 459 if ( (cid < ClassId_Image) && ( cid > ClassId_Image+kr_8) ) { 460 printf("NamedObjMgr::SaveFits(%s, ) Error - Object is NOT an image (type=%s) \n", 461 nom.c_str(), servnobjm->PClassIdToClassName(obj->ClassId()) ); 462 return; 463 } 464 465 RzImage* pim = (RzImage*)obj; 466 TRY { 467 switch (pim->PixelType()) { 468 case kuint_2: 469 { 470 FitsImageU2 imgfits(*pim); 471 imgfits.Save(flnm); 472 } 473 break; 474 case kint_2: 475 { 476 FitsImageI2 imgfits(*pim); 477 imgfits.Save(flnm); 478 } 479 break; 480 case kint_4: 481 { 482 FitsImageI4 imgfits(*pim); 483 imgfits.Save(flnm); 484 } 485 break; 486 case kr_4: 487 { 488 FitsImageR4 imgfits(*pim); 489 imgfits.Save(flnm); 490 } 491 break; 492 default : 493 printf("NamedObjMgr::SaveObj()/Error Type d'image (%d) NON supporte en FITS \n", 494 (int)pim->PixelType()); 495 break; 496 } 497 } CATCH(merr) { 498 printf("NamedObjMgr::SaveObj()/Error Exception= %ld (%s) \n", (long)merr, PeidaExc(merr)); 499 } ENDTRY; 500 501 #endif 502 447 NObjMgrAdapter* obja=NULL; 448 obja = GetObjAdapter(nom); 449 if (obja == NULL) return; 450 obja->SaveFits(flnm); 503 451 return; 504 452 } … … 509 457 { 510 458 int k; 511 PPersist* obj=NULL;459 AnyDataObj* obj=NULL; 512 460 string ctyp; 513 461 char strg[256]; 514 int cid;515 462 516 463 cout << "NamedObjMgr::ListObjs() NObjs= " << myObjs->size() << "\n" ; … … 519 466 obj = (*it).second.obj; 520 467 521 cid = obj->ClassId(); 522 ctyp = servnobjm->PClassIdToClassName(cid); 523 sprintf(strg, "%2d/ %16s : %s", k, servnobjm->PClassIdToClassName(obj->ClassId()), ((*it).first).c_str()); 468 ctyp = typeid(*obj).name(); 469 sprintf(strg, "%2d/ %16s : %s", k, typeid(*obj).name(), ((*it).first).c_str()); 524 470 ctyp = strg; 525 471 cout << ctyp << "\n" ; … … 533 479 void NamedObjMgr::PrintObj(string const& nom) 534 480 { 535 PPersist* obj=GetObj(nom); 536 if (obj == NULL) { 537 cout << "NamedObjMgr::PrintObj() Error , Pas d'objet de nom " << nom << endl; 538 return; 539 } 540 541 int cid = obj->ClassId(); 542 string ctyp = servnobjm->PClassIdToClassName(cid); 543 544 cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp 545 << "Cid= " << cid << ")" << endl; 546 547 int i4dum; 548 switch (cid) { 549 case ClassId_Poly1 : 550 ((Poly*)obj)->Print(cout); 551 break; 552 case ClassId_Poly2 : 553 ((Poly2*)obj)->Print(cout); 554 break; 555 case ClassId_Matrix : 556 case ClassId_Vector : 557 cout << *((Matrix*)obj); 558 break; 559 560 case ClassId_DVList : 561 ((DVList*)obj)->Print(); 562 break; 563 564 case ClassId_Histo1D : 565 ((Histo*)obj)->Print(60); 566 break; 567 case ClassId_Histo2D : 568 ((Histo2D*)obj)->Print(); 569 break; 570 case ClassId_HProf : 571 ((HProf*)obj)->Print(60); 572 break; 573 case ClassId_NTuple : 574 cout << ((NTuple*)obj)->Info(); 575 cout << *((NTuple*)obj); 576 break; 577 case ClassId_GeneralFitData : 578 ((GeneralFitData*)obj)->PrintStatus(); 579 i4dum = ((GeneralFitData*)obj)->NData(); 580 if(i4dum>0) { 581 ((GeneralFitData*)obj)->PrintData(0); 582 ((GeneralFitData*)obj)->PrintData(i4dum-1); 583 } 584 break; 585 586 case ClassId_Image : 587 case ClassId_Image + kuint_1 : 588 case ClassId_Image + kint_1 : 589 case ClassId_Image + kuint_2 : 590 case ClassId_Image + kint_2 : 591 case ClassId_Image + kuint_4 : 592 case ClassId_Image + kint_4 : 593 case ClassId_Image + kr_4 : 594 case ClassId_Image + kr_8 : 595 ((RzImage*)obj)->Print(); 596 break; 597 598 #ifdef SANS_EVOLPLANCK 599 case ClassId_ZFidu : 600 ((ZFidu*)obj)->Print(); 601 break; 602 603 case ClassId_StarList : 604 ((StarList*)obj)->Print(10, 1, 50); 605 break; 606 case ClassId_Transfo : 607 ((Transfo*)obj)->Print(cout); 608 break; 609 case ClassId_PSF : 610 break; 611 612 case ClassId_Star + BStar_Type : 613 case ClassId_Star + RzStar_Type : 614 case ClassId_Star + PSFStar_Type : 615 case ClassId_Star + MCStar_Type : 616 case ClassId_Star + CircRFixStar_Type : 617 case ClassId_Star + PSFDHStar_Type : 618 case ClassId_Star + PSFSEStar_Type : 619 case ClassId_Star + MCDHStar_Type : 620 ((BStar*)obj)->Print(1); 621 break; 622 #endif 623 624 // - Ajout objet PPF 625 default: 626 break; 627 } 628 cout << endl; 481 NObjMgrAdapter* obja=NULL; 482 obja = GetObjAdapter(nom); 483 if (obja == NULL) return; 484 485 string ctyp = typeid(*obja->GetDataObj()).name(); 486 cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp << endl; 487 obja->Print(cout); 488 629 489 return; 630 490 } … … 633 493 void NamedObjMgr::DisplayObj(string const& nom, string dopt) 634 494 { 635 PPersist* obj=GetObj(nom); 636 if (obj == NULL) { 495 NObjMgrAdapter* obja=NULL; 496 obja = GetObjAdapter(nom); 497 if (obja == NULL) { 637 498 cout << "NamedObjMgr::DisplayObj() Error , Pas d'objet de nom " << nom << endl; 638 499 return; … … 640 501 if (!myImgApp) return; 641 502 642 int cid = obj->ClassId(); 643 string ctyp = servnobjm->PClassIdToClassName(cid); 503 PIDrawer * dr = NULL; 504 P2DArrayAdapter* arr = NULL; 505 dr = obja->GetDrawer(dopt); 506 if (!dr) arr = obja->Get2DArray(dopt); 507 508 if (!dr && !arr) { 509 string ctyp = typeid(*(obja->GetDataObj())).name(); 510 cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 511 return; 512 } 644 513 645 514 int wrsid = 0; 646 515 bool fgsr = true; 647 // On veut tracer une ligne pour vecteur et histo1D par defaut648 if ( (cid == ClassId_Vector) || (cid == ClassId_Histo1D) ) dopt = "thinline," + dopt;649 else if(cid == ClassId_HProf) dopt = "fcirclemarker5," + dopt;650 516 int opt = servnobjm->DecodeDispOption(dopt, fgsr); 651 517 652 switch (cid) { 653 case ClassId_Poly1 : 654 case ClassId_Poly2 : 655 case ClassId_DVList : 656 cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 657 break; 658 659 case ClassId_Matrix : 660 { 661 wrsid = myImgApp->DispImage(new POMatrixAdapter((Matrix*)obj, false), nom, opt); 662 break; 663 } 664 case ClassId_Vector : 665 { 666 PIYfXDrawer* dr = new PIYfXDrawer( new POVectorAdapter((Vector*)obj, false), NULL, true); 667 wrsid = myImgApp->DispScDrawer( (PIDrawer*)dr, nom, opt); 668 break; 669 } 670 case ClassId_Histo1D : 671 { 672 PIHisto* pih = new PIHisto(((Histo*)obj), false); 673 wrsid = myImgApp->DispScDrawer( (PIDrawer*)pih, nom, opt); 674 break; 675 } 676 case ClassId_Histo2D : 677 { 678 PIHisto2D* pih2 = new PIHisto2D(((Histo2D*)obj), false); 679 wrsid = myImgApp->DispScDrawer( (PIDrawer*)pih2, nom, opt, nom, true); 680 break; 681 } 682 case ClassId_HProf : 683 { 684 PIHisto* pihp = new PIHisto(((Histo*)obj), false); 685 wrsid = myImgApp->DispScDrawer( (PIDrawer*)pihp, nom, opt); 686 break; 687 } 688 case ClassId_GeneralFitData : 689 { 690 GeneralFitData* gfd = (GeneralFitData*)obj; 691 if(gfd->NVar()==1) { 692 PIGenFitDat* pigfd = new PIGenFitDat(gfd,false); 693 wrsid = myImgApp->DispScDrawer((PIDrawer*)pigfd,nom,opt); 694 } else if(gfd->NVar()==2) { 695 PIGenFitDat3D* pigfd = new PIGenFitDat3D(gfd,false); 696 wrsid = myImgApp->Disp3DDrawer(pigfd,nom,opt); 697 } else { 698 cout<<"NamedObjMgr::DisplayObj() Error , Utilisez DisplayGFD pour GeneralFitData " 699 <<ctyp<<"\n de "<<gfd->NVar()<<" variables (!=1,2)"<<endl; 700 } 701 break; 702 } 703 704 case ClassId_NTuple : 705 cout << "NamedObjMgr::DisplayObj() Error , Utilisez DisplayNt pour NTuple " << ctyp << endl; 706 break; 707 708 case ClassId_Image : 709 case ClassId_Image + kuint_1 : 710 case ClassId_Image + kint_1 : 711 case ClassId_Image + kr_8 : 712 case ClassId_Image + kuint_4 : 713 wrsid = myImgApp->DispImage(new RzImageAdapter((RzImage*)obj, false), nom, opt); 714 break; 715 case ClassId_Image + kuint_2 : 716 wrsid = myImgApp->DispImage(new ImageAdapter<uint_2>((ImageU2*)obj, false), nom, opt); 717 break; 718 case ClassId_Image + kint_2 : 719 wrsid = myImgApp->DispImage(new ImageAdapter<int_2>((ImageI2*)obj, false), nom, opt); 720 break; 721 case ClassId_Image + kint_4 : 722 wrsid = myImgApp->DispImage(new ImageAdapter<int_4>((ImageI4*)obj, false), nom, opt); 723 break; 724 case ClassId_Image + kr_4 : 725 wrsid = myImgApp->DispImage(new ImageAdapter<r_4>((ImageR4*)obj, false), nom, opt); 726 break; 727 728 #ifdef SANS_EVOLPLANCK 729 case ClassId_ZFidu : 730 { 731 int nx = ((ZFidu*)obj)->XMax() - ((ZFidu*)obj)->XMin(); 732 int ny = ((ZFidu*)obj)->YMax() - ((ZFidu*)obj)->YMin(); 733 if (nx > 1024) nx = 1024; 734 if (ny > 1024) ny = 1024; 735 if (nx < 128) nx = 128; 736 if (ny < 128) nx = 128; 737 ImageU2* msk = ((ZFidu*)obj)->MakeBadZoneMask(nx, ny); 738 myImgApp->DispImage(new ImageAdapter<uint_2>((ImageU2*)msk, true), nom, opt); 739 break; 740 } 741 742 case ClassId_StarList : 743 { 744 PIStarList* pist = new PIStarList(((StarList*)obj), false); 745 wrsid = myImgApp->DispScDrawer( (PIDrawer*)pist, nom, opt); 746 break; 747 } 748 749 case ClassId_Transfo : 750 case ClassId_PSF : 751 case ClassId_Star + BStar_Type : 752 case ClassId_Star + RzStar_Type : 753 case ClassId_Star + PSFStar_Type : 754 case ClassId_Star + MCStar_Type : 755 case ClassId_Star + CircRFixStar_Type : 756 case ClassId_Star + PSFDHStar_Type : 757 case ClassId_Star + PSFSEStar_Type : 758 case ClassId_Star + MCDHStar_Type : 759 cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl; 760 break; 761 #endif 762 763 // - Ajout objet PPF 764 default: 765 break; 766 } 518 if (dr) { 519 PIDrawer3D * dr3 = dynamic_cast<PIDrawer3D *>(dr); 520 if(dr3) wrsid = myImgApp->Disp3DDrawer(dr3, nom, opt); 521 else wrsid = myImgApp->DispScDrawer( dr, nom, opt); 522 } 523 else if (arr) wrsid = myImgApp->DispImage(arr, nom, opt); 767 524 768 525 if(wrsid != 0) { … … 775 532 } 776 533 534 /* --Methode-- */ 535 void NamedObjMgr::DisplayImage(string const& nom, string dopt) 536 { 537 NObjMgrAdapter* obja=NULL; 538 obja = GetObjAdapter(nom); 539 if (obja == NULL) { 540 cout << "NamedObjMgr::DisplayImage() Error , Pas d'objet de nom " << nom << endl; 541 return; 542 } 543 if (!myImgApp) return; 544 545 P2DArrayAdapter* arr = obja->Get2DArray(dopt); 546 547 if (!arr) { 548 string ctyp = typeid(*(obja->GetDataObj())).name(); 549 cout << "NamedObjMgr::DisplayImage() Error , Non supporte pour " << ctyp << endl; 550 return; 551 } 552 553 int wrsid = 0; 554 bool fgsr = true; 555 int opt = servnobjm->DecodeDispOption(dopt, fgsr); 556 wrsid = myImgApp->DispImage(arr, nom, opt); 557 558 if(wrsid != 0) { 559 NObjList::iterator it = myObjs->find(nom); 560 if (it == myObjs->end()) return; 561 (*it).second.wrsid.push_back(wrsid); 562 } 563 if (fgsr) myImgApp->RestoreGraphicAtt(); 564 return; 565 } 566 /* --Methode-- */ 567 void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt) 568 { 569 NObjMgrAdapter* obja=NULL; 570 obja = GetObjAdapter(nom); 571 if (obja == NULL) { 572 cout << "NamedObjMgr::DisplayImage() Error , Pas d'objet de nom " << nom << endl; 573 return; 574 } 575 if (!myImgApp) return; 576 577 P2DArrayAdapter* arr = obja->Get2DArray(dopt); 578 579 if (!arr) { 580 string ctyp = typeid(*(obja->GetDataObj())).name(); 581 cout << "NamedObjMgr::DisplaySurf3D() Error , Non supporte pour " << ctyp << endl; 582 return; 583 } 584 585 if ((arr->XSize() > 250) || (arr->YSize() > 250)) { 586 cout << "NamedObjMgr::DisplaySurf3D() Error , 2D-Array(" << arr->XSize() 587 << "x" << arr->YSize() << ") trop grand (max=250x250)" << endl; 588 delete arr; 589 return; 590 } 591 592 int wrsid = 0; 593 bool fgsr = true; 594 int opt = servnobjm->DecodeDispOption(dopt, fgsr); 595 PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true); 596 wrsid = myImgApp->Disp3DDrawer(sdr, nom, opt); 597 if(wrsid >= 0) { 598 NObjList::iterator it = myObjs->find(nom); 599 if (it == myObjs->end()) return; 600 (*it).second.wrsid.push_back(wrsid); 601 } 602 603 if (fgsr) myImgApp->RestoreGraphicAtt(); 604 return; 605 } 777 606 778 607 /* --Methode-- */ … … 780 609 string& erx, string& ery, string& erz, string dopt) 781 610 { 782 PPersist* obj=GetObj(nom);611 AnyDataObj* obj=GetObj(nom); 783 612 if (obj == NULL) { 784 613 cout << "NamedObjMgr::DisplayNT() Error , Pas d'objet de nom " << nom << endl; … … 787 616 if (!myImgApp) return; 788 617 789 int cid = obj->ClassId(); 790 if (cid != ClassId_NTuple) { 791 string ctyp = servnobjm->PClassIdToClassName(cid); 618 if (typeid(*obj) != typeid(NTuple)) { 619 string ctyp = typeid(*obj).name(); 792 620 cout << "NamedObjMgr::DisplayNT() Error , Objet n'est pas un NTuple " << ctyp << endl; 793 621 return; … … 837 665 //| opt = options generales pour le display. 838 666 { 839 PPersist* obj=GetObj(nom);667 AnyDataObj* obj=GetObj(nom); 840 668 if(obj == NULL) 841 669 {cout << "NamedObjMgr::DisplayGFD() Error , Pas d'objet de nom " << nom << endl; 842 670 return;} 843 671 if(!myImgApp) return; 844 int cid = obj->ClassId(); 845 if(cid != ClassId_GeneralFitData) 846 {string ctyp = servnobjm->PClassIdToClassName(cid); 672 if(typeid(*obj) != typeid(GeneralFitData)) 673 {string ctyp = typeid(*obj).name(); 847 674 cout<<"NamedObjMgr::DisplayGFD() Error , Objet n'est pas un GeneralFitData "<<ctyp<<endl; 848 675 return;} … … 894 721 895 722 896 /* --Methode-- */897 void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt)898 {899 PPersist* obj=GetObj(nom);900 if (obj == NULL) {901 cout << "NamedObjMgr::DisplaySurf3D() Error , Pas d'objet de nom " << nom << endl;902 return;903 }904 if (!myImgApp) return;905 906 int cid = obj->ClassId();907 908 909 P2DArrayAdapter* arr=NULL;910 switch (cid) {911 case ClassId_Matrix :912 arr = new POMatrixAdapter((Matrix*)obj, false);913 break;914 case ClassId_Histo2D :915 arr = new POH2DAdapter((Histo2D*)obj, false);916 break;917 case ClassId_Image :918 case ClassId_Image + kuint_1 :919 case ClassId_Image + kint_1 :920 case ClassId_Image + kr_8 :921 case ClassId_Image + kuint_4 :922 arr = new RzImageAdapter((RzImage*)obj, false);923 break;924 case ClassId_Image + kuint_2 :925 arr = new ImageAdapter<uint_2>((ImageU2*)obj, false);926 break;927 case ClassId_Image + kint_2 :928 arr = new ImageAdapter<int_2>((ImageI2*)obj, false);929 break;930 case ClassId_Image + kint_4 :931 arr = new ImageAdapter<int_4>((ImageI4*)obj, false);932 break;933 case ClassId_Image + kr_4 :934 arr = new ImageAdapter<r_4>((ImageR4*)obj, false);935 break;936 937 default :938 cout << "NamedObjMgr::DisplaySurf3D() Error , Pas de display pour " << servnobjm->PClassIdToClassName(cid) << endl;939 return;940 }941 942 if (!arr) return;943 if ((arr->XSize() > 250) || (arr->YSize() > 250)) {944 cout << "NamedObjMgr::DisplaySurf3D() Error , 2D-Array(" << arr->XSize()945 << "x" << arr->YSize() << ") trop grand (max=250x250)" << endl;946 delete arr;947 return;948 }949 950 int wrsid = 0;951 bool fgsr = true;952 int opt = servnobjm->DecodeDispOption(dopt, fgsr);953 if (cid == ClassId_Histo2D) arr->DefineXYCoordinates(0., 0., 1., 1.);954 PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true);955 wrsid = myImgApp->Disp3DDrawer(sdr, nom, opt);956 if(wrsid >= 0) {957 NObjList::iterator it = myObjs->find(nom);958 if (it == myObjs->end()) return;959 (*it).second.wrsid.push_back(wrsid);960 }961 962 if (fgsr) myImgApp->RestoreGraphicAtt();963 return;964 }965 723 966 724 … … 984 742 string& expcut, string dopt) 985 743 { 986 PPersist* obj=GetObj(nom); 987 if (obj == NULL) { 744 NObjMgrAdapter* obja=NULL; 745 obja = GetObjAdapter(nom); 746 if (obja == NULL) { 988 747 cout << "NamedObjMgr::DisplayPoints2D() Error , Pas d'objet de nom " << nom << endl; 989 748 return; 990 }749 } 991 750 if (!myImgApp) return; 992 751 … … 999 758 else { haserr = false; experrx = experry = "0."; nt = new NTuple(2, ntn); } 1000 759 1001 servnobjm->Nobj_ComputeExpressions(obj , expx, expy, experrx, experry, expcut, nt, NULL, NULL);760 servnobjm->Nobj_ComputeExpressions(obja, expx, expy, experrx, experry, expcut, nt, NULL, NULL); 1002 761 1003 762 if (nt->NEntry() < 1) { … … 1025 784 string& expcut, string dopt) 1026 785 { 1027 PPersist* obj=GetObj(nom); 1028 if (obj == NULL) { 786 NObjMgrAdapter* obja=NULL; 787 obja = GetObjAdapter(nom); 788 if (obja == NULL) { 1029 789 cout << "NamedObjMgr::DisplayPoints3D() Error , Pas d'objet de nom " << nom << endl; 1030 790 return; … … 1036 796 1037 797 string expwt = "1."; 1038 servnobjm->Nobj_ComputeExpressions(obj , expx, expy, expz, expwt, expcut, nt, NULL, NULL);798 servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, expwt, expcut, nt, NULL, NULL); 1039 799 1040 800 if (nt->NEntry() < 1) { … … 1064 824 void NamedObjMgr::ProjectH1(string const& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt) 1065 825 { 1066 PPersist* obj=GetObj(nom);1067 1068 if (obj == NULL) {826 NObjMgrAdapter* obja=NULL; 827 obja = GetObjAdapter(nom); 828 if (obja == NULL) { 1069 829 cout << "NamedObjMgr::ProjectH1() Error , Pas d'objet de nom " << nom << endl; 1070 830 return; … … 1074 834 Histo* h1 = NULL; 1075 835 NTuple* nt = NULL; 1076 PPersist* oh = NULL;836 AnyDataObj* oh = NULL; 1077 837 if (nomh1.length() > 0) oh=GetObj(nomh1); 1078 838 else nomh1 = "H1Proj"; 1079 if ( (oh != NULL) && ( oh->ClassId() == ClassId_Histo1D) ) h1 = (Histo*)oh; // Pas de remise a zero ! h1->Zero();839 if ( (oh != NULL) && (typeid(*oh) == typeid(Histo)) ) h1 = (Histo*)oh; // Pas de remise a zero ! h1->Zero(); 1080 840 else { 1081 841 char* ntn[2]= {"hxval", "hwt"}; … … 1083 843 } 1084 844 string expz = "0."; 1085 servnobjm->Nobj_ComputeExpressions(obj , expx, expwt, expz, expwt, expcut, nt, h1, NULL);845 servnobjm->Nobj_ComputeExpressions(obja, expx, expwt, expz, expwt, expcut, nt, h1, NULL); 1086 846 1087 847 if ((!h1) && (!nt)) return; … … 1113 873 string& nomh2, string dopt) 1114 874 { 1115 PPersist* obj=GetObj(nom);1116 1117 if (obj == NULL) {875 NObjMgrAdapter* obja=NULL; 876 obja = GetObjAdapter(nom); 877 if (obja == NULL) { 1118 878 cout << "NamedObjMgr::ProjectH2() Error , Pas d'objet de nom " << nom << endl; 1119 879 return; … … 1123 883 Histo2D* h2 = NULL; 1124 884 NTuple* nt = NULL; 1125 PPersist* oh = NULL;885 AnyDataObj* oh = NULL; 1126 886 if (nomh2.length() > 0) oh=GetObj(nomh2); 1127 887 else nomh2 = "H2Proj"; 1128 if ( (oh != NULL) && ( oh->ClassId() == ClassId_Histo2D) ) h2 = (Histo2D*)oh; // Pas de remise a zero ! h2->Zero();888 if ( (oh != NULL) && (typeid(*oh) == typeid(Histo2D)) ) h2 = (Histo2D*)oh; // Pas de remise a zero ! h2->Zero(); 1129 889 else { 1130 890 char* ntn[3]= {"hxval", "hyval", "hwt"}; … … 1132 892 } 1133 893 string expz = "0."; 1134 servnobjm->Nobj_ComputeExpressions(obj , expx, expy, expwt, expwt, expcut, nt, NULL, h2);894 servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, nt, NULL, h2); 1135 895 1136 896 if ((!h2) && (!nt)) return; … … 1174 934 //| opt = options generales pour le display. 1175 935 { 1176 PPersist* obj=GetObj(nom);1177 1178 if (obj == NULL) {936 NObjMgrAdapter* obja=NULL; 937 obja = GetObjAdapter(nom); 938 if (obja == NULL) { 1179 939 cout << "NamedObjMgr::ProjectHProf() Error , Pas d'objet de nom " << nom << endl; 1180 940 return; … … 1184 944 HProf* hprof = NULL; 1185 945 NTuple* nt = NULL; 1186 PPersist* oh = NULL;946 AnyDataObj* oh = NULL; 1187 947 if (nomprof.length() > 0) oh=GetObj(nomprof); 1188 948 else nomprof = "ProfProj"; 1189 if( (oh!=NULL) && ( oh->ClassId()== ClassId_HProf) ) hprof = (HProf*)oh;949 if( (oh!=NULL) && (typeid(*oh) == typeid(HProf)) ) hprof = (HProf*)oh; 1190 950 else { 1191 951 char* ntn[3]= {"hxval", "hyval", "hwt"}; … … 1193 953 } 1194 954 string expz = "0."; 1195 servnobjm->Nobj_ComputeExpressions(obj , expx, expy, expwt, expwt, expcut, nt, NULL, NULL, hprof);955 servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, nt, NULL, NULL, hprof); 1196 956 1197 957 if((!hprof) && (!nt)) return; … … 1223 983 void NamedObjMgr::FillVect(string const& nom, string& expx, string& expcut, string& nomvec, string dopt) 1224 984 { 1225 PPersist* obj=GetObj(nom);1226 1227 if (obj == NULL) {985 NObjMgrAdapter* obja=NULL; 986 obja = GetObjAdapter(nom); 987 if (obja == NULL) { 1228 988 cout << "NamedObjMgr::FillVect() Error , Pas d'objet de nom " << nom << endl; 1229 989 return; … … 1239 999 string expwt = "1."; 1240 1000 string expz = "0."; 1241 servnobjm->Nobj_ComputeExpressions(obj , expx, expz, expz, expwt, expcut, nt, NULL, NULL);1001 servnobjm->Nobj_ComputeExpressions(obja, expx, expz, expz, expwt, expcut, nt, NULL, NULL); 1242 1002 1243 1003 if (!nt) return; … … 1265 1025 string& expcut, string& nomnt) 1266 1026 { 1267 PPersist* obj=GetObj(nom);1268 1269 if (obj == NULL) {1027 NObjMgrAdapter* obja=NULL; 1028 obja = GetObjAdapter(nom); 1029 if (obja == NULL) { 1270 1030 cout << "NamedObjMgr::FillNT() Error , Pas d'objet de nom " << nom << endl; 1271 1031 return; … … 1275 1035 bool fgnnt = false; 1276 1036 NTuple* nt = NULL; 1277 PPersist* oh = NULL;1037 AnyDataObj* oh = NULL; 1278 1038 if (nomnt.length() > 0) oh=GetObj(nomnt); 1279 1039 else nomnt = "NTFill"; 1280 if ( (oh != NULL) && ( oh->ClassId() == ClassId_NTuple) ) {1040 if ( (oh != NULL) && (typeid(*oh) == typeid(HProf)) ) { 1281 1041 nt = (NTuple*)oh; 1282 1042 if (nt->NVar() > 10) { … … 1291 1051 } 1292 1052 1293 servnobjm->Nobj_ComputeExpressions(obj , expx, expy, expz, expt, expcut, nt, NULL, NULL);1053 servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, expt, expcut, nt, NULL, NULL); 1294 1054 1295 1055 if (fgnnt) AddObj(nt, nomnt); … … 1311 1071 //| nomgfd = nom du GeneralFitData engendre (optionnel) 1312 1072 { 1313 PPersist* obj=GetObj(nom); 1314 if(obj == NULL) 1315 {cout<<"NamedObjMgr::FillGFD() Error , Pas d'objet de nom "<<nom<<endl; 1316 return;} 1073 NObjMgrAdapter* obja=NULL; 1074 obja = GetObjAdapter(nom); 1075 if (obja == NULL) { 1076 cout << "NamedObjMgr::FillGFD() Error , Pas d'objet de nom "<<nom<<endl; 1077 return; 1078 } 1317 1079 if(!myImgApp) return; 1318 1080 … … 1321 1083 if(expy.length()<=0) {nvar = 1; expy = "0.";} 1322 1084 1323 // Que faut-il copier dans GeneralFitData 1324 int ndata=0; 1325 int cid = obj->ClassId(); 1326 switch (cid) { 1327 case ClassId_Vector : 1328 ndata=((Vector*)obj)->NElts(); 1329 break; 1330 case ClassId_Matrix : 1331 ndata=((Matrix*)obj)->NCol()*((Matrix*)obj)->NRows(); 1332 break; 1333 case ClassId_Histo1D : 1334 case ClassId_HProf : 1335 ndata=((Histo*)obj)->NBins(); 1336 break; 1337 case ClassId_Histo2D : 1338 ndata=((Histo2D*)obj)->NBinX()*((Histo2D*)obj)->NBinY(); 1339 break; 1340 case ClassId_Image : 1341 case ClassId_Image + kuint_1 : 1342 case ClassId_Image + kint_1 : 1343 case ClassId_Image + kr_8 : 1344 case ClassId_Image + kuint_4 : 1345 case ClassId_Image + kuint_2 : 1346 case ClassId_Image + kint_2 : 1347 case ClassId_Image + kint_4 : 1348 case ClassId_Image + kr_4 : 1349 ndata=((RzImage*)obj)->XSize()*((RzImage*)obj)->YSize(); 1350 break; 1351 #ifdef SANS_EVOLPLANCK 1352 case ClassId_StarList : 1353 ndata=((StarList*)obj)->NbStars(); 1354 break; 1355 #endif 1356 case ClassId_NTuple : 1357 ndata=((NTuple*)obj)->NEntry(); 1358 break; 1359 case ClassId_GeneralFitData : 1360 ndata=((GeneralFitData*)obj)->NData(); 1361 break; 1362 default : 1363 cout<<"FillGFD Erreur: N/A to "<<servnobjm->PClassIdToClassName(cid)<<endl; 1364 return; 1365 } 1366 1367 // Nom du GeneralFitData cree. 1368 if (nomgfd.length() <= 0) nomgfd = "GFDFill"; 1369 // Consistence ndata. 1370 if(ndata<=0) 1371 {cout<<"NamedObjMgr::FillGFD() Warning ndata="<<ndata<<endl; 1372 return;} 1085 // $CHECK$ - cmv calculait le nombre d'entree ndata 1086 // en fonction de chaque objet - Je l'ai vire Reza 11/05/99 1373 1087 1374 1088 // Creation NTuple Buffer … … 1377 1091 1378 1092 // Remplissage NTuple buffer 1379 servnobjm->Nobj_ComputeExpressions(obj , expx, expy, expz, experr, expcut, nt, NULL, NULL);1093 servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, experr, expcut, nt, NULL, NULL); 1380 1094 if(nt->NEntry() < 1) 1381 1095 {cout<<"NamedObjMgr::FillGFD() Warning Zero points satisfy cut !"<<endl; … … 1383 1097 1384 1098 //Remplissage de la structure GeneraFitData 1385 GeneralFitData* gfd = new GeneralFitData(nvar,ndata,0); 1099 if (nt->NEntry() <= 0) { 1100 cout<<"NamedObjMgr::FillGFD() Warning - NData= " << nt->NEntry() << endl; 1101 delete nt; 1102 return; 1103 } 1104 1105 GeneralFitData* gfd = new GeneralFitData(nvar,nt->NEntry(),0); 1386 1106 int k; 1387 1107 float* xn; … … 1724 1444 //|2D yaa.b et y = idem "xaa.b et x" mais pour y 1725 1445 { 1726 PPersist* obj=GetObj(nom);1446 AnyDataObj* obj=GetObj(nom); 1727 1447 if (obj == NULL) { 1728 1448 cout<<"NamedObjMgr::Fit12D() Error , Pas d'objet de nom "<<nom<<endl; … … 1733 1453 {cout<<"NamedObjMgr::Fit12D() Donnez un nom de fonction a fitter."<<endl; 1734 1454 return;} 1735 int cid = obj->ClassId(); 1736 string ctyp = servnobjm->PClassIdToClassName(cid); 1455 string ctyp = typeid(*obj).name(); 1737 1456 1738 1457 int ndim = 0, nbinx=0, nbiny=0, ndata = 0; … … 1740 1459 Matrix* m = NULL; Histo2D* h2 = NULL; RzImage* im = NULL; 1741 1460 GeneralFitData* g = NULL; 1742 switch (cid) { 1461 1743 1462 // 1D 1744 case ClassId_Vector : 1745 ndim = 1; 1746 v = (Vector*) obj; nbinx = v->NElts(); nbiny = 1; 1747 break; 1748 case ClassId_HProf : 1749 case ClassId_Histo1D : 1750 ndim = 1; 1751 h = (Histo*) obj; nbinx = h->NBins(); nbiny = 1; 1752 break; 1753 // 2D 1754 case ClassId_Matrix : 1755 ndim = 2; 1756 m = (Matrix*) obj; nbinx = m->NCol(); nbiny = m->NRows(); 1757 break; 1758 case ClassId_Histo2D : 1759 ndim = 2; 1760 h2 = (Histo2D*) obj; nbinx = h2->NBinX(); nbiny = h2->NBinY(); 1761 break; 1762 // 1D ou 2D selon 1763 case ClassId_GeneralFitData : 1764 g = (GeneralFitData*) obj; nbinx = g->NData(); nbiny = 1; 1765 if( g->NVar()==1) ndim = 1; 1766 else if(g->NVar()==2) ndim = 2; 1767 else { 1768 cout<<"GeneralFitData ne peut avoir que 1 ou 2 variables d'abscisse: " 1769 <<((GeneralFitData*) obj)->NVar()<<endl; return;} 1770 break; 1771 case ClassId_Image : 1772 case ClassId_Image + kuint_1 : 1773 case ClassId_Image + kuint_2 : 1774 case ClassId_Image + kint_2 : 1775 case ClassId_Image + kint_4 : 1776 case ClassId_Image + kr_4 : 1777 case ClassId_Image + kr_8 : 1778 ndim = 2; 1779 im = (RzImage*) obj; nbinx = im->XSize(); nbiny = im->YSize(); 1780 break; 1781 default: 1782 cout<<"NamedObjMgr::Fit12D() Error , Objet n'est pas un " 1783 <<"Histo1D/HProf/Vector/Histo2D/Image/Matrix/GeneralFitData "<<ctyp<<endl; 1784 return; 1785 break; 1786 } 1463 if (typeid(*obj) == typeid(Vector)) { 1464 ndim = 1; 1465 v = (Vector*) obj; nbinx = v->NElts(); nbiny = 1; 1466 } 1467 else if ( (typeid(*obj) == typeid(HProf)) || (typeid(*obj) == typeid(Histo)) ) { 1468 ndim = 1; 1469 h = (Histo*) obj; nbinx = h->NBins(); nbiny = 1; 1470 } 1471 else if (typeid(*obj) == typeid(Matrix)) { 1472 ndim = 2; 1473 m = (Matrix*) obj; nbinx = m->NCol(); nbiny = m->NRows(); 1474 } 1475 else if (typeid(*obj) == typeid(Histo2D)) { 1476 ndim = 2; 1477 h2 = (Histo2D*) obj; nbinx = h2->NBinX(); nbiny = h2->NBinY(); 1478 } 1479 else if (typeid(*obj) == typeid(GeneralFitData)) { 1480 g = (GeneralFitData*) obj; nbinx = g->NData(); nbiny = 1; 1481 if( g->NVar()==1) ndim = 1; 1482 else if(g->NVar()==2) ndim = 2; 1483 else { 1484 cout<<"GeneralFitData ne peut avoir que 1 ou 2 variables d'abscisse: " 1485 <<((GeneralFitData*) obj)->NVar()<<endl; return; } 1486 } 1487 else if (dynamic_cast<RzImage*>(obj)) { 1488 ndim = 2; 1489 im = (RzImage*) obj; nbinx = im->XSize(); nbiny = im->YSize(); 1490 } 1491 else { 1492 cout<<"NamedObjMgr::Fit12D() Error , Objet n'est pas un " 1493 <<"Histo1D/HProf/Vector/Histo2D/Image/Matrix/GeneralFitData "<<ctyp<<endl; 1494 return; 1495 } 1496 1787 1497 ndata = nbinx*nbiny; 1788 1498 if(ndata<=0) -
trunk/SophyaPI/PIext/nobjmgr.h
r293 r295 9 9 #include "ppersist.h" 10 10 #include "dlftypes.h" 11 #include "anydataobj.h" 11 12 13 class NObjMgrAdapter; 12 14 class PIStdImgApp; 13 15 class Services2NObjMgr; … … 15 17 class NamedObjMgr { 16 18 public: 19 // Constructeur et destructeur 17 20 NamedObjMgr(); 18 21 virtual ~NamedObjMgr(); … … 22 25 23 26 // Pour ajouter, supprimer et acceder aux objets PPersist 24 virtual void AddObj( PPersist* obj, string& nom);27 virtual void AddObj(AnyDataObj* obj, string& nom, bool crd=false); 25 28 virtual void DelObj(string const& nom, bool fgd=true); 26 29 virtual void DelObjects(string const& patt, bool fgd=true); 27 virtual PPersist* GetObj(string const& nom);30 virtual AnyDataObj* GetObj(string const& nom); 28 31 virtual void RenameObj(string const& nom, string& nomnew); 29 32 virtual string LastObjName(); // Renvoie le nom du dernier objet ajoute … … 44 47 // Affichage des objets 45 48 virtual void DisplayObj(string const& nom, string dopt=""); 49 virtual void DisplayImage(string const& nom, string dopt=""); 46 50 virtual void DisplaySurf3D(string const& nom, string dopt=""); 47 51 virtual void DisplayNT(string const& nom, string& nmx, string& nmy, string& nmz, 48 52 string& erx, string& ery, string& erz, string dopt=""); 49 53 virtual void DisplayGFD(string const& nom, string& numvarx, string& numvary, string& err, string dopt=""); 50 // virtual void DisplayImage(string const& nom, string dopt=""); C'est necessaire ??51 54 52 55 virtual void SetGraphicAttributes(string gratt=""); … … 87 90 string par,string step,string min,string max,string opt); 88 91 89 90 92 // Acces au PIApplication et a la classe de service 91 93 virtual PIStdImgApp* GetImgApp(); 92 94 virtual Services2NObjMgr* GetServiceObj(); 95 96 protected : 97 virtual NObjMgrAdapter* GetObjAdapter(string const& nom); 93 98 }; 94 99 -
trunk/SophyaPI/PIext/pihisto.cc
r205 r295 1 1 #include <stdio.h> 2 #include <typeinfo> 3 2 4 #include "pihisto.h" 3 5 #include "hisprof.h" … … 21 23 float hmax = mHisto->VMax()+0.2*(mHisto->VMax()-mHisto->VMin()); 22 24 // si HBProf min,max calcules en tenant compte des erreurs 23 if( mHisto->ClassId() == HProf::classId) {25 if( typeid(*mHisto) == typeid(HProf) ) { 24 26 float v1,v2; 25 27 for (int i=1; i<mHisto->NBins(); i++) { … … 43 45 if (!mHisto) return; 44 46 45 if (mMrk != PI_NotDefMarker || mHisto->ClassId() == HProf::classId ){47 if (mMrk != PI_NotDefMarker || ( typeid(*mHisto) == typeid(HProf) ) ) { 46 48 // Marqeurs definis OU HBProf => marqueurs+Erreurs si il y en a 47 49 if (mLAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine); -
trunk/SophyaPI/PIext/piinit.cc
r293 r295 1 1 #include "machdefs.h" 2 2 #include "piinit.h" 3 #include "nobjmgr.h" 4 #include "servnobjm.h" 5 #include "nomhistadapter.h" 6 #include "nommatvecadapter.h" 7 #include "nomimagadapter.h" 8 #include "fitsimage.h" 3 9 4 10 5 int P eidaInteractiveInitiator::FgInit = 0;11 int PIAppInitiator::FgInit = 0; 6 12 7 P eidaInteractiveInitiator::PeidaInteractiveInitiator()13 PIAppInitiator::PIAppInitiator(PIStdImgApp * app) 8 14 : PeidaOutilsInitiator() 9 15 { 10 16 FgInit++; 11 17 if (FgInit > 1) return; 18 19 Services2NObjMgr* serv = app->ObjMgr()->GetServiceObj(); 20 21 serv->RegisterClass(new Histo, new NOMAdapter_Histo ); 22 serv->RegisterClass(new Histo2D, new NOMAdapter_Histo2D ); 23 serv->RegisterClass(new NTuple, new NOMAdapter_NTuple ); 24 25 serv->RegisterClass(new Vector, new NOMAdapter_Vector ); 26 serv->RegisterClass(new Matrix, new NOMAdapter_Matrix ); 27 28 serv->RegisterClass(new Image<uint_2>, new NOMAdapter_Image<uint_2> ); 29 serv->RegisterClass(new Image<int_2>, new NOMAdapter_Image<int_2> ); 30 serv->RegisterClass(new Image<int_4>, new NOMAdapter_Image<int_4> ); 31 serv->RegisterClass(new Image<r_4>, new NOMAdapter_Image<r_4> ); 32 33 serv->RegisterClass(new FitsImage<uint_2>, new NOMAdapter_Image<uint_2> ); 34 serv->RegisterClass(new FitsImage<int_2>, new NOMAdapter_Image<int_2> ); 35 serv->RegisterClass(new FitsImage<int_4>, new NOMAdapter_Image<int_4> ); 36 serv->RegisterClass(new FitsImage<r_4>, new NOMAdapter_Image<r_4> ); 12 37 13 38 } 14 39 15 P eidaInteractiveInitiator::~PeidaInteractiveInitiator()40 PIAppInitiator::~PIAppInitiator() 16 41 { 17 42 FgInit--; … … 21 46 } 22 47 23 // On met un objet initiator en statique, pour les loaders qui savent24 // appeler le constructeur des objets statiques Reza 08/9825 static PeidaInteractiveInitiator pinteractivexxinit; -
trunk/SophyaPI/PIext/piinit.h
r293 r295 3 3 4 4 #include "outilsinit.h" 5 #include "pistdimgapp.h" 5 6 6 // Classe d 'initialisation pour le module PI de PEIDA7 // Classe d initialisation pour le module PI de PEIDA 7 8 8 class P eidaInteractiveInitiator : public PeidaOutilsInitiator {9 class PIAppInitiator : public PeidaOutilsInitiator { 9 10 private: 10 11 static int FgInit; 11 12 public: 12 P eidaInteractiveInitiator();13 virtual ~P eidaInteractiveInitiator();13 PIAppInitiator(PIStdImgApp *); 14 virtual ~PIAppInitiator(); 14 15 }; 15 16 16 #undef PeidaInit17 #define PeidaInit() PeidaInteractiveInitiator peidainitiator18 17 19 18 #endif -
trunk/SophyaPI/PIext/pisiadw.cc
r293 r295 3 3 #include <stdio.h> 4 4 #include <string.h> 5 6 #include <typeinfo> 5 7 6 8 #include "perrors.h" … … 215 217 if (ln <= 0) nom = "?"; 216 218 else { strncpy(noms, mPin->TagName(i).c_str(), 31); noms[31] = '\0'; nom = noms; } 217 sprintf(strg, "%s (T=%s, Key=%d)", nom, dap->ObjMgr()->GetServiceObj()->PClassIdToClassName(cid), key); 219 // sprintf(strg, "%s (T=%s, Key=%d)", nom, dap->ObjMgr()->GetServiceObj()->PClassIdToClassName(cid), key); 220 sprintf(strg, "%s (T=%s, Key=%d)", nom, " DataObject ?", key); 218 221 objlist->AppendItem(strg, 5000+i); 219 222 } -
trunk/SophyaPI/PIext/pistdimgapp.cc
r293 r295 3 3 #include <stdio.h> 4 4 #include <string.h> 5 6 #include <typeinfo> 5 7 6 8 #include <string> … … 28 30 29 31 #include "pistzwin.h" 32 33 #include "piinit.h" 30 34 31 35 … … 192 196 SaveGraphicAtt(); 193 197 198 // Initialisation 199 PIAppInitiator * piai = new PIAppInitiator(this); 194 200 SetReady(); 195 201 } … … 421 427 422 428 /* --Methode-- */ 423 int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title , bool h2d)429 int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title) 424 430 { 425 431 if (scd == NULL) … … 452 458 sy = 200+mFgScSz*100; 453 459 win = GetWindow(opt, sx, sy, px, py, flag, (char *)name.c_str()); 454 if (!h2d) scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py); 460 if (typeid(*scd) != typeid(PIHisto2D)) 461 scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py); 455 462 else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py); 456 463 scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic); … … 458 465 scw->SetAxesFlags(mAxesFlags); 459 466 460 if ( !h2d) scw->AddScDrawer(scd, true);467 if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true); 461 468 else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd); 462 469 // Titre du plot -
trunk/SophyaPI/PIext/pistdimgapp.h
r293 r295 47 47 48 48 int DispImage(P2DArrayAdapter* nouv, string const & name, int opt); 49 int DispScDrawer(PIDrawer* scd, string const & name, int opt, string title="" , bool h2d=false);49 int DispScDrawer(PIDrawer* scd, string const & name, int opt, string title=""); 50 50 int Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title=""); 51 51 -
trunk/SophyaPI/PIext/servnobjm.cc
r293 r295 3 3 #include <ctype.h> 4 4 5 #include <typeinfo> 5 6 #include <iostream.h> 6 7 #include <string> … … 14 15 15 16 #include "strutil.h" 16 #include "datatypes.h"17 17 18 18 #include "nobjmgr.h" … … 20 20 #include "pistdimgapp.h" 21 21 22 #include "pclassids.h"23 22 #include "histos.h" 24 23 #include "histos2.h" 25 24 #include "ntuple.h" 26 25 #include "hisprof.h" 27 #include "generaldata.h" 28 29 #include "cimage.h" 30 #include "cvector.h" 31 #include "matrix.h" 32 33 // Si le module StarReco++ a ete compile (Pour les StarList, Transfo, etc ... 34 #ifdef SANS_EVOLPLANCK 35 #include "stlist.h" 36 #include "star.h" 37 #endif 26 38 27 39 28 … … 55 44 56 45 /* --Methode-- */ 57 void Services2NObjMgr::Nobj_ComputeExpressions(PPersist* obj, string& expx, string& expy, string& expz, 46 void Services2NObjMgr::RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa) 47 { 48 ObjAdaptList::iterator it; 49 for(it = objadaplist.begin(); it != objadaplist.end(); it++) 50 if (typeid(*o) == typeid(*((*it).obj))) THROW(dupIdErr); 51 52 dataobj_adapter oba; 53 oba.obj = o; 54 oba.obja = oa; 55 objadaplist.push_back(oba); 56 } 57 58 /* --Methode-- */ 59 NObjMgrAdapter* Services2NObjMgr::GetAdapter(AnyDataObj* o) 60 { 61 ObjAdaptList::iterator it; 62 for(it = objadaplist.begin(); it != objadaplist.end(); it++) 63 if (typeid(*o) == typeid(*((*it).obj))) return((*it).obja->Clone(o)); 64 return(new NObjMgrAdapter(o)); 65 } 66 67 /* --Methode-- */ 68 void Services2NObjMgr::Nobj_ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, string& expz, 58 69 string& expwt, string& expcut, NTuple* nt, Histo* h1, Histo2D* h2, HProf* hp) 59 70 { 60 int cid = obj->ClassId(); 61 62 string vardec; 63 switch (cid) { 64 case ClassId_Vector : 65 vardec = "double i,val; \n"; 66 vardec += "i = _zz61qq_[0]; val = _zz61qq_[1]; \n"; 67 break; 68 69 case ClassId_Matrix : 70 vardec = "double i,j,val; \n"; 71 vardec += "i = _zz61qq_[0]; j = _zz61qq_[1]; val = _zz61qq_[2]; \n"; 72 break; 73 74 case ClassId_Histo1D : 75 case ClassId_HProf : 76 vardec = "double i,x,val,err; \n"; 77 vardec += "i = _zz61qq_[0]; x = _zz61qq_[1]; val = _zz61qq_[2]; err = _zz61qq_[3]; \n"; 78 break; 79 80 case ClassId_Histo2D : 81 vardec = "double i,j,x,y,val,err; \n"; 82 vardec += "i = _zz61qq_[0]; j = _zz61qq_[1]; \n"; 83 vardec += "x = _zz61qq_[2]; y = _zz61qq_[3]; \n"; 84 vardec += "val = _zz61qq_[4]; err = _zz61qq_[5]; \n"; 85 break; 86 87 case ClassId_Image : 88 case ClassId_Image + kuint_1 : 89 case ClassId_Image + kint_1 : 90 case ClassId_Image + kr_8 : 91 case ClassId_Image + kuint_4 : 92 case ClassId_Image + kuint_2 : 93 case ClassId_Image + kint_2 : 94 case ClassId_Image + kint_4 : 95 case ClassId_Image + kr_4 : 96 vardec = "double x,y,pix,i,j,val; \n"; 97 vardec += "x = i = _zz61qq_[0]; y = j = _zz61qq_[1]; pix = val = _zz61qq_[2]; \n"; 98 break; 99 100 #ifdef SANS_EVOLPLANCK 101 case ClassId_StarList : 102 vardec = "double x,y,flux,fond; \n"; 103 vardec += "x = _zz61qq_[0]; y = _zz61qq_[1]; flux = _zz61qq_[2]; fond = _zz61qq_[3]; \n"; 104 break; 105 #endif 106 107 case ClassId_NTuple : 108 vardec = ((NTuple*)obj)->VarList_C("_zz61qq_"); 109 break; 110 111 case ClassId_GeneralFitData : 112 vardec = ((GeneralFitData*)obj)->VarList_C("_zz61qq_"); 113 break; 114 115 default : 116 cerr << "NamedObjMgr_ComputeExpressions() Error , N/A to " << PClassIdToClassName(cid) << endl; 117 return; 118 } 71 if (obja == NULL) return; 72 NTupleInterface* objnt = obja->GetNTupleInterface(); 73 if (objnt == NULL) return; 74 string vardec = objnt->VarList_C("_zz61qq_"); 119 75 120 76 PlotExprFunc f = LinkExprFunc(vardec, expx, expy, expz, expwt, expcut); … … 124 80 } 125 81 126 float x[10], xnt[10]; 82 double xnt[10]; 83 float fxnt[10]; 127 84 128 85 int i,j,k; 129 for(i=0; i<10; i++) x[i] = xnt[i] = 0.; 130 131 TRY { 132 switch (cid) { 133 case ClassId_Vector : 134 { 135 Vector* vv = (Vector*)obj; 136 for(k=0; k<vv->NElts(); k++) { 137 x[0] = k; x[1] = (*vv)(k); 138 if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) { 139 if (nt) nt->Fill(xnt); 140 if (h1) h1->Add(xnt[0], xnt[3]); 141 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 142 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 143 } 86 for(i=0; i<10; i++) xnt[i] = 0.; 87 88 TRY { 89 double* xn; 90 for(k=0; k<objnt->NbLines(); k++) { 91 xn = objnt->GetLineD(k); 92 if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) { 93 if (nt) { 94 for(i=0; i<4; i++) fxnt[i] = xnt[i]; 95 nt->Fill(fxnt); 96 } 97 if (h1) h1->Add(xnt[0], xnt[3]); 98 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 99 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 144 100 } 145 101 } 146 break; 147 148 case ClassId_Matrix : 149 { 150 Matrix* mm = (Matrix*)obj; 151 for(j=0; j<mm->NCol(); j++) 152 for(i=0; i<mm->NRows(); i++) { 153 x[0] = i; x[1] = j; x[2] = (*mm)(i,j); 154 if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) { 155 if (nt) nt->Fill(xnt); 156 if (h1) h1->Add(xnt[0], xnt[3]); 157 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 158 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 159 } 160 } 161 } 162 break; 163 164 case ClassId_Histo1D : 165 case ClassId_HProf : 166 { 167 Histo* hh = (Histo*)obj; 168 for(k=0; k<hh->NBins(); k++) { 169 x[0] = k; x[1] = hh->BinCenter(k); 170 x[2] = (*hh)(k); x[3] = hh->Error(k); 171 if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) { 172 if (nt) nt->Fill(xnt); 173 if (h1) h1->Add(xnt[0], xnt[3]); 174 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 175 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 176 } 177 } 178 } 179 break; 180 181 case ClassId_Histo2D : 182 { 183 Histo2D* hh = (Histo2D*)obj; 184 for(j=0; j<hh->NBinY(); j++) 185 for(i=0; i<hh->NBinX(); i++) { 186 x[0] = i; x[1] = j; 187 hh->BinCenter(i,j,x[2],x[3]); 188 x[4] = (*hh)(i,j); x[5] = hh->Error(i, j); 189 if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) { 190 if (nt) nt->Fill(xnt); 191 if (h1) h1->Add(xnt[0], xnt[3]); 192 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 193 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 194 } 195 } 196 } 197 break; 198 199 200 case ClassId_Image : 201 case ClassId_Image + kuint_1 : 202 case ClassId_Image + kint_1 : 203 case ClassId_Image + kr_8 : 204 case ClassId_Image + kuint_4 : 205 case ClassId_Image + kuint_2 : 206 case ClassId_Image + kint_2 : 207 case ClassId_Image + kint_4 : 208 case ClassId_Image + kr_4 : 209 { 210 RzImage* img = (RzImage*)obj; 211 for(j=0; j<img->YSize(); j++) 212 for(i=0; i<img->XSize(); i++) { 213 x[0] = i; x[1] = j; x[2] = img->FValue(i, j); 214 if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) { 215 if (nt) nt->Fill(xnt); 216 if (h1) h1->Add(xnt[0], xnt[3]); 217 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 218 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 219 } 220 } 221 } 222 break; 223 224 #ifdef SANS_EVOLPLANCK 225 case ClassId_StarList : 226 { 227 StarList* stl = (StarList*)obj; 228 BStar *sti; 229 for(k=0; k<stl->NbStars(); k++) { 230 sti = stl->Star(k); 231 if ( (!sti) || !(sti->Nice(BStar::flagOK)) ) continue; 232 x[0] = sti->PosX(); x[1] = sti->PosY(); 233 x[2] = sti->Flux(); x[3] = sti->Fond(); 234 if (f(x, xnt, xnt+1, xnt+2, xnt+3) != 0) { 235 if (nt) nt->Fill(xnt); 236 if (h1) h1->Add(xnt[0], xnt[3]); 237 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 238 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 239 } 240 } 241 } 242 break; 243 #endif 244 245 case ClassId_NTuple : 246 { 247 NTuple* ntp = (NTuple*)obj; 248 r_4* xn; 249 for(k=0; k<ntp->NEntry(); k++) { 250 xn = ntp->GetVec(k); 251 if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) { 252 if (nt) nt->Fill(xnt); 253 if (h1) h1->Add(xnt[0], xnt[3]); 254 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 255 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 256 } 257 } 258 } 259 break; 260 261 case ClassId_GeneralFitData : 262 { 263 GeneralFitData* data = (GeneralFitData*)obj; 264 r_4* xn; 265 int iok = 2*data->NVar()+2; 266 for(k=0; k<data->NData(); k++) { 267 xn = data->GetVecR4(k); 268 if(xn[iok]<0.001) continue; 269 if (f(xn, xnt, xnt+1, xnt+2, xnt+3) != 0) { 270 if (nt) nt->Fill(xnt); 271 if (h1) h1->Add(xnt[0], xnt[3]); 272 if (h2) h2->Add(xnt[0], xnt[1], xnt[3]); 273 if (hp) hp->Add(xnt[0], xnt[1], xnt[3]); 274 } 275 } 276 } 277 break; 278 279 default : 280 cout << "NamedObjMgr_ComputeExpressions() Erreur: N/A to " << PClassIdToClassName(cid) << endl; 281 return; 282 } 283 } CATCH(merr) { 102 } 103 CATCH(merr) { 284 104 fflush(stdout); 285 105 cout << endl; … … 318 138 // constitution du fichier a compiler 319 139 fputs("#include <math.h> \n", fip); 320 fputs("int expf_pia_dl_func( float* _zz61qq_, float* _rx_61qq_, float* _ry_61qq_, float* _rz_61qq_, float* _wt_61qq_) \n{\n", fip);140 fputs("int expf_pia_dl_func(double* _zz61qq_, double* _rx_61qq_, double* _ry_61qq_, double* _rz_61qq_, double* _wt_61qq_) \n{\n", fip); 321 141 fprintf(fip,"%s \n", vardec.c_str()); 322 142 fprintf(fip, "if (!(%s)) { *_rx_61qq_ = *_ry_61qq_ = *_rz_61qq_ = *_wt_61qq_ = 0.; return(0); } \n", cut.c_str()); … … 465 285 } 466 286 467 /* --Methode-- */ 468 char* Services2NObjMgr::PClassIdToClassName(int cid) 469 { 470 switch (cid) { 471 case ClassId_Poly1 : 472 return("Poly1"); 473 case ClassId_Poly2 : 474 return("Poly2"); 475 case ClassId_Matrix : 476 return("Matrix"); 477 case ClassId_Vector : 478 return("Vector"); 479 480 case ClassId_DVList : 481 return("DVList"); 482 483 case ClassId_Histo1D : 484 return("Histo1D"); 485 case ClassId_Histo2D : 486 return("Histo2D"); 487 case ClassId_HProf : 488 return("HProf"); 489 case ClassId_NTuple : 490 return("NTuple"); 491 case ClassId_GeneralFitData : 492 return("GeneralFitData"); 493 494 case ClassId_Image : 495 return("RzImage"); 496 case ClassId_Image + kuint_1 : 497 return("ImageU1"); 498 case ClassId_Image + kint_1 : 499 return("ImageI1"); 500 case ClassId_Image + kuint_2 : 501 return("ImageU2"); 502 case ClassId_Image + kint_2 : 503 return("ImageI2"); 504 case ClassId_Image + kuint_4 : 505 return("ImageU4"); 506 case ClassId_Image + kint_4 : 507 return("ImageI4"); 508 case ClassId_Image + kr_4 : 509 return("ImageR4"); 510 case ClassId_Image + kr_8 : 511 return("ImageR8"); 512 513 case ClassId_ZFidu : 514 return("ZFidu"); 515 516 #ifdef SANS_EVOLPLANCK 517 case ClassId_StarList : 518 return("StarList"); 519 case ClassId_Transfo : 520 return("Transfo"); 521 case ClassId_PSF : 522 return("PSF"); 523 524 case ClassId_Star + BStar_Type : 525 return("BStar"); 526 case ClassId_Star + RzStar_Type : 527 return("RzStar"); 528 case ClassId_Star + PSFStar_Type : 529 return("PSFStar"); 530 case ClassId_Star + MCStar_Type : 531 return("MCStar"); 532 case ClassId_Star + CircRFixStar_Type : 533 return("CircRFixStar"); 534 case ClassId_Star + PSFDHStar_Type : 535 return("PSFDHStar"); 536 case ClassId_Star + PSFSEStar_Type : 537 return("PSFSEStar"); 538 case ClassId_Star + MCDHStar_Type : 539 return("MCDHStar"); 540 #endif 541 542 // - Ajout objet PPF 543 default: 544 return("Unknown"); 545 } 546 } 547 548 /* --Methode-- */ 549 char* Services2NObjMgr::PClassIdToShortClassName(int cid) 550 { 551 switch (cid) { 552 case ClassId_Poly1 : 553 case ClassId_Poly2 : 554 return("Poly"); 555 case ClassId_Matrix : 556 return("Mtx"); 557 case ClassId_Vector : 558 return("Vec"); 559 case ClassId_DVList : 560 return("Dvl"); 561 562 case ClassId_Histo1D : 563 return("H1D"); 564 case ClassId_Histo2D : 565 return("H2D"); 566 case ClassId_HProf : 567 return("HPF"); 568 case ClassId_NTuple : 569 return("NT"); 570 case ClassId_GeneralFitData : 571 return("GFD"); 572 573 case ClassId_Image : 574 case ClassId_Image + kuint_1 : 575 case ClassId_Image + kint_1 : 576 case ClassId_Image + kuint_2 : 577 case ClassId_Image + kint_2 : 578 case ClassId_Image + kuint_4 : 579 case ClassId_Image + kint_4 : 580 case ClassId_Image + kr_4 : 581 case ClassId_Image + kr_8 : 582 return("Img"); 583 584 case ClassId_ZFidu : 585 return("Fidu"); 586 587 #ifdef SANS_EVOLPLANCK 588 case ClassId_StarList : 589 return("Stl"); 590 case ClassId_Transfo : 591 return("Tr"); 592 case ClassId_PSF : 593 return("PSF"); 594 595 case ClassId_Star + BStar_Type : 596 case ClassId_Star + RzStar_Type : 597 case ClassId_Star + PSFStar_Type : 598 case ClassId_Star + MCStar_Type : 599 case ClassId_Star + CircRFixStar_Type : 600 case ClassId_Star + PSFDHStar_Type : 601 case ClassId_Star + PSFSEStar_Type : 602 case ClassId_Star + MCDHStar_Type : 603 return("Star"); 604 #endif 605 606 // - Ajout objet PPF 607 default: 608 return("U"); 609 } 610 } 287 611 288 612 289 // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -
trunk/SophyaPI/PIext/servnobjm.h
r293 r295 9 9 #include "machdefs.h" 10 10 #include <string> 11 12 #include "ctimer.h" 11 #include <list> 12 #include <map> 13 #if defined(__KCC__) 14 using std::string ; 15 #include <list.h> 16 #include <map.h> 17 #endif 13 18 14 19 #include "pdlmgr.h" 15 20 #include "dlftypes.h" 21 #include "nomgadapter.h" 16 22 17 23 class NTuple; … … 26 32 ~Services2NObjMgr(); 27 33 34 // Pour enregistrer les objets de donnees et leurs adaptateurs 35 void RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa); 36 // Pour recuperer l'adaptateur pour un objet o 37 NObjMgrAdapter* GetAdapter(AnyDataObj* o); 38 28 39 inline void SetImgApp(PIStdImgApp* app) {mImgapp = app; } 29 40 30 void Nobj_ComputeExpressions( PPersist* obj, string& expx, string& expy, string& expz,41 void Nobj_ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, string& expz, 31 42 string& expwt, string& expcut, 32 43 NTuple* nt=NULL, Histo* h1=NULL, … … 37 48 void CloseDLL(); 38 49 39 char* PClassIdToClassName(int cid);40 char* PClassIdToShortClassName(int cid);41 50 string FileName2Name(string const & fn); 42 51 int DecodeDispOption(string& dopt, bool& fgsrgr); 43 52 53 protected: 44 54 void InitGrAttNames(); 55 56 // Pour enregister les objets et leurs adaptateurs pour NamedObjMgr 57 struct dataobj_adapter { 58 AnyDataObj* obj; NObjMgrAdapter* obja; 59 }; 60 typedef list<dataobj_adapter> ObjAdaptList; 61 ObjAdaptList objadaplist; 45 62 46 63 // Variables membre , en public pour le moment … … 49 66 }; 50 67 typedef map<string, gratt_item, less<string> > GrAttNames; 51 68 52 69 // Pour les changements d'attributs graphiques / de visualisation 53 70 GrAttNames GrAcolors;
Note:
See TracChangeset
for help on using the changeset viewer.