[core] Use geometry.hpp feature type

This commit is contained in:
John Firebaugh
2016-04-29 18:28:34 -07:00
parent 01b3eac52f
commit c8391729c7
37 changed files with 283 additions and 82 deletions

2
.mason

Submodule .mason updated: ce43228028...2d75da369d

View File

@@ -6,6 +6,7 @@
'type': 'executable',
'dependencies': [
'core',
'platform-lib',
'copy_certificate_bundle',
],

View File

@@ -6,6 +6,7 @@
'type': 'executable',
'dependencies': [
'core',
'platform-lib',
'copy_certificate_bundle',
],

View File

@@ -35,6 +35,8 @@
'platform/node/src/node_map.cpp',
'platform/node/src/node_request.hpp',
'platform/node/src/node_request.cpp',
'platform/node/src/node_feature.hpp',
'platform/node/src/node_feature.cpp',
'platform/node/src/util/async_queue.hpp',
],

1
configure vendored
View File

@@ -110,6 +110,7 @@ print_flags libuv static_libs cflags ldflags
print_flags zlib static_libs cflags ldflags
print_flags nunicode static_libs cflags ldflags
print_flags libzip static_libs cflags ldflags
print_flags geometry static_libs cflags ldflags
print_flags geojsonvt static_libs cflags ldflags
print_flags variant static_libs cflags ldflags
print_flags rapidjson static_libs cflags ldflags

View File

@@ -7,6 +7,7 @@
#include <mbgl/map/update.hpp>
#include <mbgl/map/mode.hpp>
#include <mbgl/util/geo.hpp>
#include <mbgl/util/feature.hpp>
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/annotation/annotation.hpp>
#include <mbgl/style/types.hpp>
@@ -159,8 +160,8 @@ public:
void removeCustomLayer(const std::string& id);
// Feature queries
std::vector<std::string> queryRenderedFeatures(const ScreenCoordinate&, const optional<std::vector<std::string>>& layerIDs = {});
std::vector<std::string> queryRenderedFeatures(const std::array<ScreenCoordinate, 2>&, const optional<std::vector<std::string>>& layerIDs = {});
std::vector<Feature> queryRenderedFeatures(const ScreenCoordinate&, const optional<std::vector<std::string>>& layerIDs = {});
std::vector<Feature> queryRenderedFeatures(const std::array<ScreenCoordinate, 2>&, const optional<std::vector<std::string>>& layerIDs = {});
// Memory
void setSourceTileCacheSize(size_t);

View File

@@ -0,0 +1,19 @@
#pragma once
#include <mbgl/util/optional.hpp>
#include <mapbox/geometry/feature.hpp>
namespace mbgl {
using Value = mapbox::geometry::value;
class Feature : public mapbox::geometry::feature<double> {
public:
Feature(geometry_type&& geometry_)
: mapbox::geometry::feature<double> { std::move(geometry_) } {}
optional<Value> id {};
};
} // namespace mbgl

View File

@@ -174,6 +174,7 @@
'<@(opengl_cflags)',
'<@(protozero_cflags)',
'<@(boost_cflags)',
'<@(geometry_cflags)',
'<@(geojsonvt_cflags)',
'<@(rapidjson_cflags)',
'<@(variant_cflags)',
@@ -288,10 +289,12 @@
'direct_dependent_settings': {
'cflags_cc': [
'<@(variant_cflags)',
'<@(geometry_cflags)',
],
'xcode_settings': {
'OTHER_CPLUSPLUSFLAGS': [
'<@(variant_cflags)',
'<@(geometry_cflags)',
],
},
},

View File

@@ -8,6 +8,7 @@ SQLITE_VERSION=3.9.1
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
LIBZIP_VERSION=0.11.2
GEOMETRY_VERSION=0.1.0
GEOJSONVT_VERSION=4.1.2
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2

View File

@@ -5,7 +5,6 @@
#import <UIKit/UIKit.h>
#endif
#import <mbgl/map/map.hpp>
#import <mbgl/util/geo.hpp>
/// Returns the smallest rectangle that contains both the given rectangle and

View File

