IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 24, 2006, 1:03:51 PM (20 years ago)
Author:
magnier
Message:

added photcode support

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfile.c

    r7618 r7679  
    114114}
    115115
    116 // XXX reconsider this function name / concept
    117 # if 0
    118 bool pmFPAfileAddFileNames (psMetadata *files, char *name, char *value, int mode)
    119 {
    120     PS_ASSERT_PTR_NON_NULL(files, false);
    121     PS_ASSERT_PTR_NON_NULL(name, false);
    122     PS_ASSERT_INT_POSITIVE(strlen(name), false);
    123     PS_ASSERT_PTR_NON_NULL(value, false);
    124     PS_ASSERT_INT_POSITIVE(strlen(value), false);
    125 
    126     // add the output names to the output-type files
    127     psMetadataItem *item = NULL;
    128     psMetadataIterator *iter = psMetadataIteratorAlloc (files, PS_LIST_HEAD, NULL);
    129     while ((item = psMetadataGetAndIncrement (iter)) != NULL) {
    130         pmFPAfile *file = item->data.V;
    131 
    132         if (file->mode == mode) {
    133             psMetadataAddStr (file->names, PS_LIST_TAIL, name, PS_META_NO_REPLACE, "", value);
    134         }
    135     }
    136     psFree (iter);
    137     return true;
    138 }
    139 # endif
    140 
    141116// select the rule from the camera configuration, perform substitutions as needed
    142117char *pmFPAfileNameFromRule (char *rule, pmFPAfile *file, const pmFPAview *view)
     
    166141        }
    167142    }
     143    if (strstr (newName, "{CHIP.N}") != NULL) {
     144        char *name = NULL;
     145        if (view->chip < 0) {
     146            psStringAppend (&name, "XX");
     147        } else {
     148            psStringAppend (&name, "%02d", view->chip);
     149        }
     150        newName = psStringSubstitute (newName, name, "{CHIP.N}");
     151        psFree (name);
     152    }
    168153    if (strstr (newName, "{CELL.NAME}") != NULL) {
    169154        pmCell *cell = pmFPAviewThisCell (view, file->fpa);
     
    175160        }
    176161    }
     162    if (strstr (newName, "{CELL.N}") != NULL) {
     163        char *name = NULL;
     164        if (view->cell < 0) {
     165            psStringAppend (&name, "XX");
     166        } else {
     167            psStringAppend (&name, "%02d", view->cell);
     168        }
     169        newName = psStringSubstitute (newName, name, "{CELL.N}");
     170    }
    177171    if (strstr (newName, "{EXTNAME}") != NULL) {
    178172        pmHDU *hdu = pmFPAviewThisHDU (view, file->fpa);
     
    181175        }
    182176    }
     177    if (strstr (newName, "{FILTER}") != NULL) {
     178        if (file->fpa != NULL) {
     179            char *name = psMetadataLookupStr (NULL, file->fpa->concepts, "FPA.FILTER");
     180            if (name != NULL) {
     181                newName = psStringSubstitute (newName, name, "{FILTER}");
     182            }
     183        }
     184    }
     185    if (strstr (newName, "{CAMERA}") != NULL) {
     186        if (file->fpa != NULL) {
     187            char *name = psMetadataLookupStr (NULL, file->fpa->concepts, "FPA.CAMERA");
     188            if (name != NULL) {
     189                newName = psStringSubstitute (newName, name, "{CAMERA}");
     190            }
     191        }
     192    }
     193    if (strstr (newName, "{FILTER.ID}") != NULL) {
     194        if (file->fpa != NULL) {
     195            char *filterName = psMetadataLookupStr (NULL, file->fpa->concepts, "FPA.FILTER");
     196            psMetadata *filterTable = psMetadataLookupPtr (NULL, file->camera, "FILTER.ID");
     197            if (filterName && filterTable) {
     198                char *ID = psMetadataLookupStr (NULL, filterTable, filterName);
     199                newName = psStringSubstitute (newName, ID, "{FILTER.ID}");
     200            }
     201        }
     202    }
    183203    return newName;
    184204}
Note: See TracChangeset for help on using the changeset viewer.