IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26560


Ignore:
Timestamp:
Jan 11, 2010, 3:04:22 PM (16 years ago)
Author:
Paul Price
Message:

Ensure automatically generated cameras are put in the configuration file in the proper order, even if they already exist. Clobber if necessary.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/config/pmConfigCamera.c

    r26559 r26560  
    149149    camerasIter = psMetadataIteratorAlloc(new, PS_LIST_HEAD, NULL); // Iterator
    150150    while ((camerasItem = psMetadataGetAndIncrement(camerasIter))) {
    151         psMetadataAddItem(cameras, camerasItem, PS_LIST_HEAD, 0);
     151        psMetadataAddItem(cameras, camerasItem, PS_LIST_HEAD, PS_META_REPLACE);
    152152    }
    153153    psFree(camerasIter);
     
    211211    // See if the new one is already there
    212212    psString newName = pmConfigCameraSkycellName(name); // Name of skycelled camera
    213     if (psMetadataLookup(oldCameras, newName)) {
     213    bool mdok;                       // Status of MD lookup
     214    psMetadata *oldCam = psMetadataLookupMetadata(&mdok, oldCameras, newName); // Existing camera configuration
     215    if (mdok && oldCam) {
     216        // Ensure new camera goes to the head of the metadata, so that it will be recognised first
     217        // The old camera doesn't contain the PSMOSAIC header, so it will match anything!
     218        psTrace("psModules.config", 6, "Camera configuration for %s exists, so moving to the front.", newName);
     219        psMetadataAddMetadata(newCameras, PS_LIST_HEAD, newName, PS_META_REPLACE, NULL, oldCam);
    214220        psFree(newName);
    215221        return true;
     
    365371    // New camera MUST go to the head of the metadata, so that it will be recognised first
    366372    // The old camera doesn't contain the PSCAMERA and PSFORMAT headers, so it will match anything!
     373    psTrace("psModules.config", 6, "Generated new camera configuration for %s.", newName);
    367374    psMetadataAddMetadata(newCameras, PS_LIST_HEAD, newName, PS_META_REPLACE,
    368375                          "Automatically generated", new);
     
    435442    camerasIter = psMetadataIteratorAlloc(new, PS_LIST_HEAD, NULL); // Iterator
    436443    while ((camerasItem = psMetadataGetAndIncrement(camerasIter))) {
    437         psMetadataAddItem(cameras, camerasItem, PS_LIST_HEAD, 0);
     444        psMetadataAddItem(cameras, camerasItem, PS_LIST_HEAD, PS_META_REPLACE);
    438445    }
    439446    psFree(camerasIter);
     
    468475
    469476    // See if the new one is already there
    470     psString newName = NULL;       // Name of mosaicked camera
    471     psStringAppend(&newName, "_%s-%s", name, mosaicLevel == PM_FPA_LEVEL_CHIP ? "CHIP" : "FPA");
    472     if (psMetadataLookup(oldCameras, newName)) {
     477    psString newName = mosaicLevel == PM_FPA_LEVEL_CHIP ? pmConfigCameraChipName(name) :
     478        pmConfigCameraFPAName(name); // Name of mosaicked camera
     479    bool mdok;                       // Status of MD lookup
     480    psMetadata *oldCam = psMetadataLookupMetadata(&mdok, oldCameras, newName); // Existing camera configuration
     481    if (mdok && oldCam) {
     482        // Ensure new camera goes to the head of the metadata, so that it will be recognised first
     483        // The old camera doesn't contain the PSMOSAIC header, so it will match anything!
     484        psTrace("psModules.config", 6, "Camera configuration for %s exists, so moving to the front.", newName);
     485        psMetadataAddMetadata(newCameras, PS_LIST_HEAD, newName, PS_META_REPLACE, NULL, oldCam);
    473486        psFree(newName);
    474487        return true;
     
    476489
    477490    psMetadata *new = psMetadataCopy(NULL, camera); // Copy of the camera description
    478     bool mdok;                          // Status of MD lookups
    479491
    480492    // ** Fix up the contents of the FPA description to match the mosaicked camera **
     
    848860    // New camera MUST go to the head of the metadata, so that it will be recognised first
    849861    // The old camera doesn't contain the PSMOSAIC header, so it will match anything!
     862    psTrace("psModules.config", 6, "Generated new camera configuration for %s.", newName);
    850863    psMetadataAddMetadata(newCameras, PS_LIST_HEAD, newName, PS_META_REPLACE,
    851864                          "Automatically generated", new);
Note: See TracChangeset for help on using the changeset viewer.