@@ -1591,6 +1591,7 @@
"$(zlib_cflags)",
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
);
OTHER_LDFLAGS = (
"$(sqlite_ldflags)",
@@ -1630,6 +1631,7 @@
"$(zlib_cflags)",
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
);
OTHER_LDFLAGS = (
"$(sqlite_ldflags)",
@@ -1682,6 +1684,7 @@
"$(zlib_cflags)",
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
);
OTHER_LDFLAGS = (
"-ObjC",
@@ -1711,6 +1714,7 @@
"$(zlib_cflags)",
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
);
OTHER_LDFLAGS = (
"-ObjC",

View File

@@ -4,6 +4,7 @@ PROTOZERO_VERSION=1.3.0
BOOST_VERSION=1.60.0
SQLITE_VERSION=system
ZLIB_VERSION=system
GEOMETRY_VERSION=0.1.0
GEOJSONVT_VERSION=4.1.2
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2

View File

@@ -11,6 +11,7 @@ SQLITE_VERSION=3.9.1
LIBUV_VERSION=1.7.5
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
GEOMETRY_VERSION=0.1.0
GEOJSONVT_VERSION=4.1.2
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2

View File

@@ -0,0 +1,172 @@
#include "node_feature.hpp"
namespace node_mbgl {
using namespace mapbox::geometry;
using Value = mbgl::Value;
using Feature = mbgl::Feature;
using Geometry = mbgl::Feature::geometry_type;
using Properties = mbgl::Feature::property_map;
template <class T>
struct ToType {
public:
v8::Local<v8::String> operator()(const point<T>&) {
return type("Point");
}
v8::Local<v8::String> operator()(const line_string<T>&) {
return type("LineString");
}
v8::Local<v8::String> operator()(const polygon<T>&) {
return type("Polygon");
}
v8::Local<v8::String> operator()(const multi_point<T>&) {
return type("MultiPoint");
}
v8::Local<v8::String> operator()(const multi_line_string<T>&) {
return type("MultiLineString");
}
v8::Local<v8::String> operator()(const multi_polygon<T>&) {
return type("MultiPolygon");
}
v8::Local<v8::String> operator()(const geometry_collection<T>&) {
return type("GeometryCollection");
}
private:
v8::Local<v8::String> type(const char* type) {
Nan::EscapableHandleScope scope;
return scope.Escape(Nan::New(type).ToLocalChecked());
}
};
template <class T>
struct ToCoordinates {
public:
// Handles line_string, multi_point, multi_line_string, and multi_polygon.
template <class E>
v8::Local<v8::Object> operator()(const std::vector<E>& vector) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>(vector.size());
for (std::size_t i = 0; i < vector.size(); ++i) {
Nan::Set(result, i, operator()(vector[i]));
}
return scope.Escape(result);
}
v8::Local<v8::Object> operator()(const point<T>& point) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>(2);
Nan::Set(result, 0, Nan::New(point.x));
Nan::Set(result, 1, Nan::New(point.y));
return scope.Escape(result);
}
v8::Local<v8::Object> operator()(const polygon<T>& polygon) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>(1 + polygon.interior_rings.size());
Nan::Set(result, 0, operator()(polygon.exterior_ring));
for (std::size_t i = 0; i < polygon.interior_rings.size(); ++i) {
Nan::Set(result, i + 1, operator()(polygon.interior_rings[i]));
}
return scope.Escape(result);
}
v8::Local<v8::Object> operator()(const geometry_collection<T>& collection) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>(collection.size());
for (std::size_t i = 0; i < collection.size(); ++i) {
Nan::Set(result, i, toJS(collection[i]));
}
return scope.Escape(result);
}
};
struct ToValue {
v8::Local<v8::Value> operator()(bool t) {
Nan::EscapableHandleScope scope;
return scope.Escape(Nan::New(t));
}
v8::Local<v8::Value> operator()(int64_t t) {
return operator()(double(t));
}
v8::Local<v8::Value> operator()(uint64_t t) {
return operator()(double(t));
}
v8::Local<v8::Value> operator()(double t) {
Nan::EscapableHandleScope scope;
return scope.Escape(Nan::New(t));
}
v8::Local<v8::Value> operator()(const std::string& t) {
Nan::EscapableHandleScope scope;
return scope.Escape(Nan::New(t).ToLocalChecked());
}
v8::Local<v8::Value> operator()(const std::vector<mbgl::Value>& array) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Array> result = Nan::New<v8::Array>();
for (unsigned int i = 0; i < array.size(); i++) {
result->Set(i, toJS(array[i]));
}
return scope.Escape(result);
}
v8::Local<v8::Value> operator()(const std::unordered_map<std::string, mbgl::Value>& map) {
return toJS(map);
}
};
v8::Local<v8::Object> toJS(const Geometry& geometry) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Object> result = Nan::New<v8::Object>();
Nan::Set(result, Nan::New("type").ToLocalChecked(), Geometry::visit(geometry, ToType<double>()));
Nan::Set(result, Nan::New("coordinates").ToLocalChecked(), Geometry::visit(geometry, ToCoordinates<double>()));
return scope.Escape(result);
}
v8::Local<v8::Value> toJS(const Value& value) {
return Value::visit(value, ToValue());
}
v8::Local<v8::Object> toJS(const Properties& properties) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Object> result = Nan::New<v8::Object>();
for (const auto& property : properties) {
Nan::Set(result, Nan::New(property.first).ToLocalChecked(), toJS(property.second));
}
return scope.Escape(result);
}
v8::Local<v8::Object> toJS(const Feature& feature) {
Nan::EscapableHandleScope scope;
v8::Local<v8::Object> result = Nan::New<v8::Object>();
Nan::Set(result, Nan::New("type").ToLocalChecked(), Nan::New("Feature").ToLocalChecked());
Nan::Set(result, Nan::New("geometry").ToLocalChecked(), toJS(feature.geometry));
Nan::Set(result, Nan::New("properties").ToLocalChecked(), toJS(feature.properties));
if (feature.id) {
Nan::Set(result, Nan::New("id").ToLocalChecked(), toJS(*feature.id));
}
return scope.Escape(result);
}
}

