| [314] | 1 | #include "machdefs.h" | 
|---|
|  | 2 | #include <stdlib.h> | 
|---|
|  | 3 | #include <typeinfo> | 
|---|
|  | 4 | #include <iostream.h> | 
|---|
|  | 5 | #include <string> | 
|---|
|  | 6 |  | 
|---|
|  | 7 | #include "nomstladapter.h" | 
|---|
|  | 8 | #include "stlist.h" | 
|---|
|  | 9 | #include "pistlist.h" | 
|---|
|  | 10 |  | 
|---|
|  | 11 |  | 
|---|
|  | 12 |  | 
|---|
|  | 13 |  | 
|---|
|  | 14 | //------------------------------------------------------------------------- | 
|---|
|  | 15 | // Class Adaptateur d'objet (Pour NamedObjMgr) d'objet StarList | 
|---|
|  | 16 | //------------------------------------------------------------------------- | 
|---|
|  | 17 |  | 
|---|
|  | 18 | /* --Methode-- */ | 
|---|
|  | 19 | NOMAdapter_StarList::NOMAdapter_StarList(StarList* o) | 
|---|
|  | 20 | : NObjMgrAdapter(o) | 
|---|
|  | 21 | { | 
|---|
|  | 22 | mStl = o; | 
|---|
|  | 23 | } | 
|---|
|  | 24 |  | 
|---|
|  | 25 | /* --Methode-- */ | 
|---|
|  | 26 | NOMAdapter_StarList::~NOMAdapter_StarList() | 
|---|
|  | 27 | { | 
|---|
|  | 28 | } | 
|---|
|  | 29 |  | 
|---|
|  | 30 | /* --Methode-- */ | 
|---|
|  | 31 | NObjMgrAdapter* NOMAdapter_StarList::Clone(AnyDataObj* o) | 
|---|
|  | 32 | { | 
|---|
|  | 33 | StarList* stl = dynamic_cast<StarList *>(o); | 
|---|
|  | 34 | if (stl) return ( new NOMAdapter_StarList(stl) ); | 
|---|
|  | 35 | return ( new NObjMgrAdapter(o) ); | 
|---|
|  | 36 | } | 
|---|
|  | 37 |  | 
|---|
|  | 38 |  | 
|---|
|  | 39 | /* --Methode-- */ | 
|---|
|  | 40 | void NOMAdapter_StarList::SavePPF(POutPersist& pos, string const & nom) | 
|---|
|  | 41 | { | 
|---|
|  | 42 | #ifdef SANS_EVOLPLANCK | 
|---|
|  | 43 | // PEIDA-EROS L'objet est lui-meme PPersist | 
|---|
|  | 44 | string tag = nom;  // A cause de const | 
|---|
|  | 45 | mStl->Write(pos,0,tag); | 
|---|
|  | 46 | #else | 
|---|
|  | 47 | string s = typeid(*mStl).name(); | 
|---|
|  | 48 | cout << "NOMAdapter_StarList::SavePPF() - Error : Not supported for " << s << endl; | 
|---|
|  | 49 | #endif | 
|---|
|  | 50 | } | 
|---|
|  | 51 |  | 
|---|
|  | 52 | /* --Methode-- */ | 
|---|
|  | 53 | void NOMAdapter_StarList::Print(ostream& os) | 
|---|
|  | 54 | { | 
|---|
|  | 55 | os << (*mStl); | 
|---|
|  | 56 | } | 
|---|
|  | 57 |  | 
|---|
|  | 58 | /* --Methode-- */ | 
|---|
|  | 59 | PIDrawer* NOMAdapter_StarList::GetDrawer(string & dopt) | 
|---|
|  | 60 | { | 
|---|
|  | 61 | return(new PIStarList(mStl, false)); | 
|---|
|  | 62 | } | 
|---|
|  | 63 |  | 
|---|
|  | 64 |  | 
|---|
|  | 65 | /* --Methode-- */ | 
|---|
| [344] | 66 | NTupleInterface* NOMAdapter_StarList::GetNTupleInterface(bool& adel) | 
|---|
| [314] | 67 | { | 
|---|
| [344] | 68 | adel = true; | 
|---|
| [314] | 69 | return( new NTupInt_StarList(mStl) ); | 
|---|
|  | 70 | } | 
|---|
|  | 71 |  | 
|---|
|  | 72 |  | 
|---|
|  | 73 | // ------------------------------------------------------------- | 
|---|
|  | 74 |  | 
|---|
|  | 75 | /* --Methode-- */ | 
|---|
|  | 76 | NTupInt_StarList::NTupInt_StarList(StarList* stl) | 
|---|
|  | 77 | { | 
|---|
|  | 78 | mStl = stl; | 
|---|
|  | 79 | } | 
|---|
|  | 80 |  | 
|---|
|  | 81 | /* --Methode-- */ | 
|---|
|  | 82 | NTupInt_StarList::~NTupInt_StarList() | 
|---|
|  | 83 | { | 
|---|
|  | 84 | } | 
|---|
|  | 85 |  | 
|---|
|  | 86 | /* --Methode-- */ | 
|---|
| [326] | 87 | uint_4 NTupInt_StarList::NbLines() const | 
|---|
| [314] | 88 | { | 
|---|
|  | 89 | return(mStl->NbStars()); | 
|---|
|  | 90 | } | 
|---|
|  | 91 |  | 
|---|
|  | 92 | /* --Methode-- */ | 
|---|
| [326] | 93 | uint_4 NTupInt_StarList::NbColumns() const | 
|---|
| [314] | 94 | { | 
|---|
|  | 95 | return(11); | 
|---|
|  | 96 | } | 
|---|
|  | 97 |  | 
|---|
|  | 98 | /* --Methode-- */ | 
|---|
| [326] | 99 | r_8* NTupInt_StarList::GetLineD(int n) const | 
|---|
| [314] | 100 | { | 
|---|
|  | 101 | BStar* bst = mStl->Star(n); | 
|---|
|  | 102 | if (bst == NULL) | 
|---|
|  | 103 | for(int k=0; k<11; k++)  mRet[k] = -9999.0; | 
|---|
|  | 104 | else { | 
|---|
|  | 105 | mRet[0] = bst->PosX(); | 
|---|
|  | 106 | mRet[1] = bst->PosY(); | 
|---|
|  | 107 | mRet[2] = bst->Flux(); | 
|---|
|  | 108 | mRet[3] = bst->Fond(); | 
|---|
|  | 109 | mRet[4] = bst->PixMax(); | 
|---|
|  | 110 | mRet[5] = bst->PosXRef(); | 
|---|
|  | 111 | mRet[6] = bst->PosYRef(); | 
|---|
|  | 112 | mRet[7] = bst->FluxRef(); | 
|---|
|  | 113 | mRet[8] = bst->FondRef(); | 
|---|
|  | 114 | mRet[9] = bst->PixMaxRef(); | 
|---|
|  | 115 | mRet[10] = bst->Flags(); | 
|---|
|  | 116 | } | 
|---|
|  | 117 | return(mRet); | 
|---|
|  | 118 | } | 
|---|
|  | 119 |  | 
|---|
|  | 120 | /* --Methode-- */ | 
|---|
| [326] | 121 | string NTupInt_StarList::VarList_C(const char* nx) const | 
|---|
| [314] | 122 | { | 
|---|
|  | 123 | string nomx; | 
|---|
|  | 124 | if (nx) nomx = nx; | 
|---|
|  | 125 | else nomx = "_xstl_"; | 
|---|
|  | 126 | string vardec = "double x,y,flux,fond,pixmax; \n"; | 
|---|
|  | 127 | vardec += "double xref,yref,fluxref,fondref,pixmaxref; \n"; | 
|---|
|  | 128 | vardec += "double flags; \n"; | 
|---|
|  | 129 | vardec += "x = " + nomx + "[0];  y = " + nomx + "[1]; \n"; | 
|---|
|  | 130 | vardec += "flux = " + nomx + "[2];  fond = " + nomx + "[3]; \n"; | 
|---|
|  | 131 | vardec += "pixmax = " + nomx + "[4]; \n"; | 
|---|
|  | 132 | vardec += "xref = " + nomx + "[5];  yref = " + nomx + "[6]; \n"; | 
|---|
|  | 133 | vardec += "fluxref = " + nomx + "[7];  fondref = " + nomx + "[8]; \n"; | 
|---|
|  | 134 | vardec += "pixmaxref = " + nomx + "[9]; \n"; | 
|---|
|  | 135 | vardec += "flags = " + nomx + "[10]; \n"; | 
|---|
|  | 136 | return(vardec); | 
|---|
|  | 137 | } | 
|---|