Example #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);

            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 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;
}
Example #2
0
GData     *S57_setAtt(_S57_geo *geoData, const char *name, const char *val)
{
    return_if_null(geoData);
    return_if_null(name);
    return_if_null(val);

    GQuark   qname = g_quark_from_string(name);
    GString *value = g_string_new(val);

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

#ifdef S52_USE_SUPP_LINE_OVERLAP
    //if ((0==S52_strncmp(S57_getName(geoData), "Edge", 4)) && (0==S52_strncmp(name, "RCID", 4))) {
    if ((0==g_strcmp0(S57_getName(geoData), "Edge")) && (0==g_strcmp0(name, "RCID"))) {
         geoData->rcidstr = value;
     }
#endif

    g_datalist_id_set_data_full(&geoData->attribs, qname, value, _string_free);

    return geoData->attribs;
}