Changeset 295 in Sophya


Ignore:
Timestamp:
May 13, 1999, 12:12:51 PM (26 years ago)
Author:
ercodmgr
Message:

Mise aux "normes" version DPC/Planck - Gestion des objets a travers

un adaptateur/interface NTuple par NamedObjMgr.
Enregistrement d'objets et de l'adaptateur (I/O PPersist, display, ...)
par ServNobjMgr .... Reza 13/05/99

Location:
trunk/SophyaPI/PIext
Files:
9 added
12 edited

Legend:

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

    r293 r295  
    195195
    196196// >>>>>>>>>>>  Affichage des objets
    197 else if ( (kw == "disp") || (kw == "surf") ) {
    198   if (tokens.size() < 1) { cout << "Usage: disp/surf nameobj [opt]" << endl; return(0); }
     197else if ( (kw == "disp") || (kw == "surf") || (kw == "imag") ) {
     198  if (tokens.size() < 1) { cout << "Usage: disp/surf/imag nameobj [opt]" << endl; return(0); }
    199199  string opt = "n";
    200200  if (tokens.size() > 1)  opt = tokens[1];
    201201  if (kw == "disp") mObjMgr->DisplayObj(tokens[0], opt);
    202202  else if (kw == "surf")  mObjMgr->DisplaySurf3D(tokens[0], opt);
     203  else if (kw == "imag")  mObjMgr->DisplayImage(tokens[0], opt);
    203204  }
    204205
     
    478479mpiac->RegisterCommand(kw, usage, this);
    479480
     481kw = "listobjs";
     482usage = "Prints the list of objects";
     483usage += "\n Usage: listobjs";
     484mpiac->RegisterCommand(kw, usage, this);
    480485kw = "rename";
    481486usage = "Rename an object \n Usage: rename nameobj namenew";
     
    512517usage = "Displays an object \n Usage: disp nameobj [graphic_attributes]";
    513518usage += "\n  Related commands: surf nt2d nt3d "; 
     519mpiac->RegisterCommand(kw, usage, this);
     520kw = "imag";
     521usage = "Displays an object as an image \n Usage: imag nameobj [graphic_attributes]";
     522usage += "\n  Related commands: disp surf nt2d nt3d "; 
    514523mpiac->RegisterCommand(kw, usage, this);
    515524kw = "surf";
  • trunk/SophyaPI/PIext/dlftypes.h

    r293 r295  
    1616typedef double (* DlFunctionOfX) (double x);
    1717typedef double (* DlFunctionOfXY) (double x, double y);
    18 typedef int (* PlotExprFunc) (float* x, float* rx, float* ry, float* rz, float* wt);
     18typedef int (* PlotExprFunc) (double* x, double* rx, double* ry, double* rz, double* wt);
    1919typedef void (* DlUserProcFunction) (vector<string>& args);
    2020typedef void (* DlFunction) ();
  • trunk/SophyaPI/PIext/nobjmgr.cc

    r293 r295  
    33#include <ctype.h>
    44
     5#include <typeinfo>
    56#include <iostream.h>
    67#include <string>
     
    2021#include "pistdimgapp.h"
    2122
    22 #include "pclassids.h"
    23 #include "poly.h"
    24 #include "dvlist.h"
    2523#include "matrix.h"
    2624#include "cvector.h"
     
    2927#ifdef SANS_EVOLPLANCK
    3028#include "fitsimage.h" 
    31 #include "zfidu.h" 
    3229#endif
    3330
     
    3532#include "fct2dfit.h"
    3633
    37 #include "pimgadapter.h"
     34#include "pisurfdr.h"
    3835#include "pipodrw.h"
    39 
    4036#include "pihisto.h"
    4137#include "hisprof.h"
    4238#include "pihisto2d.h"
    4339#include "pintuple.h"
    44 #include "pisurfdr.h" 
    4540#include "pintup3d.h"
    4641#include "pigfd1.h"
    4742#include "pigfd2.h"
    4843
    49 //  Si le module StarReco++ a ete compile (Pour les StarList, Transfo, etc ...
    50 #ifdef SANS_EVOLPLANCK
    51 #include "pistlist.h"
    52 #include "transfo.h"
    53 #endif
    5444
    5545//++
     
    7464// ......  Gestion des objets nommes, variables globales ............
    7565struct nobj_item {
    76   PPersist* obj;
     66  AnyDataObj* obj;
     67  NObjMgrAdapter* obja;
    7768  int num;
    7869  list<int> wrsid;
     
    162153//--
    163154//++
    164 // void AddObj(PPersist* obj, string& nom)
     155// void AddObj(AnyDataObj* obj, string& nom)
    165156//      Ajoute l'objet "obj" à la liste, identifié par "nom".
    166157//      Si un objet de même nom existe, l'ancien objet est renommé en concaténant
     
    171162//      Supprime l'ensemble des objets dont le nom correspond au patron "patt".
    172163//      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)
    174165//      Retourne l'objet identifié par "nom" dans la liste. Retourne "NULL" si "nom" n'est
    175166//      pas dans la liste.
     
    182173
    183174/* --Methode-- */
    184 void NamedObjMgr::AddObj(PPersist* obj, string& nom)
     175void NamedObjMgr::AddObj(AnyDataObj* obj, string& nom, bool)
    185176{
    186177
     
    198189
    199190myNObj++;
    200 if (nom.length() < 1) nom = servnobjm->PClassIdToShortClassName(obj->ClassId());
     191if (nom.length() < 1) nom = typeid(*obj).name();
    201192NObjList::iterator it = myObjs->find(nom);
    202193if (it != myObjs->end()) { // l'objet existe deja
     
    210201nobj_item no;
    211202no.obj = obj;
     203no.obja = servnobjm->GetAdapter(obj);  // L'adaptateur
    212204no.num =  myNObj;
    213205(*myObjs)[(*lastobj)] = no;
    214206if (myImgApp)  {
    215   string str = (*lastobj) + "    (T= " + servnobjm->PClassIdToClassName(obj->ClassId()) + ")" ;
     207  string str = (*lastobj) + "    (T= " + typeid(*obj).name() + ")" ;
    216208  (myImgApp->ObjMgrW())->AddObj(str.c_str(), myNObj+1000);
    217209}
    218210 
    219211cout << "NamedObjMgr::AddObj()  Object " << (*lastobj) << " ( " 
    220      << servnobjm->PClassIdToClassName(obj->ClassId()) << " ) added (Total= " << myObjs->size() << ")" << endl; 
     212     << typeid(*obj).name() << " ) added (Total= " << myObjs->size() << ")" << endl; 
    221213return;
    222214}
     
    234226  (myImgApp->ObjMgrW())->DelObj((*it).second.num+1000);
    235227}
     228delete (*it).second.obj;  // destruction de l'adaptateur
    236229if (fgd) delete (*it).second.obj;
    237230myObjs->erase(it);
     
    256249
    257250/* --Methode-- */
    258 PPersist* NamedObjMgr::GetObj(string const& nom)
     251AnyDataObj* NamedObjMgr::GetObj(string const& nom)
    259252{
    260253NObjList::iterator it = myObjs->find(nom);
     
    264257
    265258/* --Methode-- */
     259NObjMgrAdapter* NamedObjMgr::GetObjAdapter(string const& nom)
     260{
     261NObjList::iterator it = myObjs->find(nom);
     262if (it == myObjs->end()) return(NULL);
     263return((*it).second.obja);
     264}
     265
     266/* --Methode-- */
    266267void NamedObjMgr::RenameObj(string const& nom, string& nomnew)
    267268{
    268 PPersist* obj = GetObj(nom);
     269AnyDataObj* obj = GetObj(nom);
    269270if (obj == NULL) return;
    270271DelObj(nom, false);
     
    309310if (!ok)  return;
    310311if (nobj.length()<1)  nobj = servnobjm->FileName2Name(flnm);
    311 AddObj(obj, nobj);
     312AddObj(obj->DataObj(), nobj);
    312313return;
    313314}
     
    336337  if (!ok)  return;
    337338  nom = "";
    338   AddObj(obj, nom);
     339  AddObj(obj->DataObj(), nom);
    339340}
    340341 
     
    353354    ok = false;
    354355  } ENDTRY;
    355   if (ok)  AddObj(obj, nom); 
     356  if (ok)  AddObj(obj->DataObj(), nom); 
    356357}
    357358
     
    376377if (obj) {
    377378  string nom = servnobjm->FileName2Name(flnm);
    378   AddObj(obj, nom);
     379  AddObj(obj->DataObj(), nom);
    379380  }
    380381else ReadObj((*ppin), -1);
     
    404405if (ok) {
    405406  if (nobj.length()<1)  nobj = servnobjm->FileName2Name(flnm);
    406   AddObj((PPersist*)obj, nobj);
     407  AddObj((AnyDataObj*)obj, nobj);
    407408}
    408409return;
     
    414415void NamedObjMgr::SaveObj(string const& nom, POutPersist& s)
    415416{
    416 PPersist* obj=NULL;
    417 obj = GetObj(nom);
    418 if (obj == NULL)  return;
     417NObjMgrAdapter* obja=NULL;
     418obja = GetObjAdapter(nom);
     419if (obja == NULL)  return;
    419420printf("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());
     422obja->SavePPF(s, nom);
    424423return;
    425424}
     
    446445void NamedObjMgr::SaveFits(string const& nom, string const & flnm)
    447446{
    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 
     447NObjMgrAdapter* obja=NULL;
     448obja = GetObjAdapter(nom);
     449if (obja == NULL)  return;
     450obja->SaveFits(flnm);
    503451return;
    504452}
     
    509457{
    510458int k;
    511 PPersist* obj=NULL;
     459AnyDataObj* obj=NULL;
    512460string ctyp;
    513461char strg[256];
    514 int cid;
    515462
    516463cout << "NamedObjMgr::ListObjs() NObjs= " << myObjs->size() << "\n" ;
     
    519466  obj = (*it).second.obj;
    520467
    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());
    524470  ctyp = strg;
    525471  cout << ctyp << "\n" ;
     
    533479void NamedObjMgr::PrintObj(string const& nom)
    534480{
    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;
     481NObjMgrAdapter* obja=NULL;
     482obja = GetObjAdapter(nom);
     483if (obja == NULL)  return;
     484
     485string ctyp = typeid(*obja->GetDataObj()).name();
     486cout << "NamedObjMgr::PrintObj(" << nom << ") Type: " << ctyp << endl;
     487obja->Print(cout);
     488
    629489return;
    630490}
     
    633493void NamedObjMgr::DisplayObj(string const& nom, string dopt)
    634494{
    635 PPersist* obj=GetObj(nom);
    636 if (obj == NULL) {
     495NObjMgrAdapter* obja=NULL;
     496obja = GetObjAdapter(nom);
     497if (obja == NULL) {
    637498  cout << "NamedObjMgr::DisplayObj() Error , Pas d'objet de nom " << nom << endl;
    638499  return;
     
    640501if (!myImgApp)  return;
    641502 
    642 int cid = obj->ClassId();
    643 string ctyp = servnobjm->PClassIdToClassName(cid);
     503PIDrawer * dr = NULL;
     504P2DArrayAdapter* arr = NULL;
     505dr = obja->GetDrawer(dopt);
     506if (!dr) arr = obja->Get2DArray(dopt);
     507
     508if (!dr && !arr) {
     509  string ctyp = typeid(*(obja->GetDataObj())).name();
     510  cout << "NamedObjMgr::DisplayObj() Error , Pas de display pour " << ctyp << endl;
     511  return;
     512  }
    644513
    645514int wrsid = 0;
    646515bool fgsr = true;
    647 // On veut tracer une ligne pour vecteur et histo1D par defaut
    648 if ( (cid == ClassId_Vector) || (cid == ClassId_Histo1D) )  dopt = "thinline," + dopt;
    649 else if(cid == ClassId_HProf)  dopt = "fcirclemarker5," + dopt;
    650516int opt = servnobjm->DecodeDispOption(dopt, fgsr);
    651517
    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   }
     518if (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  }
     523else if (arr) wrsid = myImgApp->DispImage(arr, nom, opt);
    767524
    768525if(wrsid != 0) {
     
    775532}
    776533
     534/* --Methode-- */
     535void NamedObjMgr::DisplayImage(string const& nom, string dopt)
     536{
     537NObjMgrAdapter* obja=NULL;
     538obja = GetObjAdapter(nom);
     539if (obja == NULL) {
     540  cout << "NamedObjMgr::DisplayImage() Error , Pas d'objet de nom " << nom << endl;
     541  return;
     542}
     543if (!myImgApp)  return;
     544 
     545P2DArrayAdapter* arr = obja->Get2DArray(dopt);
     546
     547if (!arr) {
     548  string ctyp = typeid(*(obja->GetDataObj())).name();
     549  cout << "NamedObjMgr::DisplayImage() Error , Non supporte pour " << ctyp << endl;
     550  return;
     551  }
     552
     553int wrsid = 0;
     554bool fgsr = true;
     555int opt = servnobjm->DecodeDispOption(dopt, fgsr);
     556wrsid = myImgApp->DispImage(arr, nom, opt);
     557
     558if(wrsid != 0) {
     559  NObjList::iterator it = myObjs->find(nom);
     560  if (it == myObjs->end()) return;
     561  (*it).second.wrsid.push_back(wrsid);
     562  }
     563if (fgsr) myImgApp->RestoreGraphicAtt();
     564return;
     565}
     566/* --Methode-- */
     567void NamedObjMgr::DisplaySurf3D(string const& nom, string dopt)
     568{
     569NObjMgrAdapter* obja=NULL;
     570obja = GetObjAdapter(nom);
     571if (obja == NULL) {
     572  cout << "NamedObjMgr::DisplayImage() Error , Pas d'objet de nom " << nom << endl;
     573  return;
     574}
     575if (!myImgApp)  return;
     576 
     577P2DArrayAdapter* arr = obja->Get2DArray(dopt);
     578
     579if (!arr) {
     580  string ctyp = typeid(*(obja->GetDataObj())).name();
     581  cout << "NamedObjMgr::DisplaySurf3D() Error , Non supporte pour " << ctyp << endl;
     582  return;
     583  }
     584
     585if ((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
     592int wrsid = 0;
     593bool fgsr = true;
     594int opt = servnobjm->DecodeDispOption(dopt, fgsr);
     595PISurfaceDrawer* sdr = new PISurfaceDrawer(arr, true, true, true);
     596wrsid = myImgApp->Disp3DDrawer(sdr, nom, opt);
     597if(wrsid >= 0) {
     598  NObjList::iterator it = myObjs->find(nom);
     599  if (it == myObjs->end()) return;
     600  (*it).second.wrsid.push_back(wrsid);
     601  }
     602
     603if (fgsr) myImgApp->RestoreGraphicAtt(); 
     604return;
     605}
    777606
    778607/* --Methode-- */
     
    780609                            string& erx, string& ery, string& erz, string dopt)
    781610{
    782 PPersist* obj=GetObj(nom);
     611AnyDataObj* obj=GetObj(nom);
    783612if (obj == NULL) {
    784613  cout << "NamedObjMgr::DisplayNT() Error , Pas d'objet de nom " << nom << endl;
     
    787616if (!myImgApp)  return;
    788617
    789 int cid = obj->ClassId();
    790 if (cid != ClassId_NTuple) {
    791   string ctyp = servnobjm->PClassIdToClassName(cid);
     618if (typeid(*obj) != typeid(NTuple)) {
     619  string ctyp = typeid(*obj).name();
    792620  cout << "NamedObjMgr::DisplayNT() Error , Objet n'est pas un NTuple " << ctyp << endl;
    793621  return;
     
    837665//|  opt = options generales pour le display.
    838666{
    839 PPersist* obj=GetObj(nom);
     667AnyDataObj* obj=GetObj(nom);
    840668if(obj == NULL)
    841669  {cout << "NamedObjMgr::DisplayGFD() Error , Pas d'objet de nom " << nom << endl;
    842670   return;}
    843671if(!myImgApp) return;
    844 int cid = obj->ClassId();
    845 if(cid != ClassId_GeneralFitData)
    846   {string ctyp = servnobjm->PClassIdToClassName(cid);
     672if(typeid(*obj) != typeid(GeneralFitData))
     673  {string ctyp = typeid(*obj).name();
    847674   cout<<"NamedObjMgr::DisplayGFD() Error , Objet n'est pas un GeneralFitData "<<ctyp<<endl;
    848675   return;}
     
    894721
    895722
    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 }
    965723
    966724
     
    984742                                  string& expcut, string dopt)
    985743{
    986 PPersist* obj=GetObj(nom);
    987 if (obj == NULL) {
     744NObjMgrAdapter* obja=NULL;
     745obja = GetObjAdapter(nom);
     746if (obja == NULL) {
    988747  cout << "NamedObjMgr::DisplayPoints2D() Error , Pas d'objet de nom " << nom << endl;
    989748  return;
    990 }
     749  }
    991750if (!myImgApp)  return;
    992751
     
    999758else {  haserr = false;  experrx = experry = "0."; nt = new NTuple(2, ntn); }
    1000759
    1001 servnobjm->Nobj_ComputeExpressions(obj, expx, expy, experrx, experry, expcut, nt, NULL, NULL);
     760servnobjm->Nobj_ComputeExpressions(obja, expx, expy, experrx, experry, expcut, nt, NULL, NULL);
    1002761
    1003762if (nt->NEntry() < 1) {
     
    1025784                                  string& expcut, string dopt)
    1026785{
    1027 PPersist* obj=GetObj(nom);
    1028 if (obj == NULL) {
     786NObjMgrAdapter* obja=NULL;
     787obja = GetObjAdapter(nom);
     788if (obja == NULL) {
    1029789  cout << "NamedObjMgr::DisplayPoints3D() Error , Pas d'objet de nom " << nom << endl;
    1030790  return;
     
    1036796
    1037797string expwt = "1.";
    1038 servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expz, expwt, expcut, nt, NULL, NULL);
     798servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, expwt, expcut, nt, NULL, NULL);
    1039799
    1040800if (nt->NEntry() < 1) {
     
    1064824void NamedObjMgr::ProjectH1(string const& nom, string& expx, string& expwt, string& expcut, string& nomh1, string dopt)
    1065825{
    1066 PPersist* obj=GetObj(nom);
    1067 
    1068 if (obj == NULL) {
     826NObjMgrAdapter* obja=NULL;
     827obja = GetObjAdapter(nom);
     828if (obja == NULL) {
    1069829  cout << "NamedObjMgr::ProjectH1() Error , Pas d'objet de nom " << nom << endl;
    1070830  return;
     
    1074834Histo* h1 = NULL;
    1075835NTuple* nt = NULL;
    1076 PPersist* oh = NULL;
     836AnyDataObj* oh = NULL;
    1077837if (nomh1.length() > 0) oh=GetObj(nomh1);
    1078838else nomh1 = "H1Proj";
    1079 if ( (oh != NULL) && (oh->ClassId() == ClassId_Histo1D) )  h1 = (Histo*)oh;  // Pas de remise a zero ! h1->Zero();
     839if ( (oh != NULL) && (typeid(*oh) == typeid(Histo)) )  h1 = (Histo*)oh;  // Pas de remise a zero ! h1->Zero();
    1080840else {
    1081841  char* ntn[2]= {"hxval", "hwt"};
     
    1083843  }
    1084844string expz = "0.";   
    1085 servnobjm->Nobj_ComputeExpressions(obj, expx, expwt, expz, expwt, expcut, nt, h1, NULL);
     845servnobjm->Nobj_ComputeExpressions(obja, expx, expwt, expz, expwt, expcut, nt, h1, NULL);
    1086846
    1087847if ((!h1) && (!nt)) return;
     
    1113873                            string& nomh2, string dopt)
    1114874{
    1115 PPersist* obj=GetObj(nom);
    1116 
    1117 if (obj == NULL) {
     875NObjMgrAdapter* obja=NULL;
     876obja = GetObjAdapter(nom);
     877if (obja == NULL) {
    1118878  cout << "NamedObjMgr::ProjectH2() Error , Pas d'objet de nom " << nom << endl;
    1119879  return;
     
    1123883Histo2D* h2 = NULL;
    1124884NTuple* nt = NULL;
    1125 PPersist* oh = NULL;
     885AnyDataObj* oh = NULL;
    1126886if (nomh2.length() > 0)  oh=GetObj(nomh2);
    1127887else nomh2 = "H2Proj";
    1128 if ( (oh != NULL) && (oh->ClassId() == ClassId_Histo2D) )  h2 = (Histo2D*)oh;  // Pas de remise a zero ! h2->Zero();
     888if ( (oh != NULL) && (typeid(*oh) == typeid(Histo2D)) )  h2 = (Histo2D*)oh;  // Pas de remise a zero ! h2->Zero();
    1129889else {
    1130890  char* ntn[3]= {"hxval", "hyval", "hwt"};
     
    1132892  }
    1133893string expz = "0.";   
    1134 servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expwt, expwt, expcut, nt, NULL, h2);
     894servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, nt, NULL, h2);
    1135895
    1136896if ((!h2) && (!nt)) return;
     
    1174934//| opt = options generales pour le display.
    1175935{
    1176 PPersist* obj=GetObj(nom);
    1177 
    1178 if (obj == NULL) {
     936NObjMgrAdapter* obja=NULL;
     937obja = GetObjAdapter(nom);
     938if (obja == NULL) {
    1179939  cout << "NamedObjMgr::ProjectHProf() Error , Pas d'objet de nom " << nom << endl;
    1180940  return;
     
    1184944HProf* hprof = NULL;
    1185945NTuple* nt = NULL;
    1186 PPersist* oh = NULL;
     946AnyDataObj* oh = NULL;
    1187947if (nomprof.length() > 0)  oh=GetObj(nomprof);
    1188948else nomprof = "ProfProj";
    1189 if( (oh!=NULL) && (oh->ClassId()== ClassId_HProf) )  hprof = (HProf*)oh;
     949if( (oh!=NULL) && (typeid(*oh) == typeid(HProf)) )  hprof = (HProf*)oh;
    1190950else {
    1191951  char* ntn[3]= {"hxval", "hyval", "hwt"};
     
    1193953}
    1194954string expz = "0.";
    1195 servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expwt, expwt, expcut, nt, NULL, NULL, hprof);
     955servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expwt, expwt, expcut, nt, NULL, NULL, hprof);
    1196956
    1197957if((!hprof) && (!nt)) return;
     
    1223983void NamedObjMgr::FillVect(string const& nom, string& expx, string& expcut, string& nomvec, string dopt)
    1224984{
    1225 PPersist* obj=GetObj(nom);
    1226 
    1227 if (obj == NULL) {
     985NObjMgrAdapter* obja=NULL;
     986obja = GetObjAdapter(nom);
     987if (obja == NULL) {
    1228988  cout << "NamedObjMgr::FillVect() Error , Pas d'objet de nom " << nom << endl;
    1229989  return;
     
    1239999string expwt = "1.";
    12401000string expz = "0.";   
    1241 servnobjm->Nobj_ComputeExpressions(obj, expx, expz, expz, expwt, expcut, nt, NULL, NULL);
     1001servnobjm->Nobj_ComputeExpressions(obja, expx, expz, expz, expwt, expcut, nt, NULL, NULL);
    12421002
    12431003if (!nt) return;
     
    12651025                         string& expcut, string& nomnt)
    12661026{
    1267 PPersist* obj=GetObj(nom);
    1268 
    1269 if (obj == NULL) {
     1027NObjMgrAdapter* obja=NULL;
     1028obja = GetObjAdapter(nom);
     1029if (obja == NULL) {
    12701030  cout << "NamedObjMgr::FillNT() Error , Pas d'objet de nom " << nom << endl;
    12711031  return;
     
    12751035bool fgnnt = false;
    12761036NTuple* nt = NULL;
    1277 PPersist* oh = NULL;
     1037AnyDataObj* oh = NULL;
    12781038if (nomnt.length() > 0)  oh=GetObj(nomnt);
    12791039else nomnt = "NTFill";
    1280 if ( (oh != NULL) && (oh->ClassId() == ClassId_NTuple) )  {
     1040if ( (oh != NULL) && (typeid(*oh) == typeid(HProf)) )  {
    12811041  nt = (NTuple*)oh;
    12821042  if (nt->NVar() > 10) {
     
    12911051  }
    12921052
    1293 servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expz, expt, expcut, nt, NULL, NULL);
     1053servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, expt, expcut, nt, NULL, NULL);
    12941054
    12951055if (fgnnt) AddObj(nt, nomnt);
     
    13111071//| nomgfd = nom du GeneralFitData engendre (optionnel)
    13121072{
    1313 PPersist* obj=GetObj(nom);
    1314 if(obj == NULL)
    1315   {cout<<"NamedObjMgr::FillGFD() Error , Pas d'objet de nom "<<nom<<endl;
    1316    return;}
     1073NObjMgrAdapter* obja=NULL;
     1074obja = GetObjAdapter(nom);
     1075if (obja == NULL) {
     1076  cout << "NamedObjMgr::FillGFD() Error , Pas d'objet de nom "<<nom<<endl;
     1077  return;
     1078  }
    13171079if(!myImgApp)  return;
    13181080
     
    13211083if(expy.length()<=0) {nvar = 1; expy = "0.";}
    13221084
    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
    13731087
    13741088// Creation NTuple Buffer
     
    13771091
    13781092// Remplissage NTuple buffer
    1379 servnobjm->Nobj_ComputeExpressions(obj, expx, expy, expz, experr, expcut, nt, NULL, NULL);
     1093servnobjm->Nobj_ComputeExpressions(obja, expx, expy, expz, experr, expcut, nt, NULL, NULL);
    13801094if(nt->NEntry() < 1)
    13811095  {cout<<"NamedObjMgr::FillGFD() Warning  Zero points satisfy cut !"<<endl;
     
    13831097
    13841098//Remplissage de la structure GeneraFitData
    1385 GeneralFitData* gfd = new GeneralFitData(nvar,ndata,0);
     1099if (nt->NEntry() <= 0) {
     1100  cout<<"NamedObjMgr::FillGFD() Warning - NData= " << nt->NEntry() << endl;
     1101  delete nt;
     1102  return;
     1103  }
     1104
     1105GeneralFitData* gfd = new GeneralFitData(nvar,nt->NEntry(),0);
    13861106int k;
    13871107float* xn;
     
    17241444//|2D     yaa.b et y = idem "xaa.b et x" mais pour y
    17251445{
    1726 PPersist* obj=GetObj(nom);
     1446AnyDataObj* obj=GetObj(nom);
    17271447if (obj == NULL) {
    17281448  cout<<"NamedObjMgr::Fit12D() Error , Pas d'objet de nom "<<nom<<endl;
     
    17331453  {cout<<"NamedObjMgr::Fit12D() Donnez un nom de fonction a fitter."<<endl;
    17341454   return;}
    1735 int cid = obj->ClassId();
    1736 string ctyp = servnobjm->PClassIdToClassName(cid);
     1455string ctyp = typeid(*obj).name();
    17371456
    17381457int ndim = 0, nbinx=0, nbiny=0, ndata = 0;
     
    17401459Matrix* m = NULL; Histo2D* h2 = NULL; RzImage* im = NULL;
    17411460GeneralFitData* g = NULL;
    1742 switch (cid) {
     1461
    17431462  // 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 }
     1463if (typeid(*obj) == typeid(Vector)) {
     1464  ndim = 1;
     1465  v = (Vector*) obj; nbinx = v->NElts(); nbiny = 1;
     1466  }
     1467else if ( (typeid(*obj) == typeid(HProf)) || (typeid(*obj) == typeid(Histo)) ) {
     1468  ndim = 1;
     1469  h = (Histo*)  obj; nbinx = h->NBins(); nbiny = 1;
     1470  }
     1471else if (typeid(*obj) == typeid(Matrix)) {
     1472  ndim = 2;
     1473  m = (Matrix*) obj; nbinx = m->NCol(); nbiny = m->NRows();
     1474  }
     1475else if (typeid(*obj) == typeid(Histo2D)) {
     1476  ndim = 2;
     1477  h2 = (Histo2D*) obj; nbinx = h2->NBinX(); nbiny = h2->NBinY();
     1478  }
     1479else 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  }
     1487else if (dynamic_cast<RzImage*>(obj)) {
     1488  ndim = 2;
     1489  im = (RzImage*) obj; nbinx = im->XSize(); nbiny = im->YSize();
     1490  }
     1491else  {
     1492  cout<<"NamedObjMgr::Fit12D() Error , Objet n'est pas un "
     1493      <<"Histo1D/HProf/Vector/Histo2D/Image/Matrix/GeneralFitData "<<ctyp<<endl;
     1494  return;
     1495  }
     1496
    17871497ndata = nbinx*nbiny;
    17881498if(ndata<=0)
  • trunk/SophyaPI/PIext/nobjmgr.h

    r293 r295  
    99#include "ppersist.h"
    1010#include "dlftypes.h"
     11#include "anydataobj.h"
    1112
     13class NObjMgrAdapter;
    1214class PIStdImgApp;
    1315class Services2NObjMgr;
     
    1517class NamedObjMgr {
    1618public:
     19// Constructeur et destructeur
    1720                        NamedObjMgr();
    1821  virtual               ~NamedObjMgr();
     
    2225
    2326//  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);
    2528  virtual void          DelObj(string const& nom, bool fgd=true);
    2629  virtual void          DelObjects(string const& patt, bool fgd=true);
    27   virtual PPersist*     GetObj(string const& nom);
     30  virtual AnyDataObj*   GetObj(string const& nom);
    2831  virtual void          RenameObj(string const& nom, string& nomnew);
    2932  virtual string        LastObjName();  // Renvoie le nom du dernier objet ajoute
     
    4447//  Affichage des objets
    4548  virtual void          DisplayObj(string const& nom, string dopt="");
     49  virtual void          DisplayImage(string const& nom, string dopt="");
    4650  virtual void          DisplaySurf3D(string const& nom, string dopt="");
    4751  virtual void          DisplayNT(string const& nom, string& nmx, string& nmy, string& nmz, 
    4852                                  string& erx, string& ery, string& erz, string dopt="");
    4953  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 ??
    5154
    5255  virtual void          SetGraphicAttributes(string gratt="");
     
    8790                              string par,string step,string min,string max,string opt);
    8891
    89 
    9092// Acces au PIApplication et a la classe de service
    9193  virtual PIStdImgApp*          GetImgApp();
    9294  virtual Services2NObjMgr*     GetServiceObj();
     95
     96protected :
     97  virtual NObjMgrAdapter*       GetObjAdapter(string const& nom);
    9398};
    9499
  • trunk/SophyaPI/PIext/pihisto.cc

    r205 r295  
    11#include <stdio.h>
     2#include <typeinfo>
     3
    24#include "pihisto.h"
    35#include "hisprof.h"
     
    2123  float hmax = mHisto->VMax()+0.2*(mHisto->VMax()-mHisto->VMin());
    2224  // si HBProf min,max calcules en tenant compte des erreurs
    23   if( mHisto->ClassId() == HProf::classId ) {
     25  if( typeid(*mHisto) == typeid(HProf) ) {
    2426    float v1,v2;
    2527    for (int i=1; i<mHisto->NBins(); i++) {
     
    4345  if (!mHisto)  return; 
    4446
    45   if (mMrk != PI_NotDefMarker || mHisto->ClassId() == HProf::classId ) {
     47  if (mMrk != PI_NotDefMarker ||  ( typeid(*mHisto) == typeid(HProf) ) ) {
    4648    // Marqeurs definis OU HBProf => marqueurs+Erreurs si il y en a
    4749    if (mLAtt == PI_NotDefLineAtt) g->SelLine(PI_ThinLine);
  • trunk/SophyaPI/PIext/piinit.cc

    r293 r295  
    11#include "machdefs.h"
    22#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"
    39
    410
    5 int PeidaInteractiveInitiator::FgInit = 0;
     11int PIAppInitiator::FgInit = 0;
    612
    7 PeidaInteractiveInitiator::PeidaInteractiveInitiator()
     13PIAppInitiator::PIAppInitiator(PIStdImgApp * app)
    814 : PeidaOutilsInitiator()
    915{
    1016  FgInit++;
    1117  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> );
    1237 
    1338}
    1439
    15 PeidaInteractiveInitiator::~PeidaInteractiveInitiator()
     40PIAppInitiator::~PIAppInitiator()
    1641{
    1742  FgInit--;
     
    2146}
    2247
    23 // On met un objet initiator en statique, pour les loaders qui savent
    24 // appeler le constructeur des objets statiques   Reza 08/98
    25 static PeidaInteractiveInitiator  pinteractivexxinit;
  • trunk/SophyaPI/PIext/piinit.h

    r293 r295  
    33
    44#include "outilsinit.h"
     5#include "pistdimgapp.h"
    56
    6 // Classe d'initialisation pour le module PI de PEIDA
     7// Classe d initialisation pour le module PI de PEIDA
    78
    8 class PeidaInteractiveInitiator : public PeidaOutilsInitiator {
     9class PIAppInitiator : public PeidaOutilsInitiator {
    910private:
    1011  static int FgInit;
    1112public:
    12                 PeidaInteractiveInitiator();
    13  virtual        ~PeidaInteractiveInitiator();
     13                PIAppInitiator(PIStdImgApp *);
     14 virtual        ~PIAppInitiator();
    1415};
    1516
    16 #undef PeidaInit
    17 #define PeidaInit() PeidaInteractiveInitiator peidainitiator
    1817
    1918#endif
  • trunk/SophyaPI/PIext/pisiadw.cc

    r293 r295  
    33#include <stdio.h>
    44#include <string.h>
     5
     6#include <typeinfo>
    57
    68#include "perrors.h"
     
    215217  if (ln <= 0)  nom = "?";
    216218  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);
    218221  objlist->AppendItem(strg, 5000+i);
    219222}
  • trunk/SophyaPI/PIext/pistdimgapp.cc

    r293 r295  
    33#include <stdio.h>
    44#include <string.h>
     5
     6#include <typeinfo>
    57
    68#include <string>
     
    2830
    2931#include "pistzwin.h"
     32
     33#include "piinit.h"
    3034
    3135
     
    192196SaveGraphicAtt();
    193197
     198// Initialisation
     199PIAppInitiator * piai = new PIAppInitiator(this);
    194200SetReady();
    195201}
     
    421427
    422428/* --Methode-- */
    423 int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title, bool h2d)
     429int PIStdImgApp::DispScDrawer(PIDrawer* scd, string const & name, int opt, string title)
    424430{
    425431if (scd == NULL)
     
    452458sy = 200+mFgScSz*100;
    453459win = 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);
     460if (typeid(*scd) != typeid(PIHisto2D))
     461   scw = new PIScDrawWdg(win, (char *)name.c_str(), sx, sy, px, py);
    455462else scw = new PIH2DWdg(win, (char *)name.c_str(), sx, sy, px, py);
    456463scw->SetBinding(PIBK_elastic, PIBK_elastic, PIBK_elastic, PIBK_elastic);
     
    458465scw->SetAxesFlags(mAxesFlags);
    459466
    460 if (!h2d) scw->AddScDrawer(scd, true);
     467if (typeid(*scd) != typeid(PIHisto2D)) scw->AddScDrawer(scd, true);
    461468else ((PIH2DWdg*)scw)->SetPIHisto((PIHisto2D*)scd);
    462469//   Titre du plot
  • trunk/SophyaPI/PIext/pistdimgapp.h

    r293 r295  
    4747
    4848     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="");
    5050     int  Disp3DDrawer(PIDrawer3D* scd, string const & name, int opt, string title="");
    5151
  • trunk/SophyaPI/PIext/servnobjm.cc

    r293 r295  
    33#include <ctype.h>
    44
     5#include <typeinfo>
    56#include <iostream.h>
    67#include <string>
     
    1415
    1516#include "strutil.h"
    16 #include "datatypes.h"
    1717
    1818#include "nobjmgr.h"
     
    2020#include "pistdimgapp.h"
    2121
    22 #include "pclassids.h"
    2322#include "histos.h"
    2423#include "histos2.h"
    2524#include "ntuple.h"
    2625#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
    3827
    3928
     
    5544
    5645/* --Methode-- */
    57 void Services2NObjMgr::Nobj_ComputeExpressions(PPersist* obj, string& expx, string& expy, string& expz,
     46void Services2NObjMgr::RegisterClass(AnyDataObj* o, NObjMgrAdapter* oa)
     47{
     48ObjAdaptList::iterator it;
     49for(it = objadaplist.begin(); it != objadaplist.end(); it++)
     50    if (typeid(*o) == typeid(*((*it).obj)))  THROW(dupIdErr);
     51
     52dataobj_adapter oba;
     53oba.obj = o;
     54oba.obja = oa;
     55objadaplist.push_back(oba);
     56}
     57
     58/* --Methode-- */
     59NObjMgrAdapter* Services2NObjMgr::GetAdapter(AnyDataObj* o)
     60{
     61ObjAdaptList::iterator it;
     62for(it = objadaplist.begin(); it != objadaplist.end(); it++)
     63  if (typeid(*o) == typeid(*((*it).obj)))  return((*it).obja->Clone(o));
     64return(new NObjMgrAdapter(o));
     65}
     66
     67/* --Methode-- */
     68void Services2NObjMgr::Nobj_ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, string& expz,
    5869                          string& expwt, string& expcut, NTuple* nt, Histo* h1, Histo2D* h2, HProf* hp)
    5970{
    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   }
     71if (obja == NULL) return;
     72NTupleInterface* objnt = obja->GetNTupleInterface();
     73if (objnt == NULL)  return;
     74string  vardec = objnt->VarList_C("_zz61qq_");
    11975
    12076PlotExprFunc f = LinkExprFunc(vardec, expx, expy, expz, expwt, expcut);
     
    12480  }
    12581
    126 float x[10], xnt[10];
     82double xnt[10];
     83float  fxnt[10];
    12784
    12885int 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         }
     86for(i=0; i<10; i++) xnt[i] = 0.;
     87
     88TRY  {
     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]);
    144100      }
    145101    }
    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 }
     103CATCH(merr) {
    284104  fflush(stdout);
    285105  cout << endl;
     
    318138// constitution du fichier a compiler
    319139fputs("#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);
     140fputs("int expf_pia_dl_func(double* _zz61qq_, double* _rx_61qq_, double* _ry_61qq_, double* _rz_61qq_, double* _wt_61qq_) \n{\n", fip);
    321141fprintf(fip,"%s \n", vardec.c_str());
    322142fprintf(fip, "if (!(%s)) { *_rx_61qq_ = *_ry_61qq_ = *_rz_61qq_ = *_wt_61qq_ = 0.;  return(0); } \n", cut.c_str());
     
    465285}
    466286
    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
    611288
    612289// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
  • trunk/SophyaPI/PIext/servnobjm.h

    r293 r295  
    99#include "machdefs.h"
    1010#include <string>
    11 
    12 #include "ctimer.h"
     11#include <list>
     12#include <map>
     13#if defined(__KCC__)
     14using std::string ;
     15#include <list.h>
     16#include <map.h>
     17#endif
    1318
    1419#include "pdlmgr.h"
    1520#include "dlftypes.h"
     21#include "nomgadapter.h"
    1622
    1723class NTuple;
     
    2632                ~Services2NObjMgr();
    2733
     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
    2839  inline void   SetImgApp(PIStdImgApp* app) {mImgapp = app; }
    2940
    30   void          Nobj_ComputeExpressions(PPersist* obj, string& expx, string& expy, string& expz,
     41  void          Nobj_ComputeExpressions(NObjMgrAdapter* obja, string& expx, string& expy, string& expz,
    3142                                        string& expwt, string& expcut,
    3243                                        NTuple* nt=NULL, Histo* h1=NULL,
     
    3748  void          CloseDLL(); 
    3849
    39   char*         PClassIdToClassName(int cid);
    40   char*         PClassIdToShortClassName(int cid);
    4150  string        FileName2Name(string const & fn);
    4251  int           DecodeDispOption(string& dopt, bool& fgsrgr);
    4352
     53protected:
    4454  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;
    4562
    4663//   Variables membre , en public pour le moment
     
    4966  };
    5067  typedef map<string, gratt_item, less<string> > GrAttNames;
    51 
     68 
    5269//  Pour les changements d'attributs graphiques / de visualisation
    5370  GrAttNames GrAcolors;
Note: See TracChangeset for help on using the changeset viewer.