View File

@@ -0,0 +1,18 @@
#pragma once
#include <mbgl/util/feature.hpp>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-parameter"
#pragma GCC diagnostic ignored "-Wshadow"
#include <nan.h>
#pragma GCC diagnostic pop
namespace node_mbgl {
v8::Local<v8::Value> toJS(const mbgl::Value&);
v8::Local<v8::Object> toJS(const mbgl::Feature&);
v8::Local<v8::Object> toJS(const mbgl::Feature::geometry_type&);
v8::Local<v8::Object> toJS(const mbgl::Feature::property_map&);
}

View File

@@ -1,5 +1,6 @@
#include "node_map.hpp"
#include "node_request.hpp"
#include "node_feature.hpp"
#include <mbgl/platform/default/headless_display.hpp>
#include <mbgl/util/exception.hpp>
@@ -465,7 +466,7 @@ NAN_METHOD(NodeMap::QueryRenderedFeatures) {
}
try {
std::vector<std::string> result;
std::vector<mbgl::Feature> result;
if (Nan::Get(posOrBox, 0).ToLocalChecked()->IsArray()) {
@@ -490,7 +491,7 @@ NAN_METHOD(NodeMap::QueryRenderedFeatures) {
auto array = Nan::New<v8::Array>();
for (unsigned int i = 0; i < result.size(); i++) {
array->Set(i, Nan::New<v8::String>(result[i]).ToLocalChecked());
array->Set(i, toJS(result[i]));
}
info.GetReturnValue().Set(array);
} catch (const std::exception &ex) {

View File

@@ -51,8 +51,7 @@ module.exports = function (style, options, callback) {
callback(err, pixels, results.map(prepareFeatures));
});
function prepareFeatures(json) {
var r = JSON.parse(json);
function prepareFeatures(r) {
delete r.layer;
r.geometry = null;
return r;

View File

@@ -943,6 +943,7 @@
"$(zlib_cflags)",
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
);
OTHER_LDFLAGS = (
"$(zlib_ldflags)",
@@ -981,6 +982,7 @@
"$(zlib_cflags)",
"$(rapidjson_cflags)",
"$(variant_cflags)",
"$(geometry_cflags)",
);
OTHER_LDFLAGS = (
"$(zlib_ldflags)",

View File

@@ -7,6 +7,7 @@ GLFW_VERSION=3.1.2
SQLITE_VERSION=3.9.1
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
GEOMETRY_VERSION=0.1.0
GEOJSONVT_VERSION=4.1.2
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2

View File

@@ -2,6 +2,7 @@
PROTOZERO_VERSION=1.3.0
BOOST_VERSION=1.60.0
GEOMETRY_VERSION=0.1.0
GEOJSONVT_VERSION=4.1.2
GTEST_VERSION=1.7.0
LIBJPEG_TURBO_VERSION=1.4.2

View File

@@ -5,8 +5,6 @@
#include <mbgl/layer/symbol_layer.hpp>
#include <mbgl/util/get_geometries.hpp>
#include <mbgl/text/collision_tile.hpp>
#include <mbgl/util/rapidjson.hpp>
#include <rapidjson/writer.h>
#include <mbgl/util/constants.hpp>
#include <cassert>
@@ -61,7 +59,7 @@ bool topDownSymbols(const IndexedSubfeature& a, const IndexedSubfeature& b) {
}
void FeatureIndex::query(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCollection& queryGeometry,
const float bearing,
const double tileSize,
@@ -116,7 +114,7 @@ void FeatureIndex::query(
}
void FeatureIndex::addFeature(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const IndexedSubfeature& indexedFeature,
const GeometryCollection& queryGeometry,
const optional<std::vector<std::string>>& filterLayerIDs,
@@ -131,8 +129,8 @@ void FeatureIndex::addFeature(
auto sourceLayer = geometryTile.getLayer(indexedFeature.sourceLayerName);
assert(sourceLayer);
auto feature = sourceLayer->getFeature(indexedFeature.index);
assert(feature);
auto geometryTileFeature = sourceLayer->getFeature(indexedFeature.index);
assert(geometryTileFeature);
for (auto& layerID : layerIDs) {
@@ -142,49 +140,19 @@ void FeatureIndex::addFeature(
if (!styleLayer) continue;
if (!styleLayer->is<SymbolLayer>()) {
auto geometries = getGeometries(*feature);
auto geometries = getGeometries(*geometryTileFeature);
if (!styleLayer->queryIntersectsGeometry(queryGeometry, geometries, bearing, pixelsToTileUnits)) continue;
}
auto& layerResult = result[layerID];
Feature feature { mapbox::geometry::point<double>() };
feature.properties = geometryTileFeature->getProperties();
auto properties = feature->getProperties();
rapidjson::StringBuffer buffer;
buffer.Clear();
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
writer.StartObject();
writer.Key("type");
writer.String("Feature");
auto id = feature->getID();
optional<uint64_t> id = geometryTileFeature->getID();
if (id) {
writer.Key("id");
writer.Double(feature->getID());
feature.id = Value(*id);
}
writer.Key("properties");
writer.StartObject();
for (auto& prop : properties) {
std::string key = prop.first;
Value& value = prop.second;
writer.Key(key.c_str());
if (value.is<std::string>()) {
writer.String(value.get<std::string>().c_str());
} else if (value.is<bool>()) {
writer.Bool(value.get<bool>());
} else if (value.is<int64_t>()) {
writer.Int64(value.get<int64_t>());
} else if (value.is<uint64_t>()) {
writer.Uint64(value.get<uint64_t>());
} else if (value.is<double>()) {
writer.Double(value.get<double>());
}
}
writer.EndObject();
writer.EndObject();
layerResult.push_back(buffer.GetString());
result[layerID].push_back(std::move(feature));
}
}

View File

@@ -3,6 +3,7 @@
#include <mbgl/tile/geometry_tile.hpp>
#include <mbgl/util/grid_index.hpp>
#include <mbgl/util/feature.hpp>
#include <vector>
#include <string>
@@ -29,7 +30,7 @@ class FeatureIndex {
void insert(const GeometryCollection&, std::size_t index, const std::string& sourceLayerName, const std::string& bucketName);
void query(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCollection& queryGeometry,
const float bearing,
const double tileSize,
@@ -52,7 +53,7 @@ class FeatureIndex {
private:
void addFeature(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const IndexedSubfeature &indexedFeature,
const GeometryCollection& queryGeometry,
const optional<std::vector<std::string>>& filterLayerIDs,

View File

@@ -722,14 +722,14 @@ std::vector<TileCoordinate> pointsToCoordinates(const std::vector<ScreenCoordina
return queryGeometry;
}
std::vector<std::string> Map::queryRenderedFeatures(const ScreenCoordinate& point, const optional<std::vector<std::string>>& layerIDs) {
std::vector<Feature> Map::queryRenderedFeatures(const ScreenCoordinate& point, const optional<std::vector<std::string>>& layerIDs) {
if (!impl->style) return {};
auto queryGeometry = pointsToCoordinates({ point }, impl->transform.getState());
return impl->style->queryRenderedFeatures(queryGeometry, impl->transform.getZoom(), impl->transform.getAngle(), layerIDs);
}
std::vector<std::string> Map::queryRenderedFeatures(const std::array<ScreenCoordinate, 2>& box, const optional<std::vector<std::string>>& layerIDs) {
std::vector<Feature> Map::queryRenderedFeatures(const std::array<ScreenCoordinate, 2>& box, const optional<std::vector<std::string>>& layerIDs) {
if (!impl->style) return {};
std::vector<ScreenCoordinate> queryPoints {

View File

@@ -498,13 +498,13 @@ struct TileQuery {
double scale;
};
std::unordered_map<std::string, std::vector<std::string>> Source::queryRenderedFeatures(
std::unordered_map<std::string, std::vector<Feature>> Source::queryRenderedFeatures(
const std::vector<TileCoordinate>& queryGeometry,
const double zoom,
const double bearing,
const optional<std::vector<std::string>>& layerIDs) {
std::unordered_map<std::string, std::vector<std::string>> result;
std::unordered_map<std::string, std::vector<Feature>> result;
double minX = std::numeric_limits<double>::infinity();
double minY = std::numeric_limits<double>::infinity();

View File

@@ -7,6 +7,7 @@
#include <mbgl/util/mat4.hpp>
#include <mbgl/util/rapidjson.hpp>
#include <mbgl/util/feature.hpp>
#include <forward_list>
#include <vector>
@@ -72,7 +73,7 @@ public:
std::forward_list<Tile *> getLoadedTiles() const;
const std::vector<Tile*>& getTiles() const;
std::unordered_map<std::string, std::vector<std::string>> queryRenderedFeatures(
std::unordered_map<std::string, std::vector<Feature>> queryRenderedFeatures(
const std::vector<TileCoordinate>& queryGeometry,
const double zoom,
const double bearing,

View File

@@ -1,7 +1,7 @@
#pragma once
#include <mbgl/util/variant.hpp>
#include <mbgl/util/value.hpp>
#include <mbgl/util/feature.hpp>
#include <string>
#include <vector>

View File

@@ -121,6 +121,16 @@ private:
!std::is_arithmetic<T1>::value || std::is_same<T1, bool>::value, bool> {
return false;
}
bool operator()(const std::vector<Value>&,
const std::vector<Value>&) const {
return false;
}
bool operator()(const std::unordered_map<std::string, Value>&,
const std::unordered_map<std::string, Value>&) const {
return false;
}
};
template <class Op>

View File

@@ -314,18 +314,17 @@ RenderData Style::getRenderData() const {
return result;
}
std::vector<std::string> Style::queryRenderedFeatures(
std::vector<Feature> Style::queryRenderedFeatures(
const std::vector<TileCoordinate>& queryGeometry,
const double zoom,
const double bearing,
const optional<std::vector<std::string>>& layerIDs) {
std::vector<std::unordered_map<std::string, std::vector<std::string>>> sourceResults;
std::vector<std::unordered_map<std::string, std::vector<Feature>>> sourceResults;
for (const auto& source : sources) {
sourceResults.emplace_back(source->queryRenderedFeatures(queryGeometry, zoom, bearing, layerIDs));
}
std::vector<std::string> features;
std::vector<Feature> features;
auto featuresInserter = std::back_inserter(features);
// Combine all results based on the style layer order.

View File

@@ -13,6 +13,7 @@
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/worker.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/feature.hpp>
#include <cstdint>
#include <string>
@@ -108,7 +109,7 @@ public:
RenderData getRenderData() const;
std::vector<std::string> queryRenderedFeatures(
std::vector<Feature> queryRenderedFeatures(
const std::vector<TileCoordinate>& queryGeometry,
const double zoom,
const double bearing,

View File

@@ -1,7 +1,7 @@
#ifndef MBGL_MAP_GEOMETRY_TILE
#define MBGL_MAP_GEOMETRY_TILE
#include <mbgl/util/value.hpp>
#include <mbgl/util/feature.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/ptr.hpp>
#include <mbgl/util/vec.hpp>
@@ -39,8 +39,8 @@ public:
virtual ~GeometryTileFeature() = default;
virtual FeatureType getType() const = 0;
virtual optional<Value> getValue(const std::string& key) const = 0;
virtual std::unordered_map<std::string,Value> getProperties() const { return std::unordered_map<std::string,Value>{}; };
virtual uint64_t getID() const { return 0; }
virtual Feature::property_map getProperties() const { return Feature::property_map(); }
virtual optional<uint64_t> getID() const { return {}; }
virtual GeometryCollection getGeometries() const = 0;
virtual uint32_t getExtent() const { return defaultExtent; }
};

View File

@@ -30,7 +30,7 @@ void TileData::dumpDebugLogs() const {
}
void TileData::queryRenderedFeatures(
std::unordered_map<std::string, std::vector<std::string>>&,
std::unordered_map<std::string, std::vector<Feature>>&,
const GeometryCollection&,
const double,
const double,

View File

@@ -4,6 +4,7 @@
#include <mbgl/util/noncopyable.hpp>
#include <mbgl/util/chrono.hpp>
#include <mbgl/util/optional.hpp>
#include <mbgl/util/feature.hpp>
#include <mbgl/map/tile_id.hpp>
#include <mbgl/renderer/bucket.hpp>
#include <mbgl/text/placement_config.hpp>
@@ -85,7 +86,7 @@ public:
virtual void redoPlacement(const std::function<void()>&) {}
virtual void queryRenderedFeatures(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCollection& queryGeometry,
const double bearing,
const double tileSize,

View File

@@ -102,7 +102,7 @@ std::unordered_map<std::string,Value> VectorTileFeature::getProperties() const {
return properties;
}
uint64_t VectorTileFeature::getID() const {
optional<uint64_t> VectorTileFeature::getID() const {
return id;
}

View File

@@ -23,13 +23,13 @@ public:
FeatureType getType() const override { return type; }
optional<Value> getValue(const std::string&) const override;
std::unordered_map<std::string,Value> getProperties() const override;
uint64_t getID() const override;
optional<uint64_t> getID() const override;
GeometryCollection getGeometries() const override;
uint32_t getExtent() const override;
private:
const VectorTileLayer& layer;
uint64_t id = 0;
optional<uint64_t> id;
FeatureType type = FeatureType::Unknown;
packed_iter_type tags_iter;
packed_iter_type geometry_iter;

View File

@@ -191,7 +191,7 @@ void VectorTileData::redoPlacement(const std::function<void()>& callback) {
}
void VectorTileData::queryRenderedFeatures(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCollection& queryGeometry,
const double bearing,
const double tileSize,

View File

@@ -4,6 +4,7 @@
#include <mbgl/tile/tile_data.hpp>
#include <mbgl/tile/tile_worker.hpp>
#include <mbgl/text/placement_config.hpp>
#include <mbgl/util/feature.hpp>
#include <atomic>
#include <memory>
@@ -37,7 +38,7 @@ public:
bool hasData() const override;
void queryRenderedFeatures(
std::unordered_map<std::string, std::vector<std::string>>& result,
std::unordered_map<std::string, std::vector<Feature>>& result,
const GeometryCollection& queryGeometry,
const double bearing,
const double tileSize,

View File

@@ -1,9 +0,0 @@
#pragma once
#include <mbgl/util/variant.hpp>
namespace mbgl {
typedef variant<bool, int64_t, uint64_t, double, std::string> Value;
} // namespace mbgl