Changeset 16936 for trunk/Ohana/src/opihi/dvo/dbExtractAverages.c
- Timestamp:
- Mar 11, 2008, 11:11:55 AM (18 years ago)
- File:
-
- 1 edited
-
trunk/Ohana/src/opihi/dvo/dbExtractAverages.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/dvo/dbExtractAverages.c
r16810 r16936 1 1 # include "dvoshell.h" 2 3 static CoordTransform *celestial_to_galactic = NULL; 4 static CoordTransform *celestial_to_ecliptic = NULL; 5 6 static int haveGalactic = FALSE; 7 static double GLON = 0.0; 8 static double GLAT = 0.0; 9 10 static int haveEcliptic = FALSE; 11 static double ELON = 0.0; 12 static double ELAT = 0.0; 13 14 // define a locally-static transform 15 int dbExtractAveragesInitTransform (CoordTransformSystem target) { 16 17 // galactic transform is kept forever 18 if (target == COORD_GALACTIC) { 19 if (celestial_to_galactic != NULL) return (TRUE); 20 celestial_to_galactic = InitTransform (COORD_CELESTIAL, target); 21 return (TRUE); 22 } 23 24 // ecliptic transform must be updated (is weakly time-dependent) 25 if (target == COORD_ECLIPTIC) { 26 if (celestial_to_ecliptic != NULL) { 27 free (celestial_to_ecliptic); 28 } 29 celestial_to_ecliptic = InitTransform (COORD_CELESTIAL, target); 30 return (TRUE); 31 } 32 return (FALSE); 33 } 34 35 int dbExtractAveragesInit () { 36 haveGalactic = FALSE; 37 haveEcliptic = FALSE; 38 return (TRUE); 39 } 2 40 3 41 /* return average.field based on the selection */ … … 16 54 case AVE_DEC: 17 55 value = average[0].D; 56 break; 57 case AVE_GLON: 58 if (!haveGalactic) { 59 ApplyTransform (&GLON, &GLAT, average[0].R, average[0].D, celestial_to_galactic); 60 haveGalactic = TRUE; 61 } 62 value = GLON; 63 break; 64 case AVE_GLAT: 65 if (!haveGalactic) { 66 ApplyTransform (&GLON, &GLAT, average[0].R, average[0].D, celestial_to_galactic); 67 haveGalactic = TRUE; 68 } 69 value = GLAT; 70 break; 71 case AVE_ELON: 72 if (!haveEcliptic) { 73 ApplyTransform (&ELON, &ELAT, average[0].R, average[0].D, celestial_to_ecliptic); 74 haveEcliptic = TRUE; 75 } 76 value = ELON; 77 break; 78 case AVE_ELAT: 79 if (!haveEcliptic) { 80 ApplyTransform (&ELON, &ELAT, average[0].R, average[0].D, celestial_to_ecliptic); 81 haveEcliptic = TRUE; 82 } 83 value = ELAT; 18 84 break; 19 85 case AVE_RA_ERR:
Note:
See TracChangeset
for help on using the changeset viewer.
