Changeset 1808 in Sophya for trunk/SophyaExt


Ignore:
Timestamp:
Dec 3, 2001, 9:34:06 PM (24 years ago)
Author:
cmv
Message:

nouvelle interface de gestion des systemes de coordonnees et des unites cmv 3/12/01

Location:
trunk/SophyaExt/XAstroPack
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/SophyaExt/XAstroPack/xastropack.cc

    r1802 r1808  
    4141// GALACTIQUE: longitude en degres [0,360[  (glng)
    4242//             latitude en degres [-90,90]  (glat)
     43//             (colatitude en degres [0,180]  (gcolat))
    4344// HORIZONTAL: azimuth en degres [0,360[   (az)
    4445//                 (angle round to the east from north+)
    45 //             altitude en degres [-90,90] (alt)
     46//             altitude ou elevation en degres [-90,90] (alt)
     47//             (distance zenitale en degres [0,180] (zendist))
    4648// ECLIPTIQUE: lontitude ecliptique en degres [0,360[ (eclng)
    4749//                 (angle round counter clockwise from the vernal equinoxe)
    4850//             latitude ecliptique en degres [-90,90] (eclat)
     51//             (colatitude ecliptique en degres [0,180] (eccolat))
    4952// GEOGRAPHIE: longitude en degres ]-180,180]        (geolng)
    5053//                 (angle <0 vers l'ouest, >0 vers l'est)
    5154//             latitude en degres [-90,90] (north>0 sud<0) (geolat)
     55//             (colatitude en degres [0,180] (north=0, sud=180) (geocolat))
     56//
     57// --- Remarque sur la colatitude:
     58//   La latitude peut etre remplacee par la colatitude
     59//      (ou altitude/elevation par la distance zenitale):
     60//      latitude   : [-90,90] avec 0=equateur,  90=pole nord, -90=pole sud
     61//      colatitude : [0,180]  avec 0=pole nord, 90=equateur,  180=pole sud
     62//      colatitude = 90.-latitude , latitude = 90.-colatitude
    5263  \endverbatim
    5364*/
     
    6172 "typ" code le systeme de coordonnees astronomiques et les unites utilisees
    6273
    63  - Return : 0 = OK
    64             1 = Unknown type of coordinates
    65             2 = bad range for coord1
    66             4 = bad range for coord2
    67             6 = bad range for coord1 et coord2
    68 
    69  Les types de coordonnees sont definies dans le enum TypAstroCoord:
    70   La premiere coordonnee est de type "longitude" (alpha,longitude)
    71   La deuxieme coordonnee est de type "latidude" (delta,latitude)
    72  *** Definitions des unites des coordonnees et de leurs dynamiques
    73  - TypCoordH0 : heure=[0,24[
    74  - TypCoordH1 : heure=]-12,12]
    75  - TypCoordD0 : degre=[0,360[
    76  - TypCoordD1 : degre=]-180,180]
    77  - TypCoordD2 : degre=[-90,90]
    78  - TypCoordR0 : degre=[0,2Pi[
    79  - TypCoordR1 : degre=]-Pi,Pi]
    80  - TypCoordR2 : degre=[-Pi/2,Pi/2]
    81  *** Definitions des combinaisons unites des coordonnees
    82  - TypCoordHD  : coordonnees en (heure=[0,24[,degre=[-90,90])
    83  - TypCoordDD  : coordonnees en (degre=[0,360[,degre=[-90,90])
    84  - TypCoordRR  : coordonnees en (radian=[0,2Pi[,radian=[-Pi/2,Pi/2])
    85  - TypCoordH1D : coordonnees en (heure=]-12,12],degre=[-90,90])
    86  - TypCoordD1D : coordonnees en (degre=]-180,180],degre=[-90,90])
    87  - TypCoordR1R : coordonnees en (radian=]-Pi,Pi],radian=[-Pi/2,Pi/2])
    88  *** Definitions des types de systemes de coordonnees astronomiques.
    89  - TypCoordEq  : Coordonnees Equatoriales alpha,delta
    90  - TypCoordGal : Coordonnees Galactiques gLong, gLat
    91  - TypCoordHor : Coordonnees Horizontales azimuth,altitude
    92  - TypCoordEcl : Coordonnees Ecliptiques EclLong,EclLat
    93  *** Definitions des unites par defaut pour les divers systemes de coordonnees.
    94  - TypCoordEqStd  : heure=[0,24[, degre=[-90,90]
    95  - TypCoordGalStd : degre=[0,360[,degre=[-90,90]
    96  - TypCoordHorStd : degre=[0,360[,degre=[-90,90]
    97  - TypCoordEclStd : degre=[0,360[,degre=[-90,90]
    98 \endverbatim
    99 */
    100 int  CoordConvertToStd(TypAstroCoord typ,double& coord1,double& coord2)
    101 {
    102   int rc = 0;
    103 
    104   // ---- Equatoriales alpha,delta
    105   //    - standard = [0,24[ , [-90,90]
     74 - Return : 0 = Problem
     75            TypAstroCoord du systeme de coordonnees retourne
     76
     77 - Les types de coordonnees (A,B) sont definies
     78           dans le enum TypAstroCoord (unsigned long):
     79   La premiere coordonnee "A" est de type "longitude"
     80                          (alpha,longitude,azimuth)
     81   La deuxieme coordonnee "B" est de type "latidude"
     82                          (delta,latitude,altitude ou elevation)
     83
     84 *** Definitions des unites des coordonnees
     85 - Coordonnee:
     86      TypCoordH en heure
     87      TypCoordD en degre
     88      TypCoordR en radian
     89 - Coordonnee "A":
     90      TypCoord1H en heure
     91      TypCoord1D en degre
     92      TypCoord1R en radian
     93      - Defaut (pas de bit leve): radians
     94 - Coordonnee "B":
     95      TypCoord2H en heure
     96      TypCoord2D en degre
     97      TypCoord2R en radian
     98      - Defaut (pas de bit leve): radians
     99 *** Definitions des types d'intervalle utilises
     100 - Coordonnee "A":
     101      TypCoord1C type intervalle
     102                 [0,24[ ou [0,360[ ou [0,2Pi[
     103      TypCoord1L type intervalle centre
     104                 ]-12,12] ou ]-180,180] ou ]-Pi,Pi]
     105      - Defaut (pas de bit leve): TypCoord1C
     106 - Coordonnee "B":
     107      TypCoord2C type intervalle (colatitude)
     108                 [0,12] ou [0,180] ou [0,Pi]
     109      TypCoord2L type intervalle centre (latitude)
     110                 [-6,6] ou [-90,90] ou [-Pi/2,Pi/2]
     111      - Defaut (pas de bit leve): TypCoord2L (latitude)
     112 *** Les systemes de coordonnes astronomiques
     113 TypCoordEq  coordonnees Equatoriales alpha,delta
     114 TypCoordGal coordonnees Galactiques gLong, gLat
     115 TypCoordHor coordonnees Horizontales azimuth,altitude
     116 TypCoordEcl coordonnees Ecliptiques EclLong,EclLat
     117      (Pas de defaut)
     118 *** Les systemes de coordonnes astronomiques "standard"
     119 TypCoordEqStd   alpha en heure=[0,24[ delta en degre=[-90,90]
     120 TypCoordGalStd  long en degre=[0,360[ lat en degre=[-90,90] (latitude)
     121 TypCoordHorStd  long en degre=[0,360[ lat en degre=[-90,90] (latitude)
     122 TypCoordEclStd  long en degre=[0,360[ lat en degre=[-90,90] (latitude)
     123\endverbatim
     124*/
     125unsigned long CoordConvertToStd(unsigned long typ,double* coord1,double* coord2)
     126{
     127  unsigned long rc = TypCoordUndef;
     128
    106129  if(typ&TypCoordEq) {
    107     if(typ&TypCoordDD) {
    108       coord1 = deghr(coord1);
    109     } else if(typ&TypCoordRR) {
    110       coord1 = radhr(coord1);
    111       coord2 = raddeg(coord2);
    112     }
    113     if(coord1==24.) coord1 = 0.;
    114     if(coord1<0.   || coord1>=24.) rc+= 2;
    115     if(coord2<-90. || coord2>90. ) rc+= 4;
    116 
    117   // ---- Galactiques gLong, gLat
    118   // ---- Horizontales azimuth,altitude
    119   // ---- Ecliptiques EclLong,EclLat
    120   //    - standard = [0,360[ , [-90,90]
    121   } else if( typ&TypCoordGal || typ&TypCoordHor || typ&TypCoordEcl) {
    122     if(typ&TypCoordHD) {
    123       coord1 = hrdeg(coord1);
    124     } else if(typ&TypCoordRR) {
    125       coord1 = raddeg(coord1);
    126       coord2 = raddeg(coord2);
    127     }
    128     if(coord1==360.) coord1 = 0.;
    129     if(coord1<0.   || coord1>=360.) rc+= 2;
    130     if(coord2<-90. || coord2>90. )  rc+= 4;
    131 
    132   } else {          // Coordonnees non-connues
    133     rc= 1;
     130    // ---- Equatoriales alpha,delta
     131    if     (typ&TypCoord1D)    *coord1 = deghr(*coord1);
     132    else if(typ&TypCoord1R)    *coord1 = radhr(*coord1);
     133    else if(!(typ&TypCoord1H)) *coord1 = radhr(*coord1);
     134
     135    InRange(coord1,24.);
     136
     137    if     (typ&TypCoord2H)    *coord2 = hrdeg(*coord2);
     138    else if(typ&TypCoord2R)    *coord2 = raddeg(*coord2);
     139    else if(!(typ&TypCoord2D)) *coord2 = raddeg(*coord2);
     140
     141    if(typ&TypCoord2C) {
     142      InRangeCoLat(coord2,TypUniteD);
     143      ToCoLat(coord2,TypUniteD);
     144    } else InRangeLat(coord2,TypUniteD);
     145
     146    rc=TypCoordEqStd;
     147
     148  } else if(typ&TypCoordGal || typ&TypCoordHor || typ&TypCoordEcl) {
     149    // ---- Galactiques gLong, gLat
     150    // ---- Horizontales azimuth,altitude ou elevation
     151    // ---- Ecliptiques EclLong,EclLat
     152    if     (typ&TypCoord1H)    *coord1 = hrdeg(*coord1);
     153    else if(typ&TypCoord1R)    *coord1 = raddeg(*coord1);
     154    else if(!(typ&TypCoord1D)) *coord1 = raddeg(*coord1);
     155
     156    InRange(coord1,360.);
     157
     158    if     (typ&TypCoord2H)    *coord2 = hrdeg(*coord2);
     159    else if(typ&TypCoord2R)    *coord2 = raddeg(*coord2);
     160    else if(!(typ&TypCoord2D)) *coord2 = raddeg(*coord2);
     161
     162    if(typ&TypCoord2C) {
     163      InRangeCoLat(coord2,TypUniteD);
     164      ToCoLat(coord2,TypUniteD);
     165    } else InRangeLat(coord2,TypUniteD);
     166
     167    if     (typ&TypCoordGal) rc=TypCoordGalStd;
     168    else if(typ&TypCoordHor) rc=TypCoordHorStd;
     169    else if(typ&TypCoordEcl) rc=TypCoordEclStd;
     170
     171  } else {          // Systeme de coordonnees non-connu
     172    rc=TypCoordUndef;
    134173  }
    135174
    136175  return rc;
     176}
     177
     178/*! \ingroup XAstroPack
     179\brief Retourne te type d'unite pour la coordonnee "coordnum"
     180       pour un TypAstroCoord valant "typ"
     181\verbatim
     182   coordnum : numero de coordonnee: 1 ou 2
     183   retourne: TypUniteH si la coordonnee est en heure
     184             TypUniteD si la coordonnee est en degre
     185             TypUniteR si la coordonnee est en radian
     186             TypUniteR par defaut
     187             TypCoordUndef si le numero de coordonnee est errone.
     188\endverbatim
     189*/
     190unsigned long GetCoordUnit(int coordnum,unsigned long typ)
     191{
     192 if(coordnum==1) {
     193   if     (typ&TypCoord1H) return TypUniteH;
     194   else if(typ&TypCoord1D) return TypUniteD;
     195   else if(typ&TypCoord1R) return TypUniteR;
     196   else                    return TypUniteR;
     197 }
     198 if(coordnum==2) {
     199   if     (typ&TypCoord2H) return TypUniteH;
     200   else if(typ&TypCoord2D) return TypUniteD;
     201   else if(typ&TypCoord2R) return TypUniteR;
     202   else                    return TypUniteR;
     203 }
     204 return TypCoordUndef;
     205}
     206
     207/*! \ingroup XAstroPack
     208\brief Pour decoder et transcrire en TypAstroCoord une chaine
     209       donnant la structure du systeme de coordonnees.
     210\verbatim
     211  ctype = "CAaBb"
     212    C: type de coordonnees: E Equatoriales
     213                            G Galactiques
     214                            H Horizontales
     215                            S Ecliptiques
     216                            pas de defaut
     217    A: unite de la coordonnee 1 (alpha,longitude etc...)
     218                            H heure
     219                            D degre
     220                            R radian
     221                            defaut radian
     222    a: type d'intervalle pour la coordonnee 1
     223                            C intervalle [0,24[ [0,360[ [0,2*Pi[
     224                            L intervalle [-12,12[ [-180,180[ [-Pi,Pi[
     225                            (defaut: C)
     226    A: unite de la coordonnee 2 (delta,latitude etc...)
     227                            H heure
     228                            D degre
     229                            R radian
     230                            defaut radian
     231    a: type d'intervalle pour la coordonnee 2
     232                            C intervalle [0,12] [0,180] [0,Pi]
     233                              (type colatitude)
     234                            L intervalle [-6,6] [-90,90][ [-Pi/2,Pi/2]
     235                            (defaut: L)
     236
     237    Exemple: GDCDL : galactiques long=[0,360[ lat=[-90,90]
     238             GDxDx ou GDxD: idem
     239             Gxxxx ou G : galactiques long=[0,2*Pi[ lat=[-Pi/2,Pi/2]
     240    Exemple: EHCDL : equatoriales alpha=[0,24[ delta=[-90,90]
     241             EHxDx ou EHxD : idem
     242             Exxxx ou E : equatoriales alpha=[0,2*Pi[ delta=[-Pi/2,Pi/2]
     243                           
     244  - Retourne 0 si probleme dans la chaine
     245\endverbatim
     246*/
     247unsigned long DecodeTypAstro(const char *ctype)
     248{
     249  if(ctype==NULL) return TypCoordUndef;
     250  int len = strlen(ctype);
     251  if(len<1) return TypCoordUndef;
     252
     253  unsigned long typ=0;
     254  // Le type de systeme de coordonnees
     255  int i = 0;
     256  if     (ctype[i]=='e' || ctype[i]=='E') typ=TypCoordEq;
     257  else if(ctype[i]=='g' || ctype[i]=='G') typ=TypCoordGal;
     258  else if(ctype[i]=='h' || ctype[i]=='H') typ=TypCoordHor;
     259  else if(ctype[i]=='s' || ctype[i]=='S') typ=TypCoordEcl;
     260  else return TypCoordUndef;
     261  // La coordonnee 1
     262  i = 1;
     263  if(i>=len)
     264    {typ |= TypCoord1R|TypCoord1C|TypCoord2R|TypCoord2L; return typ;}
     265  if     (ctype[i]=='h' || ctype[i]=='H') typ |= TypCoord1H;
     266  else if(ctype[i]=='d' || ctype[i]=='D') typ |= TypCoord1D;
     267  else if(ctype[i]=='r' || ctype[i]=='R') typ |= TypCoord1R;
     268  else                                    typ |= TypCoord1R;
     269  i = 2;
     270  if(i>=len) {typ |= TypCoord1C|TypCoord2R|TypCoord2L; return typ;}
     271  if     (ctype[i]=='c' || ctype[i]=='C') typ |= TypCoord1C;
     272  else if(ctype[i]=='l' || ctype[i]=='L') typ |= TypCoord1L;
     273  else                                    typ |= TypCoord1C;
     274  // La coordonnee 2
     275  i = 3;
     276  if(i>=len) {typ |= TypCoord2R|TypCoord2L; return typ;}
     277  if     (ctype[i]=='h' || ctype[i]=='H') typ |= TypCoord2H;
     278  else if(ctype[i]=='d' || ctype[i]=='D') typ |= TypCoord2D;
     279  else if(ctype[i]=='r' || ctype[i]=='R') typ |= TypCoord2R;
     280  else                                    typ |= TypCoord2R;
     281  i = 4;
     282  if(i>=len) {typ |= TypCoord2L; return typ;}
     283  if     (ctype[i]=='c' || ctype[i]=='C') typ |= TypCoord2C;
     284  else if(ctype[i]=='l' || ctype[i]=='L') typ |= TypCoord2L;
     285  else                                    typ |= TypCoord2L;
     286  // Return
     287  return typ;
     288}
     289
     290/*! \ingroup XAstroPack
     291\brief Idem DecodeTypAstro(char *) mais a l'envers
     292*/
     293string DecodeTypAstro(unsigned long typ)
     294{
     295 string s = "";
     296
     297 if     (typ&TypCoordEq)  s += "E";
     298 else if(typ&TypCoordGal) s += "G";
     299 else if(typ&TypCoordHor) s += "H";
     300 else if(typ&TypCoordEcl) s += "S";
     301 else                     s += "x";
     302
     303 if     (typ&TypCoord1H) s += "H";
     304 else if(typ&TypCoord1D) s += "D";
     305 else if(typ&TypCoord1R) s += "R";
     306 else                    s += "x";
     307
     308 if     (typ&TypCoord1C) s += "C";
     309 else if(typ&TypCoord1L) s += "L";
     310 else                    s += "x";
     311
     312 if     (typ&TypCoord2H) s += "H";
     313 else if(typ&TypCoord2D) s += "D";
     314 else if(typ&TypCoord2R) s += "R";
     315 else                    s += "x";
     316
     317 if     (typ&TypCoord2C) s += "C";
     318 else if(typ&TypCoord2L) s += "L";
     319 else                    s += "x";
     320
     321 return s;
     322}
     323
     324/*! \ingroup XAstroPack
     325\brief Pour convertir la latitude en colatitude et vice-versa (in place)
     326\verbatim
     327  val = valeur a convertir qui doit etre:
     328      si type "latitude"   dans [-6,6] [-90,90] [-Pi/2,Pi/2]
     329      si type "colatitude" dans [0,12] [0,180] [0,Pi]
     330  typ = type d'unite: heure  TypUniteH
     331                      degre  TypUniteD
     332                      radian TypUniteR
     333        (Defaut: radian TypUniteR)
     334\endverbatim
     335*/
     336void ToCoLat(double *val,unsigned long typ)
     337{
     338 if     (typ&TypUniteH) *val = 6.    - *val;
     339 else if(typ&TypUniteD) *val = 90.   - *val;
     340 else if(typ&TypUniteR) *val = PI/2. - *val;
     341 else *val = PI/2. - *val;
     342}
     343
     344/*! \ingroup XAstroPack
     345\brief Pour remettre la valeur de la COLATITUDE "val" dans la dynamique [0.,range]
     346\verbatim
     347  val = valeur a convertir qui doit etre mise dans [0,12] [0,180] [0,Pi]
     348  typ = type d'unite: heure  TypUniteH
     349                      degre  TypUniteD
     350                      radian TypUniteR
     351  ex en degre: 0 -> 0 ,  90 ->  90 ,  180 -> 180 ,  270 -> 90 ,  360 -> 0
     352                        -90 ->  90 , -180 -> 180 , -270 -> 90 , -360 -> 0
     353\endverbatim
     354*/
     355void InRangeCoLat(double *val,unsigned long typ)
     356{
     357 double range=PI;
     358 if(typ==TypUniteH) range=12.; else if(typ==TypUniteD) range=180.;
     359 InRange(val,2.*range,range);
     360 if(*val<0.) *val*=-1.;
     361}
     362
     363/*! \ingroup XAstroPack
     364\brief Pour remettre la valeur de la LATITUDE "val" dans la dynamique [-range/2,range/2]
     365\verbatim
     366  val = valeur a convertir qui doit etre mise dans [-6,6] [-90,90] [-Pi/2,Pi/2]
     367  typ = type d'unite: heure  TypUniteH
     368                      degre  TypUniteD
     369                      radian TypUniteR
     370  ex en degre: 0 -> 0 ,  90 ->  90 ,  180 -> 0 ,  270 -> -90 ,  360 -> 0
     371                        -90 -> -90 , -180 -> 0 , -270 ->  90 , -360 -> 0
     372\endverbatim
     373*/
     374void InRangeLat(double *val,unsigned long typ)
     375{
     376 double range = PI;
     377 if(typ==TypUniteH) range = 12.; else if(typ==TypUniteD) range = 180.;
     378 InRange(val,2.*range,range);
     379 if(*val>range/2.) *val = range - *val;
     380   else if(*val<-range/2.) *val = -(range + *val);
    137381}
    138382
  • trunk/SophyaExt/XAstroPack/xastropack.h

    r1791 r1808  
    1616
    1717enum TypAstroCoord {
    18   TypCoordUndef  =  (unsigned long)  (0),
    19 
    20   TypCoordH0     =  (unsigned long)  (1 << 10), // heure=[0,24[
    21   TypCoordH1     =  (unsigned long)  (1 << 11), // heure=]-12,12]
    22   TypCoordD0     =  (unsigned long)  (1 << 12), // degre=[0,360[
    23   TypCoordD1     =  (unsigned long)  (1 << 13), // degre=]-180,180]
    24   TypCoordD2     =  (unsigned long)  (1 << 14), // degre=[-90,90]
    25   TypCoordR0     =  (unsigned long)  (1 << 15), // degre=[0,2Pi[
    26   TypCoordR1     =  (unsigned long)  (1 << 16), // degre=]-Pi,Pi]
    27   TypCoordR2     =  (unsigned long)  (1 << 17), // degre=[-Pi/2,Pi/2]
    28 
    29   // Pour indiquer que les coordonnees sont en (heure=[0,24[,degre=[-90,90])
    30   TypCoordHD     =  (unsigned long)  (1 << 20),
    31   // Pour indiquer que les coordonnees sont en (degre=[0,360[,degre=[-90,90])
    32   TypCoordDD     =  (unsigned long)  (1 << 21),
    33   // Pour indiquer que les coordonnees sont en (radian=[0,2Pi[,radian=[-Pi/2,Pi/2])
    34   TypCoordRR     =  (unsigned long)  (1 << 22),
    35   // Pour indiquer que les coordonnees sont en (heure=]-12,12],degre=[-90,90])
    36   TypCoordH1D    =  (unsigned long)  (1 << 23),
    37   // Pour indiquer que les coordonnees sont en (degre=]-180,180],degre=[-90,90])
    38   TypCoordD1D    =  (unsigned long)  (1 << 24),
    39   // Pour indiquer que les coordonnees sont en (radian=]-Pi,Pi],radian=[-Pi/2,Pi/2])
    40   TypCoordR1R    =  (unsigned long)  (1 << 25),
    41 
     18  //------ Coordonnees de type (A,B) avec:
     19  //      A,B <==> alpha,delta
     20  //      A,B <==> longitude,latitude
     21  //      A,B <==> azimuth,altitude ou elevation
     22
     23  //------ Les unites des coordonnees
     24  TypUniteH       =  (unsigned long)  (1 << 0), // coord en heure
     25  TypUniteD       =  (unsigned long)  (1 << 1), // coord en degre
     26  TypUniteR       =  (unsigned long)  (1 << 2), // coord en radian
     27
     28  //------ Les unites des coordonnees A et B
     29  TypCoord1H      =  (unsigned long)  (1 << 3), // coord A en heure
     30  TypCoord1D      =  (unsigned long)  (1 << 4), // coord A en degre
     31  TypCoord1R      =  (unsigned long)  (1 << 5), // coord A en radian
     32  TypCoord2H      =  (unsigned long)  (1 << 6), // coord B en heure
     33  TypCoord2D      =  (unsigned long)  (1 << 7), // coord B en degre
     34  TypCoord2R      =  (unsigned long)  (1 << 8), // coord B en radian
     35
     36  //------ Le type d'intervalle des coordonnees A et B
     37  // Coord A intervalle... ex: [0,24[ ou [0,360[ ou [0,2Pi[
     38  TypCoord1C      =  (unsigned long)  (1 << 10),
     39  // Coord A intervalle centre... ex: ]-12,12] ou ]-180,180] ou ]-Pi,Pi]
     40  TypCoord1L      =  (unsigned long)  (1 << 11),
     41  // Coord B intervalle... ex:  [0,12] ou [0,180] ou [0,Pi] (colatitude)
     42  TypCoord2C      =  (unsigned long)  (1 << 12),
     43  // Coord B intervalle centre... ex: [-6,6] ou [-90,90] ou [-Pi/2,Pi/2] (latitude)
     44  TypCoord2L      =  (unsigned long)  (1 << 13),
     45
     46  //------ Les systemes de coordonnees astronomiques
    4247  // Coordonnees Equatoriales alpha,delta
    43   TypCoordEq     =  (unsigned long)  (1 << 0),
    44   TypCoordEqStd  =  (unsigned long) ((1 << 0) | (1 << 20)),
     48  TypCoordEq     =  (unsigned long)  (1 << 15),
    4549  // Coordonnees Galactiques gLong, gLat
    46   TypCoordGal    =  (unsigned long)  (1 << 1),
    47   TypCoordGalStd =  (unsigned long) ((1 << 1) | (1 << 21)),
     50  TypCoordGal    =  (unsigned long)  (1 << 16),
    4851  // Coordonnees Horizontales azimuth,altitude
    49   TypCoordHor    =  (unsigned long)  (1 << 2),
    50   TypCoordHorStd =  (unsigned long) ((1 << 2) | (1 << 21)),
     52  TypCoordHor    =  (unsigned long)  (1 << 17),
    5153  // Coordonnees Ecliptiques EclLong,EclLat
    52   TypCoordEcl    =  (unsigned long)  (1 << 3),
    53   TypCoordEclStd =  (unsigned long) ((1 << 3) | (1 << 21))
     54  TypCoordEcl    =  (unsigned long)  (1 << 18),
     55
     56  //------ Les systemes de coordonnees astronomiques "standard"
     57  // Coordonnees Equatoriales alpha,delta
     58  TypCoordEqStd     =  (unsigned long)  (TypCoordEq |TypCoord1C|TypCoord1H|TypCoord2L|TypCoord2D),
     59  // Coordonnees Galactiques gLong, gLat
     60  TypCoordGalStd    =  (unsigned long)  (TypCoordGal|TypCoord1C|TypCoord1D|TypCoord2L|TypCoord2D),
     61  // Coordonnees Horizontales azimuth,altitude
     62  TypCoordHorStd    =  (unsigned long)  (TypCoordHor|TypCoord1C|TypCoord1D|TypCoord2L|TypCoord2D),
     63  // Coordonnees Ecliptiques EclLong,EclLat
     64  TypCoordEclStd    =  (unsigned long)  (TypCoordEcl|TypCoord1C|TypCoord1D|TypCoord2L|TypCoord2D),
     65
     66  //------ undef pour la forme
     67  TypCoordUndef  =  (unsigned long)  (0)
    5468};
    5569
    5670// ------------------- Utilitaires -------------------
    57 int  CoordConvertToStd(TypAstroCoord typ,double& coord1,double& coord2);
     71unsigned long CoordConvertToStd(unsigned long typ,double* coord1,double* coord2);
     72unsigned long GetCoordUnit(int coordnum,unsigned long typ);
     73unsigned long DecodeTypAstro(const char *ctype);
     74inline unsigned long DecodeTypAstro(const string stype)
     75                {return DecodeTypAstro(stype.c_str());}
     76string        DecodeTypAstro(unsigned long typ);
     77void ToCoLat(double* val,unsigned long typ);
     78void InRangeLat(double* val,unsigned long typ);
     79void InRangeCoLat(double* val,unsigned long typ);
    5880
    5981/*!
     
    6486\verbatim
    6587  r>0 vmax>0
    66   r=24. vmax=24.   -> mets dans [  0,+24[ borne sup exclue
    67   r=24. vmax=12.   -> mets dans ]-12,+12] borne inf exclue
     88  r=24. vmax=24.   -> mets "val" dans [  0,+24[ borne sup exclue
     89  r=24. vmax=12.   -> mets "val" dans ]-12,+12] borne inf exclue
    6890  (ATTENTION: ca ne marche pas pour la latitude [-90,90]
    6991              car -90 ne peut etre inclus dans l'intervalle)
Note: See TracChangeset for help on using the changeset viewer.