Changeset 18939 for trunk/psModules/src/config/pmConfigCamera.c
- Timestamp:
- Aug 5, 2008, 5:40:45 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/psModules/src/config/pmConfigCamera.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/psModules/src/config/pmConfigCamera.c
r17993 r18939 23 23 static void removeChipConceptsSources(psMetadata *source); 24 24 25 // Generate the skycell version of a named camera configuration 26 bool pmConfigCameraSkycellVersion(psMetadata *system, // The system configuration 27 const char *name // Name of the un-mosaicked camera 28 ) 29 { 30 PS_ASSERT_METADATA_NON_NULL(system, false); 31 PS_ASSERT_STRING_NON_EMPTY(name, false); 32 33 bool mdok; // Status of MD lookup 34 psMetadata *cameras = psMetadataLookupMetadata(&mdok, system, "CAMERAS"); // List of cameras 35 if (!mdok || !cameras) { 36 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find CAMERAS in the system configuration.\n"); 37 return false; 38 } 39 if (!pmConfigGenerateSkycellVersion(cameras, cameras, name, system)) { 40 psError(PS_ERR_UNKNOWN, true, "Failed to build skycell camera description for %s\n", name); 41 return false; 42 } 43 return true; 25 psString pmConfigCameraRootName(const char *name) 26 { 27 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 28 29 if (name[0] != '_') { 30 // It's an original 31 return psStringCopy(name); 32 } 33 34 psString root = psStringCopy(name + 1); // Camera name 35 int length = strlen(name); // Length of camera name 36 if (strcmp(root + length - 9, "-SKYCELL") == 0) { 37 length -= 9; 38 } else if (strcmp(root + length - 6, "-CHIP") == 0) { 39 length -= 6; 40 } else if (strcmp(root + length - 5, "-FPA") == 0) { 41 length -= 5; 42 } else { 43 psError(PS_ERR_BAD_PARAMETER_VALUE, true, "Unrecognised derivative camera: %s", name); 44 psFree(root); 45 return NULL; 46 } 47 48 // Truncate the string 49 root[length] = '\0'; 50 51 return root; 52 } 53 54 psString pmConfigCameraSkycellName(const char *name) 55 { 56 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 57 58 psString root = pmConfigCameraRootName(name); // Root name of camera 59 if (!root) { 60 return NULL; 61 } 62 63 psStringAppend(&root, "-SKYCELL"); 64 psStringPrepend(&root, "_"); 65 66 return root; 67 } 68 69 psString pmConfigCameraChipName(const char *name) 70 { 71 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 72 73 psString root = pmConfigCameraRootName(name); // Root name of camera 74 if (!root) { 75 return NULL; 76 } 77 78 psStringAppend(&root, "-CHIP"); 79 psStringPrepend(&root, "_"); 80 81 return root; 82 } 83 84 psString pmConfigCameraFPAName(const char *name) 85 { 86 PS_ASSERT_STRING_NON_EMPTY(name, NULL); 87 88 psString root = pmConfigCameraRootName(name); // Root name of camera 89 if (!root) { 90 return NULL; 91 } 92 93 psStringAppend(&root, "-FPA"); 94 psStringPrepend(&root, "_"); 95 96 return root; 44 97 } 45 98
Note:
See TracChangeset
for help on using the changeset viewer.
