Move parseValue(pbf) to vector_tile.cpp
This code is specific to the vector tile format.
This commit is contained in:
@@ -1,6 +1,33 @@
|
||||
#include <mbgl/map/vector_tile.hpp>
|
||||
|
||||
using namespace mbgl;
|
||||
namespace mbgl {
|
||||
|
||||
Value parseValue(pbf data) {
|
||||
while (data.next())
|
||||
{
|
||||
switch (data.tag)
|
||||
{
|
||||
case 1: // string_value
|
||||
return data.string();
|
||||
case 2: // float_value
|
||||
return static_cast<double>(data.float32());
|
||||
case 3: // double_value
|
||||
return data.float64();
|
||||
case 4: // int_value
|
||||
return data.varint<int64_t>();
|
||||
case 5: // uint_value
|
||||
return data.varint<uint64_t>();
|
||||
case 6: // sint_value
|
||||
return data.svarint<int64_t>();
|
||||
case 7: // bool_value
|
||||
return data.boolean();
|
||||
default:
|
||||
data.skip();
|
||||
break;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
VectorTileFeature::VectorTileFeature(pbf feature_pbf, const VectorTileLayer& layer) {
|
||||
while (feature_pbf.next()) {
|
||||
@@ -130,3 +157,5 @@ VectorTileLayer::VectorTileLayer(pbf layer_pbf) {
|
||||
util::ptr<const GeometryTileFeature> VectorTileLayer::feature(std::size_t i) const {
|
||||
return std::make_shared<VectorTileFeature>(features.at(i), *this);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user