Пример #1
0
Value parseValue(protozero::pbf_reader data) {
    while (data.next())
    {
        switch (data.tag()) {
        case 1: // string_value
            return data.get_string();
        case 2: // float_value
            return static_cast<double>(data.get_float());
        case 3: // double_value
            return data.get_double();
        case 4: // int_value
            return data.get_int64();
        case 5: // uint_value
            return data.get_uint64();
        case 6: // sint_value
            return data.get_sint64();
        case 7: // bool_value
            return data.get_bool();
        default:
            data.skip();
            break;
        }
    }
    return false;
}
Пример #2
0
VectorTileFeature::VectorTileFeature(protozero::pbf_reader feature_pbf, const VectorTileLayer& layer_)
    : layer(layer_) {
    while (feature_pbf.next()) {
        switch (feature_pbf.tag()) {
        case 1: // id
            id = { feature_pbf.get_uint64() };
            break;
        case 2: // tags
            tags_iter = feature_pbf.get_packed_uint32();
            break;
        case 3: // type
            type = static_cast<FeatureType>(feature_pbf.get_enum());
            break;
        case 4: // geometry
            geometry_iter = feature_pbf.get_packed_uint32();
            break;
        default:
            feature_pbf.skip();
            break;
        }
    }
}