コード例 #1
0
static int        _setAtt(S57_geo *geoData, OGRFeatureH hFeature)
{
    int field_count = OGR_F_GetFieldCount(hFeature);
    for (int field_index=0; field_index<field_count; ++field_index) {
        if (OGR_F_IsFieldSet(hFeature, field_index)) {
            const char *propName  = OGR_Fld_GetNameRef(OGR_F_GetFieldDefnRef(hFeature,field_index));
            const char *propValue = OGR_F_GetFieldAsString(hFeature, field_index);

            S57_setAtt(geoData, propName, propValue);

            /* debug
            if (0 == g_strcmp0(S57_getName(geoData), "M_NPUB")) {
                PRINTF("DEBUG: M_NPUB-%i: %s --> %s\n", field_index, propName, propValue);
            }
            if (0 == g_strcmp0(S57_getName(geoData), "C_AGGR")) {
                PRINTF("DEBUG: C_AGGR-%i: %s --> %s\n", field_index, propName, propValue);
            }
            if (0 == g_strcmp0(S57_getName(geoData), "C_ASSO")) {
                PRINTF("DEBUG: C_ASSO-%i: %s --> %s\n", field_index, propName, propValue);
            }
            */
        }
    }

    // optimisation: direct link to the value of Att (GString)
    // save the search in attList
    GString  *scamin = S57_getAttVal(geoData, "SCAMIN");
    if ((NULL!=scamin) && (NULL!=scamin->str)){
        S57_setScamin(geoData, S52_atof(scamin->str));
    }

    return TRUE;
}
コード例 #2
0
ファイル: S57data.c プロジェクト: pcannon67/S52
double     S57_resetScamin(_S57_geo *geo)
// reset scamin from att val
{
    return_if_null(geo);

    if (NULL == geo->attribs)
        g_datalist_init(&geo->attribs);

    GString *valstr = S57_getAttVal(geo, "SCAMIN");

    //double val = (NULL==valstr) ? INFINITY : S52_atof(valstr->str);
    double val = (NULL==valstr) ? UNKNOWN : S52_atof(valstr->str);

    geo->scamin = val;

    return geo->scamin;
    //return geo->scamin = (NULL==S57_getAttVal(geo, "SCAMIN")) ? UNKNOWN : S52_atof(valstr->str);
}