Changeset 24419
- Timestamp:
- Jun 15, 2009, 3:49:50 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/concepts/pmConceptsStandard.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/concepts/pmConceptsStandard.c
r23819 r24419 36 36 // Format type for time 37 37 typedef enum { 38 TIME_FORMAT_YYYYMMDD, // Date stored in YYYY-MM-DD order (ISO-standard)39 TIME_FORMAT_DDMMYYYY, // Date stored in DD-MM-YYYY order40 TIME_FORMAT_MMDDYYYY, // Date stored in MM-DD-YYYY order41 TIME_FORMAT_JD, // Date stored as JD42 TIME_FORMAT_MJD, // Date stored as MJD38 TIME_FORMAT_YYYYMMDD, // Date stored in YYYY-MM-DD order (ISO-standard) 39 TIME_FORMAT_DDMMYYYY, // Date stored in DD-MM-YYYY order 40 TIME_FORMAT_MMDDYYYY, // Date stored in MM-DD-YYYY order 41 TIME_FORMAT_JD, // Date stored as JD 42 TIME_FORMAT_MJD, // Date stored as MJD 43 43 } conceptTimeFormatType; 44 44 … … 391 391 } 392 392 393 393 394 // FPA.RA and FPA.DEC 394 395 psMetadataItem *p_pmConceptFormat_FPA_Coords(const psMetadataItem *concept, … … 410 411 // How to interpret the coordinates 411 412 bool mdok = true; // Status of MD lookup 412 psMetadata *formats = psMetadataLookupMetadata(&mdok, 413 cameraFormat, 414 "FORMATS"); 413 psMetadata *formats = psMetadataLookupMetadata(&mdok, cameraFormat, "FORMATS"); 414 bool sexagesimal = false; // Write sexagesimal format? 415 415 if (mdok && formats) { 416 psString format = psMetadataLookupStr(&mdok, formats, concept->name);416 psString format = psMetadataLookupStr(&mdok, formats, concept->name); 417 417 if (mdok && strlen(format) > 0) { 418 418 if (strcasecmp(format, "HOURS") == 0) { … … 428 428 coords /= defaultCoordScaling(concept); 429 429 } 430 431 psString ra = psMetadataLookupStr(&mdok, formats, "FPA.RA"); // Format for RA 432 psString dec = psMetadataLookupStr(&mdok, formats, "FPA.DEC"); // Format for Dec 433 if (ra && strcasecmp(ra, "HOURS") == 0 && dec && strcasecmp(dec, "DEGREES") == 0) { 434 sexagesimal = true; 435 } 430 436 } else { 431 437 coords /= defaultCoordScaling(concept); 432 438 } 433 439 434 // We choose to write sexagesimal format 435 int big, medium; // Degrees and minutes 436 float small; // Seconds 437 bool negative = (coords < 0); // Are we working below zero? 438 coords = fabs(coords); 439 big = (int)abs(coords); 440 coords -= big; 441 medium = 60.0 * coords; 442 coords -= medium / 60.0; 443 small = 3600.0 * coords; 444 small = (float)((int)(small * 1000.0)) / 1000.0; 445 if (negative) { 446 big *= -1; 447 } 448 psString coordString = NULL; // String with the coordinates in sexagesimal format 449 psStringAppend(&coordString, "%d:%02d:%06.3f", big, medium, small); 450 psMetadataItem *coordItem = psMetadataItemAllocStr(concept->name, concept->comment, coordString); 451 psFree(coordString); 440 psMetadataItem *coordItem = NULL; // Item with coordinates, to return 441 if (sexagesimal) { 442 int big, medium; // Degrees and minutes 443 float small; // Seconds 444 bool negative = (coords < 0); // Are we working below zero? 445 coords = fabs(coords); 446 big = (int)abs(coords); 447 coords -= big; 448 medium = 60.0 * coords; 449 coords -= medium / 60.0; 450 small = 3600.0 * coords; 451 small = (float)((int)(small * 1000.0)) / 1000.0; 452 if (negative) { 453 big *= -1; 454 } 455 psString coordString = NULL; // String with the coordinates in sexagesimal format 456 psStringAppend(&coordString, "%d:%02d:%06.3f", big, medium, small); 457 coordItem = psMetadataItemAllocStr(concept->name, concept->comment, coordString); 458 psFree(coordString); 459 } else { 460 coordItem = psMetadataItemAllocF64(concept->name, concept->comment, coords); 461 } 452 462 453 463 return coordItem;
Note:
See TracChangeset
for help on using the changeset viewer.
