summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-06 16:11:47 +0200
committerBruno de Oliveira Abinader <bruno@mapbox.com>2018-11-13 15:00:25 +0200
commit8d0dbd8d844a535ccbed6cbb300b52d87a9bd1cf (patch)
tree16f97ea5e41b2666dec49ad087c36111bbe93377
parenta3945bf84004ece5116861266a73a60d67beebbe (diff)
downloadqtlocation-mapboxgl-upstream/geometry-v1.0.0.tar.gz
[build] Update to geometry v1.0.0upstream/geometry-v1.0.0
-rw-r--r--appveyor.yml2
-rw-r--r--benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp6
-rw-r--r--include/mbgl/annotation/annotation.hpp2
-rw-r--r--include/mbgl/util/feature.hpp12
-rw-r--r--include/mbgl/util/geometry.hpp3
-rw-r--r--platform/android/src/geojson/feature.cpp15
-rw-r--r--platform/android/src/geojson/geometry.cpp7
-rw-r--r--platform/darwin/src/MGLFeature.h8
-rw-r--r--platform/darwin/src/MGLFeature.mm41
-rw-r--r--platform/ios/src/MGLMapAccessibilityElement.h2
-rw-r--r--platform/ios/src/MGLMapView.mm2
-rw-r--r--platform/macos/src/MGLMapView.mm4
-rw-r--r--platform/node/src/node_feature.cpp8
-rw-r--r--src/mbgl/annotation/annotation_tile.cpp4
-rw-r--r--src/mbgl/annotation/annotation_tile.hpp2
-rw-r--r--src/mbgl/annotation/shape_annotation_impl.cpp2
-rw-r--r--src/mbgl/layout/symbol_feature.hpp2
-rw-r--r--src/mbgl/renderer/renderer.cpp7
-rw-r--r--src/mbgl/style/expression/compound_expression.cpp17
-rw-r--r--src/mbgl/style/expression/expression.cpp2
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.cpp12
-rw-r--r--src/mbgl/style/sources/geojson_source_impl.hpp2
-rw-r--r--src/mbgl/tile/custom_geometry_tile.cpp4
-rw-r--r--src/mbgl/tile/geojson_tile.cpp8
-rw-r--r--src/mbgl/tile/geojson_tile.hpp6
-rw-r--r--src/mbgl/tile/geojson_tile_data.hpp18
-rw-r--r--src/mbgl/tile/geometry_tile_data.hpp5
-rw-r--r--src/mbgl/tile/vector_tile_data.cpp2
-rw-r--r--src/mbgl/tile/vector_tile_data.hpp2
-rw-r--r--src/mbgl/util/tile_cover_impl.cpp4
-rw-r--r--test/api/annotations.test.cpp8
-rw-r--r--test/src/mbgl/test/stub_geometry_tile_feature.hpp6
-rw-r--r--test/style/filter.test.cpp6
-rw-r--r--test/tile/custom_geometry_tile.test.cpp18
-rw-r--r--test/tile/geojson_tile.test.cpp12
-rw-r--r--test/util/merge_lines.test.cpp2
m---------vendor/geojson-vt-cpp0
m---------vendor/geojson.hpp0
m---------vendor/geometry.hpp0
m---------vendor/kdbush.hpp0
m---------vendor/supercluster.hpp0
m---------vendor/vector-tile0
42 files changed, 162 insertions, 101 deletions
diff --git a/appveyor.yml b/appveyor.yml
index 394eb03bde..ef058d3c34 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -50,7 +50,7 @@ for:
LLVM_VERSION: 6.0.0
LLVM_HASH: 2501887b2f638d3f65b0336f354b96f8108b563522d81e841d5c88c34af283dd
VCVARSALL: 'C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat'
- QT_PREFIX: 'C:\Qt\5.11.1\msvc2017_64\lib\cmake'
+ QT_PREFIX: 'C:\Qt\5.11.2\msvc2017_64\lib\cmake'
cache:
- '%APPVEYOR_BUILD_FOLDER%\mason_packages'
diff --git a/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp b/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp
index e27aeeb48b..bff1a23ba8 100644
--- a/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp
+++ b/benchmark/src/mbgl/benchmark/stub_geometry_tile_feature.hpp
@@ -11,7 +11,7 @@ public:
: properties(std::move(properties_)) {
}
- StubGeometryTileFeature(optional<FeatureIdentifier> id_, FeatureType type_, GeometryCollection geometry_, PropertyMap properties_)
+ StubGeometryTileFeature(FeatureIdentifier id_, FeatureType type_, GeometryCollection geometry_, PropertyMap properties_)
: properties(std::move(properties_)),
id(std::move(id_)),
type(type_),
@@ -19,7 +19,7 @@ public:
}
PropertyMap properties;
- optional<FeatureIdentifier> id;
+ FeatureIdentifier id;
FeatureType type = FeatureType::Point;
GeometryCollection geometry;
@@ -27,7 +27,7 @@ public:
return type;
}
- optional<FeatureIdentifier> getID() const override {
+ FeatureIdentifier getID() const override {
return id;
}
diff --git a/include/mbgl/annotation/annotation.hpp b/include/mbgl/annotation/annotation.hpp
index 8c099141c4..fb9ea5eba2 100644
--- a/include/mbgl/annotation/annotation.hpp
+++ b/include/mbgl/annotation/annotation.hpp
@@ -12,7 +12,7 @@
namespace mbgl {
-using AnnotationID = uint32_t;
+using AnnotationID = uint64_t;
using AnnotationIDs = std::vector<AnnotationID>;
class SymbolAnnotation {
diff --git a/include/mbgl/util/feature.hpp b/include/mbgl/util/feature.hpp
index 4eeceda944..9e2286018c 100644
--- a/include/mbgl/util/feature.hpp
+++ b/include/mbgl/util/feature.hpp
@@ -2,15 +2,15 @@
#include <mbgl/util/optional.hpp>
-#include <mapbox/geometry/feature.hpp>
+#include <mapbox/feature.hpp>
namespace mbgl {
-using Value = mapbox::geometry::value;
-using NullValue = mapbox::geometry::null_value_t;
-using PropertyMap = mapbox::geometry::property_map;
-using FeatureIdentifier = mapbox::geometry::identifier;
-using Feature = mapbox::geometry::feature<double>;
+using Value = mapbox::feature::value;
+using NullValue = mapbox::feature::null_value_t;
+using PropertyMap = mapbox::feature::property_map;
+using FeatureIdentifier = mapbox::feature::identifier;
+using Feature = mapbox::feature::feature<double>;
template <class T>
optional<T> numericValue(const Value& value) {
diff --git a/include/mbgl/util/geometry.hpp b/include/mbgl/util/geometry.hpp
index a28c59a47d..17384f2224 100644
--- a/include/mbgl/util/geometry.hpp
+++ b/include/mbgl/util/geometry.hpp
@@ -13,6 +13,8 @@ enum class FeatureType : uint8_t {
Polygon = 3
};
+using EmptyGeometry = mapbox::geometry::empty;
+
template <class T>
using Point = mapbox::geometry::point<T>;
@@ -43,6 +45,7 @@ Point<S> convertPoint(const Point<T>& p) {
}
struct ToFeatureType {
+ FeatureType operator()(const EmptyGeometry&) const { return FeatureType::Unknown; }
template <class T>
FeatureType operator()(const Point<T> &) const { return FeatureType::Point; }
template <class T>
diff --git a/platform/android/src/geojson/feature.cpp b/platform/android/src/geojson/feature.cpp
index 767b145a89..8d30404a50 100644
--- a/platform/android/src/geojson/feature.cpp
+++ b/platform/android/src/geojson/feature.cpp
@@ -18,11 +18,12 @@ mbgl::Feature Feature::convert(jni::JNIEnv& env, const jni::Object<Feature>& jFe
auto jId = jFeature.Call(env, id);
+ using mbid = mapbox::feature::identifier;
+
return mbgl::Feature {
Geometry::convert(env, jFeature.Call(env, geometry)),
JsonObject::convert(env, jFeature.Call(env, properties)),
- jId ? std::experimental::optional<mapbox::geometry::identifier>(jni::Make<std::string>(env, jId))
- : std::experimental::nullopt
+ jId ? mbid { jni::Make<std::string>(env, jId) } : mbid { mapbox::feature::null_value }
};
}
@@ -41,7 +42,11 @@ public:
}
std::string operator()(const std::nullptr_t&) const {
- return "";
+ return {};
+ }
+
+ std::string operator()(const mapbox::feature::null_value_t&) const {
+ return {};
}
};
@@ -52,7 +57,7 @@ jni::Local<jni::Object<Feature>> convertFeature(jni::JNIEnv& env, const mbgl::Fe
return javaClass.Call(env, method,
Geometry::New(env, value.geometry),
JsonObject::New(env, value.properties),
- jni::Make<jni::String>(env, value.id ? value.id.value().match(FeatureIdVisitor()) : ""));
+ jni::Make<jni::String>(env, value.id.is<mbgl::NullValue>() ? std::string {} : value.id.match(FeatureIdVisitor())));
}
jni::Local<jni::Array<jni::Object<Feature>>> Feature::convert(jni::JNIEnv& env, const std::vector<mbgl::Feature>& value) {
@@ -71,4 +76,4 @@ void Feature::registerNative(jni::JNIEnv& env) {
} // namespace geojson
} // namespace android
-} // namespace mbgl \ No newline at end of file
+} // namespace mbgl
diff --git a/platform/android/src/geojson/geometry.cpp b/platform/android/src/geojson/geometry.cpp
index 2356af780a..0598b9fc59 100644
--- a/platform/android/src/geojson/geometry.cpp
+++ b/platform/android/src/geojson/geometry.cpp
@@ -22,6 +22,11 @@ public:
jni::JNIEnv& env;
+ jni::Local<jni::Object<Geometry>> operator()(const mbgl::EmptyGeometry &) const {
+ // FIXME: mapbox-java needs to have its own Empty type.
+ return GeometryCollection::New(env, {});
+ }
+
jni::Local<jni::Object<Geometry>> operator()(const mbgl::Point<double> &geometry) const {
return Point::New(env, geometry);
}
@@ -89,4 +94,4 @@ void Geometry::registerNative(jni::JNIEnv &env) {
} // namespace geojson
} // namespace android
-} // namespace mbgl \ No newline at end of file
+} // namespace mbgl
diff --git a/platform/darwin/src/MGLFeature.h b/platform/darwin/src/MGLFeature.h
index 62471abb16..430bf58f92 100644
--- a/platform/darwin/src/MGLFeature.h
+++ b/platform/darwin/src/MGLFeature.h
@@ -172,6 +172,14 @@ NS_ASSUME_NONNULL_BEGIN
@end
/**
+ An `MGLEmptyFeature` object associates an empty shape with an optional
+ identifier and attributes.
+ */
+MGL_EXPORT
+@interface MGLEmptyFeature : MGLShape <MGLFeature>
+@end
+
+/**
An `MGLPointFeature` object associates a point shape with an optional
identifier and attributes.
*/
diff --git a/platform/darwin/src/MGLFeature.mm b/platform/darwin/src/MGLFeature.mm
index 02f67dca6e..fde2d58ada 100644
--- a/platform/darwin/src/MGLFeature.mm
+++ b/platform/darwin/src/MGLFeature.mm
@@ -16,7 +16,41 @@
#import <mbgl/util/geometry.hpp>
#import <mbgl/style/conversion/geojson.hpp>
-#import <mapbox/geometry/feature.hpp>
+#import <mapbox/feature.hpp>
+
+@interface MGLEmptyFeature ()
+@end
+
+@implementation MGLEmptyFeature
+
+@synthesize identifier;
+@synthesize attributes;
+
+MGL_DEFINE_FEATURE_INIT_WITH_CODER();
+MGL_DEFINE_FEATURE_ENCODE();
+MGL_DEFINE_FEATURE_IS_EQUAL();
+
+- (id)attributeForKey:(NSString *)key {
+ return self.attributes[key];
+}
+
+- (NSDictionary *)geoJSONDictionary {
+ return NSDictionaryFeatureForGeometry([super geoJSONDictionary], self.attributes, self.identifier);
+}
+
+- (mbgl::GeoJSON)geoJSONObject {
+ return mbglFeature({[self geometryObject]}, identifier, self.attributes);
+}
+
+- (NSString *)description
+{
+ return [NSString stringWithFormat:@"<%@: %p; identifier = %@, attributes = %@>",
+ NSStringFromClass([self class]), (void *)self,
+ self.identifier ? [NSString stringWithFormat:@"\"%@\"", self.identifier] : self.identifier,
+ self.attributes.count ? self.attributes : @"none"];
+}
+
+@end
@interface MGLPointFeature ()
@end
@@ -269,6 +303,11 @@ MGL_DEFINE_FEATURE_IS_EQUAL();
template <typename T>
class GeometryEvaluator {
public:
+ MGLShape <MGLFeature> * operator()(const mbgl::EmptyGeometry &) const {
+ MGLEmptyFeature *feature = [[MGLEmptyFeature alloc] init];
+ return feature;
+ }
+
MGLShape <MGLFeature> * operator()(const mbgl::Point<T> &geometry) const {
MGLPointFeature *feature = [[MGLPointFeature alloc] init];
feature.coordinate = toLocationCoordinate2D(geometry);
diff --git a/platform/ios/src/MGLMapAccessibilityElement.h b/platform/ios/src/MGLMapAccessibilityElement.h
index 952f6cbf2f..6c5fad62ce 100644
--- a/platform/ios/src/MGLMapAccessibilityElement.h
+++ b/platform/ios/src/MGLMapAccessibilityElement.h
@@ -7,7 +7,7 @@ NS_ASSUME_NONNULL_BEGIN
@protocol MGLFeature;
/// Unique identifier representing a single annotation in mbgl.
-typedef uint32_t MGLAnnotationTag;
+typedef uint64_t MGLAnnotationTag;
/** An accessibility element representing something that appears on the map. */
MGL_EXPORT
diff --git a/platform/ios/src/MGLMapView.mm b/platform/ios/src/MGLMapView.mm
index bcd1e07ef8..41ba93a282 100644
--- a/platform/ios/src/MGLMapView.mm
+++ b/platform/ios/src/MGLMapView.mm
@@ -2666,7 +2666,7 @@ public:
*/
- (id)accessibilityElementForAnnotationWithTag:(MGLAnnotationTag)annotationTag
{
- NSAssert(_annotationContextsByAnnotationTag.count(annotationTag), @"Missing annotation for tag %u.", annotationTag);
+ NSAssert(_annotationContextsByAnnotationTag.count(annotationTag), @"Missing annotation for tag %llu.", annotationTag);
MGLAnnotationContext &annotationContext = _annotationContextsByAnnotationTag.at(annotationTag);
id <MGLAnnotation> annotation = annotationContext.annotation;
diff --git a/platform/macos/src/MGLMapView.mm b/platform/macos/src/MGLMapView.mm
index 9f9bb855d2..80d81ef2bd 100644
--- a/platform/macos/src/MGLMapView.mm
+++ b/platform/macos/src/MGLMapView.mm
@@ -102,10 +102,10 @@ const CGFloat MGLAnnotationImagePaddingForCallout = 4;
const NSEdgeInsets MGLMapViewOffscreenAnnotationPadding = NSEdgeInsetsMake(-30.0f, -30.0f, -30.0f, -30.0f);
/// Unique identifier representing a single annotation in mbgl.
-typedef uint32_t MGLAnnotationTag;
+typedef uint64_t MGLAnnotationTag;
/// An indication that the requested annotation was not found or is nonexistent.
-enum { MGLAnnotationTagNotFound = UINT32_MAX };
+enum { MGLAnnotationTagNotFound = UINT64_MAX };
/// Mapping from an annotation tag to metadata about that annotation, including
/// the annotation itself.
diff --git a/platform/node/src/node_feature.cpp b/platform/node/src/node_feature.cpp
index e5333f1b76..ee1cdab031 100644
--- a/platform/node/src/node_feature.cpp
+++ b/platform/node/src/node_feature.cpp
@@ -14,6 +14,10 @@ using Properties = mbgl::PropertyMap;
template <class T>
struct ToType {
public:
+ v8::Local<v8::String> operator()(const empty&) {
+ return type("Empty");
+ }
+
v8::Local<v8::String> operator()(const point<T>&) {
return type("Point");
}
@@ -159,8 +163,8 @@ v8::Local<v8::Object> toJS(const Feature& feature) {
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(), FeatureIdentifier::visit(*feature.id, ToValue()));
+ if (!feature.id.is<mbgl::NullValue>()) {
+ Nan::Set(result, Nan::New("id").ToLocalChecked(), FeatureIdentifier::visit(feature.id, ToValue()));
}
return scope.Escape(result);
diff --git a/src/mbgl/annotation/annotation_tile.cpp b/src/mbgl/annotation/annotation_tile.cpp
index d405418a45..e5e3b68dff 100644
--- a/src/mbgl/annotation/annotation_tile.cpp
+++ b/src/mbgl/annotation/annotation_tile.cpp
@@ -55,8 +55,8 @@ optional<Value> AnnotationTileFeature::getValue(const std::string& key) const {
return optional<Value>();
}
-optional<FeatureIdentifier> AnnotationTileFeature::getID() const {
- return { static_cast<uint64_t>(data->id) };
+FeatureIdentifier AnnotationTileFeature::getID() const {
+ return data->id;
}
GeometryCollection AnnotationTileFeature::getGeometries() const {
diff --git a/src/mbgl/annotation/annotation_tile.hpp b/src/mbgl/annotation/annotation_tile.hpp
index a4d1e66802..1e23fdf98a 100644
--- a/src/mbgl/annotation/annotation_tile.hpp
+++ b/src/mbgl/annotation/annotation_tile.hpp
@@ -27,7 +27,7 @@ public:
FeatureType getType() const override;
optional<Value> getValue(const std::string&) const override;
- optional<FeatureIdentifier> getID() const override;
+ FeatureIdentifier getID() const override;
GeometryCollection getGeometries() const override;
private:
diff --git a/src/mbgl/annotation/shape_annotation_impl.cpp b/src/mbgl/annotation/shape_annotation_impl.cpp
index 715dce484e..728766dce3 100644
--- a/src/mbgl/annotation/shape_annotation_impl.cpp
+++ b/src/mbgl/annotation/shape_annotation_impl.cpp
@@ -22,7 +22,7 @@ void ShapeAnnotationImpl::updateTileData(const CanonicalTileID& tileID, Annotati
static const double baseTolerance = 4;
if (!shapeTiler) {
- mapbox::geometry::feature_collection<double> features;
+ mapbox::feature::feature_collection<double> features;
features.emplace_back(ShapeAnnotationGeometry::visit(geometry(), [] (auto&& geom) {
return Feature { std::move(geom) };
}));
diff --git a/src/mbgl/layout/symbol_feature.hpp b/src/mbgl/layout/symbol_feature.hpp
index ff498f3c2a..e16dd0b2f3 100644
--- a/src/mbgl/layout/symbol_feature.hpp
+++ b/src/mbgl/layout/symbol_feature.hpp
@@ -19,7 +19,7 @@ public:
FeatureType getType() const override { return feature->getType(); }
optional<Value> getValue(const std::string& key) const override { return feature->getValue(key); };
std::unordered_map<std::string,Value> getProperties() const override { return feature->getProperties(); };
- optional<FeatureIdentifier> getID() const override { return feature->getID(); };
+ FeatureIdentifier getID() const override { return feature->getID(); };
GeometryCollection getGeometries() const override { return geometry; };
std::unique_ptr<GeometryTileFeature> feature;
diff --git a/src/mbgl/renderer/renderer.cpp b/src/mbgl/renderer/renderer.cpp
index 1d2f2bb522..c7bd46106d 100644
--- a/src/mbgl/renderer/renderer.cpp
+++ b/src/mbgl/renderer/renderer.cpp
@@ -75,10 +75,9 @@ AnnotationIDs Renderer::queryShapeAnnotations(const ScreenBox& box) const {
AnnotationIDs Renderer::getAnnotationIDs(const std::vector<Feature>& features) const {
std::set<AnnotationID> set;
for (auto &feature : features) {
- assert(feature.id);
- assert(feature.id->is<uint64_t>());
- assert(feature.id->get<uint64_t>() <= std::numeric_limits<AnnotationID>::max());
- set.insert(static_cast<AnnotationID>(feature.id->get<uint64_t>()));
+ assert(feature.id.is<uint64_t>());
+ assert(feature.id.get<uint64_t>() <= std::numeric_limits<AnnotationID>::max());
+ set.insert(static_cast<AnnotationID>(feature.id.get<uint64_t>()));
}
AnnotationIDs ids;
ids.reserve(set.size());
diff --git a/src/mbgl/style/expression/compound_expression.cpp b/src/mbgl/style/expression/compound_expression.cpp
index 05925810e4..6a4894a478 100644
--- a/src/mbgl/style/expression/compound_expression.cpp
+++ b/src/mbgl/style/expression/compound_expression.cpp
@@ -226,8 +226,8 @@ using Definition = CompoundExpressionRegistry::Definition;
Value featureIdAsExpressionValue(EvaluationContext params) {
assert(params.feature);
auto id = params.feature->getID();
- if (!id) return Null;
- return id->match([](const auto& idid) {
+ if (id.is<NullValue>()) return Null;
+ return id.match([](const auto& idid) {
return toExpressionValue(mbgl::Value(idid));
});
};
@@ -278,8 +278,7 @@ optional<std::string> featurePropertyAsString(EvaluationContext params, const st
optional<double> featureIdAsDouble(EvaluationContext params) {
assert(params.feature);
auto id = params.feature->getID();
- if (!id) return optional<double>();
- return id->match(
+ return id.match(
[](double value) { return value; },
[](uint64_t value) { return optional<double>(static_cast<double>(value)); },
[](int64_t value) { return optional<double>(static_cast<double>(value)); },
@@ -290,8 +289,7 @@ optional<double> featureIdAsDouble(EvaluationContext params) {
optional<std::string> featureIdAsString(EvaluationContext params) {
assert(params.feature);
auto id = params.feature->getID();
- if (!id) return optional<std::string>();
- return id->match(
+ return id.match(
[](std::string value) { return value; },
[](auto) { return optional<std::string>(); }
);
@@ -417,10 +415,7 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali
}
auto id = params.feature->getID();
- if (!id) {
- return Null;
- }
- return id->match(
+ return id.match(
[](const auto& idValue) {
return toExpressionValue(mbgl::Value(idValue));
}
@@ -606,7 +601,7 @@ std::unordered_map<std::string, CompoundExpressionRegistry::Definition> initiali
define("filter-has-id", [](const EvaluationContext& params) -> Result<bool> {
assert(params.feature);
- return bool(params.feature->getID());
+ return !params.feature->getID().is<NullValue>();
});
define("filter-type-in", [](const EvaluationContext& params, const Varargs<std::string>& types) -> Result<bool> {
diff --git a/src/mbgl/style/expression/expression.cpp b/src/mbgl/style/expression/expression.cpp
index 3c2580de04..1e5b1581d2 100644
--- a/src/mbgl/style/expression/expression.cpp
+++ b/src/mbgl/style/expression/expression.cpp
@@ -16,7 +16,7 @@ public:
return apply_visitor(ToFeatureType(), feature.geometry);
}
PropertyMap getProperties() const override { return feature.properties; }
- optional<FeatureIdentifier> getID() const override { return feature.id; }
+ FeatureIdentifier getID() const override { return feature.id; }
GeometryCollection getGeometries() const override { return {}; }
optional<mbgl::Value> getValue(const std::string& key) const override {
auto it = feature.properties.find(key);
diff --git a/src/mbgl/style/sources/geojson_source_impl.cpp b/src/mbgl/style/sources/geojson_source_impl.cpp
index 5ec3909d3e..1c1288d978 100644
--- a/src/mbgl/style/sources/geojson_source_impl.cpp
+++ b/src/mbgl/style/sources/geojson_source_impl.cpp
@@ -17,7 +17,7 @@ public:
const mapbox::geojsonvt::Options& options)
: impl(geoJSON, options) {}
- mapbox::geometry::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final {
+ mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final {
return impl.getTile(tileID.z, tileID.x, tileID.y).features;
}
@@ -27,11 +27,11 @@ private:
class SuperclusterData : public GeoJSONData {
public:
- SuperclusterData(const mapbox::geometry::feature_collection<double>& features,
+ SuperclusterData(const mapbox::feature::feature_collection<double>& features,
const mapbox::supercluster::Options& options)
: impl(features, options) {}
- mapbox::geometry::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final {
+ mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID& tileID) final {
return impl.getTile(tileID.z, tileID.x, tileID.y);
}
@@ -50,14 +50,14 @@ GeoJSONSource::Impl::Impl(const Impl& other, const GeoJSON& geoJSON)
double scale = util::EXTENT / util::tileSize;
if (options.cluster
- && geoJSON.is<mapbox::geometry::feature_collection<double>>()
- && !geoJSON.get<mapbox::geometry::feature_collection<double>>().empty()) {
+ && geoJSON.is<mapbox::feature::feature_collection<double>>()
+ && !geoJSON.get<mapbox::feature::feature_collection<double>>().empty()) {
mapbox::supercluster::Options clusterOptions;
clusterOptions.maxZoom = options.clusterMaxZoom;
clusterOptions.extent = util::EXTENT;
clusterOptions.radius = ::round(scale * options.clusterRadius);
data = std::make_unique<SuperclusterData>(
- geoJSON.get<mapbox::geometry::feature_collection<double>>(), clusterOptions);
+ geoJSON.get<mapbox::feature::feature_collection<double>>(), clusterOptions);
} else {
mapbox::geojsonvt::Options vtOptions;
vtOptions.maxZoom = options.maxzoom;
diff --git a/src/mbgl/style/sources/geojson_source_impl.hpp b/src/mbgl/style/sources/geojson_source_impl.hpp
index a524bab9f2..957cf53081 100644
--- a/src/mbgl/style/sources/geojson_source_impl.hpp
+++ b/src/mbgl/style/sources/geojson_source_impl.hpp
@@ -14,7 +14,7 @@ namespace style {
class GeoJSONData {
public:
virtual ~GeoJSONData() = default;
- virtual mapbox::geometry::feature_collection<int16_t> getTile(const CanonicalTileID&) = 0;
+ virtual mapbox::feature::feature_collection<int16_t> getTile(const CanonicalTileID&) = 0;
};
class GeoJSONSource::Impl : public Source::Impl {
diff --git a/src/mbgl/tile/custom_geometry_tile.cpp b/src/mbgl/tile/custom_geometry_tile.cpp
index 24f3526184..7e99a4568c 100644
--- a/src/mbgl/tile/custom_geometry_tile.cpp
+++ b/src/mbgl/tile/custom_geometry_tile.cpp
@@ -30,7 +30,7 @@ CustomGeometryTile::~CustomGeometryTile() {
void CustomGeometryTile::setTileData(const GeoJSON& geoJSON) {
- auto featureData = mapbox::geometry::feature_collection<int16_t>();
+ auto featureData = mapbox::feature::feature_collection<int16_t>();
if (geoJSON.is<FeatureCollection>() && !geoJSON.get<FeatureCollection>().empty()) {
const double scale = util::EXTENT / options.tileSize;
@@ -76,7 +76,7 @@ void CustomGeometryTile::querySourceFeatures(
auto featureCount = layer->featureCount();
for (std::size_t i = 0; i < featureCount; i++) {
auto feature = layer->getFeature(i);
-
+
// Apply filter, if any
if (queryOptions.filter && !(*queryOptions.filter)(style::expression::EvaluationContext { static_cast<float>(id.overscaledZ), feature.get() })) {
continue;
diff --git a/src/mbgl/tile/geojson_tile.cpp b/src/mbgl/tile/geojson_tile.cpp
index 7a83da2267..4cf971df84 100644
--- a/src/mbgl/tile/geojson_tile.cpp
+++ b/src/mbgl/tile/geojson_tile.cpp
@@ -8,19 +8,19 @@ namespace mbgl {
GeoJSONTile::GeoJSONTile(const OverscaledTileID& overscaledTileID,
std::string sourceID_,
const TileParameters& parameters,
- mapbox::geometry::feature_collection<int16_t> features)
+ mapbox::feature::feature_collection<int16_t> features)
: GeometryTile(overscaledTileID, sourceID_, parameters) {
updateData(std::move(features));
}
-void GeoJSONTile::updateData(mapbox::geometry::feature_collection<int16_t> features) {
+void GeoJSONTile::updateData(mapbox::feature::feature_collection<int16_t> features) {
setData(std::make_unique<GeoJSONTileData>(std::move(features)));
}
-
+
void GeoJSONTile::querySourceFeatures(
std::vector<Feature>& result,
const SourceQueryOptions& options) {
-
+
// Ignore the sourceLayer, there is only one
if (auto tileData = getData()) {
if (auto layer = tileData->getLayer({})) {
diff --git a/src/mbgl/tile/geojson_tile.hpp b/src/mbgl/tile/geojson_tile.hpp
index 270406267c..725dc4850c 100644
--- a/src/mbgl/tile/geojson_tile.hpp
+++ b/src/mbgl/tile/geojson_tile.hpp
@@ -12,10 +12,10 @@ public:
GeoJSONTile(const OverscaledTileID&,
std::string sourceID,
const TileParameters&,
- mapbox::geometry::feature_collection<int16_t>);
+ mapbox::feature::feature_collection<int16_t>);
+
+ void updateData(mapbox::feature::feature_collection<int16_t>);
- void updateData(mapbox::geometry::feature_collection<int16_t>);
-
void querySourceFeatures(
std::vector<Feature>& result,
const SourceQueryOptions&) override;
diff --git a/src/mbgl/tile/geojson_tile_data.hpp b/src/mbgl/tile/geojson_tile_data.hpp
index 3402c2a009..3605af9690 100644
--- a/src/mbgl/tile/geojson_tile_data.hpp
+++ b/src/mbgl/tile/geojson_tile_data.hpp
@@ -7,9 +7,9 @@ namespace mbgl {
class GeoJSONTileFeature : public GeometryTileFeature {
public:
- const mapbox::geometry::feature<int16_t>& feature;
+ const mapbox::feature::feature<int16_t>& feature;
- GeoJSONTileFeature(const mapbox::geometry::feature<int16_t>& feature_)
+ GeoJSONTileFeature(const mapbox::feature::feature<int16_t>& feature_)
: feature(feature_) {
}
@@ -21,7 +21,7 @@ public:
return feature.properties;
}
- optional<FeatureIdentifier> getID() const override {
+ FeatureIdentifier getID() const override {
return feature.id;
}
@@ -47,7 +47,7 @@ public:
class GeoJSONTileLayer : public GeometryTileLayer {
public:
- GeoJSONTileLayer(std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features_)
+ GeoJSONTileLayer(std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features_)
: features(std::move(features_)) {
}
@@ -64,17 +64,17 @@ public:
}
private:
- std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features;
+ std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features;
};
class GeoJSONTileData : public GeometryTileData {
public:
- GeoJSONTileData(mapbox::geometry::feature_collection<int16_t> features_)
- : features(std::make_shared<mapbox::geometry::feature_collection<int16_t>>(
+ GeoJSONTileData(mapbox::feature::feature_collection<int16_t> features_)
+ : features(std::make_shared<mapbox::feature::feature_collection<int16_t>>(
std::move(features_))) {
}
- GeoJSONTileData(std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features_)
+ GeoJSONTileData(std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features_)
: features(std::move(features_)) {
}
@@ -88,7 +88,7 @@ public:
private:
- std::shared_ptr<const mapbox::geometry::feature_collection<int16_t>> features;
+ std::shared_ptr<const mapbox::feature::feature_collection<int16_t>> features;
};
} // namespace mbgl
diff --git a/src/mbgl/tile/geometry_tile_data.hpp b/src/mbgl/tile/geometry_tile_data.hpp
index bd64a1d153..6ce67a532e 100644
--- a/src/mbgl/tile/geometry_tile_data.hpp
+++ b/src/mbgl/tile/geometry_tile_data.hpp
@@ -43,7 +43,7 @@ public:
virtual FeatureType getType() const = 0;
virtual optional<Value> getValue(const std::string& key) const = 0;
virtual PropertyMap getProperties() const { return PropertyMap(); }
- virtual optional<FeatureIdentifier> getID() const { return {}; }
+ virtual FeatureIdentifier getID() const { return NullValue {}; }
virtual GeometryCollection getGeometries() const = 0;
};
@@ -83,6 +83,9 @@ Feature convertFeature(const GeometryTileFeature&, const CanonicalTileID&);
GeometryCollection fixupPolygons(const GeometryCollection&);
struct ToGeometryCollection {
+ GeometryCollection operator()(const mapbox::geometry::empty&) const {
+ return GeometryCollection();
+ }
GeometryCollection operator()(const mapbox::geometry::point<int16_t>& geom) const {
return { { geom } };
}
diff --git a/src/mbgl/tile/vector_tile_data.cpp b/src/mbgl/tile/vector_tile_data.cpp
index 2d4a01bda3..6363b0d3dd 100644
--- a/src/mbgl/tile/vector_tile_data.cpp
+++ b/src/mbgl/tile/vector_tile_data.cpp
@@ -29,7 +29,7 @@ std::unordered_map<std::string, Value> VectorTileFeature::getProperties() const
return feature.getProperties();
}
-optional<FeatureIdentifier> VectorTileFeature::getID() const {
+FeatureIdentifier VectorTileFeature::getID() const {
return feature.getID();
}
diff --git a/src/mbgl/tile/vector_tile_data.hpp b/src/mbgl/tile/vector_tile_data.hpp
index 48beaf9d07..7c95121a37 100644
--- a/src/mbgl/tile/vector_tile_data.hpp
+++ b/src/mbgl/tile/vector_tile_data.hpp
@@ -16,7 +16,7 @@ public:
FeatureType getType() const override;
optional<Value> getValue(const std::string& key) const override;
std::unordered_map<std::string, Value> getProperties() const override;
- optional<FeatureIdentifier> getID() const override;
+ FeatureIdentifier getID() const override;
GeometryCollection getGeometries() const override;
private:
diff --git a/src/mbgl/util/tile_cover_impl.cpp b/src/mbgl/util/tile_cover_impl.cpp
index 799ff2666a..f783dfc4bd 100644
--- a/src/mbgl/util/tile_cover_impl.cpp
+++ b/src/mbgl/util/tile_cover_impl.cpp
@@ -205,6 +205,10 @@ struct BuildBoundsMap {
buildTable(ring, et, true);
}
}
+ BoundsMap operator()(const EmptyGeometry&) const {
+ return {};
+ }
+
BoundsMap operator()(const Point<double>&p) const {
Bound bnd;
auto point = p;
diff --git a/test/api/annotations.test.cpp b/test/api/annotations.test.cpp
index fea1f87106..d13bc15ea7 100644
--- a/test/api/annotations.test.cpp
+++ b/test/api/annotations.test.cpp
@@ -359,13 +359,13 @@ TEST(Annotations, QueryRenderedFeatures) {
auto features = test.frontend.getRenderer()->queryRenderedFeatures(test.map.pixelForLatLng({ 0, 0 }));
EXPECT_EQ(features.size(), 1u);
- EXPECT_TRUE(!!features[0].id);
- EXPECT_EQ(*features[0].id, uint64_t(0));
+ EXPECT_EQ(features[0].id.is<NullValue>(), false);
+ EXPECT_EQ(features[0].id, uint64_t(0));
auto features2 = test.frontend.getRenderer()->queryRenderedFeatures(test.map.pixelForLatLng({ 50, 0 }));
EXPECT_EQ(features2.size(), 1u);
- EXPECT_TRUE(!!features2[0].id);
- EXPECT_EQ(*features2[0].id, uint64_t(1));
+ EXPECT_EQ(features[0].id.is<NullValue>(), false);
+ EXPECT_EQ(features2[0].id, uint64_t(1));
}
TEST(Annotations, QueryFractionalZoomLevels) {
diff --git a/test/src/mbgl/test/stub_geometry_tile_feature.hpp b/test/src/mbgl/test/stub_geometry_tile_feature.hpp
index 0164ab133c..ef21f8e937 100644
--- a/test/src/mbgl/test/stub_geometry_tile_feature.hpp
+++ b/test/src/mbgl/test/stub_geometry_tile_feature.hpp
@@ -9,7 +9,7 @@ public:
: properties(std::move(properties_)) {
}
- StubGeometryTileFeature(optional<FeatureIdentifier> id_, FeatureType type_, GeometryCollection geometry_, PropertyMap properties_)
+ StubGeometryTileFeature(FeatureIdentifier id_, FeatureType type_, GeometryCollection geometry_, PropertyMap properties_)
: properties(std::move(properties_)),
id(std::move(id_)),
type(type_),
@@ -17,7 +17,7 @@ public:
}
PropertyMap properties;
- optional<FeatureIdentifier> id;
+ FeatureIdentifier id;
FeatureType type = FeatureType::Point;
GeometryCollection geometry;
@@ -25,7 +25,7 @@ public:
return type;
}
- optional<FeatureIdentifier> getID() const override {
+ FeatureIdentifier getID() const override {
return id;
}
diff --git a/test/style/filter.test.cpp b/test/style/filter.test.cpp
index 9678fe0895..ef38a1a789 100644
--- a/test/style/filter.test.cpp
+++ b/test/style/filter.test.cpp
@@ -21,7 +21,7 @@ using namespace mbgl::style;
bool filter(const char * json,
const PropertyMap& featureProperties = {{}},
- optional<FeatureIdentifier> featureId = {},
+ FeatureIdentifier featureId = {},
FeatureType featureType = FeatureType::Point,
GeometryCollection featureGeometry = {},
float zoom = 0.0f) {
@@ -81,7 +81,7 @@ std::string stringifyFilter(const char * json) {
TEST(Filter, EqualsNull) {
auto f = R"(["==", "foo", null])";
- ASSERT_TRUE(filter(f, {{ "foo", mapbox::geometry::null_value }}));
+ ASSERT_TRUE(filter(f, {{ "foo", mapbox::feature::null_value }}));
ASSERT_FALSE(filter(f, {{ "foo", int64_t(0) }}));
ASSERT_FALSE(filter(f, {{ "foo", int64_t(1) }}));
@@ -107,7 +107,7 @@ TEST(Filter, EqualsNumber) {
ASSERT_FALSE(filter(f, {{ "foo", std::string("0") }}));
ASSERT_FALSE(filter(f, {{ "foo", false }}));
ASSERT_FALSE(filter(f, {{ "foo", true }}));
- ASSERT_FALSE(filter(f, {{ "foo", mapbox::geometry::null_value }}));
+ ASSERT_FALSE(filter(f, {{ "foo", mapbox::feature::null_value }}));
ASSERT_FALSE(filter(f, {{}}));
}
diff --git a/test/tile/custom_geometry_tile.test.cpp b/test/tile/custom_geometry_tile.test.cpp
index 21a3dd7953..dc6aaab1ac 100644
--- a/test/tile/custom_geometry_tile.test.cpp
+++ b/test/tile/custom_geometry_tile.test.cpp
@@ -50,8 +50,8 @@ TEST(CustomGeometryTile, InvokeFetchTile) {
CircleLayer layer("circle", "source");
- mapbox::geometry::feature_collection<double> features;
- features.push_back(mapbox::geometry::feature<double> {
+ mapbox::feature::feature_collection<double> features;
+ features.push_back(mapbox::feature::feature<double> {
mapbox::geometry::point<double>(0, 0)
});
CustomTileLoader loader([&](const CanonicalTileID& tileId) {
@@ -62,7 +62,7 @@ TEST(CustomGeometryTile, InvokeFetchTile) {
});
auto mb =std::make_shared<Mailbox>(*Scheduler::GetCurrent());
ActorRef<CustomTileLoader> loaderActor(loader, mb);
-
+
CustomGeometryTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, CustomGeometrySource::TileOptions(),
loaderActor);
@@ -76,8 +76,8 @@ TEST(CustomGeometryTile, InvokeCancelTile) {
CircleLayer layer("circle", "source");
- mapbox::geometry::feature_collection<double> features;
- features.push_back(mapbox::geometry::feature<double> {
+ mapbox::feature::feature_collection<double> features;
+ features.push_back(mapbox::feature::feature<double> {
mapbox::geometry::point<double>(0, 0)
});
@@ -87,7 +87,7 @@ TEST(CustomGeometryTile, InvokeCancelTile) {
});
auto mb =std::make_shared<Mailbox>(*Scheduler::GetCurrent());
ActorRef<CustomTileLoader> loaderActor(loader, mb);
-
+
CustomGeometryTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, CustomGeometrySource::TileOptions(),
loaderActor);
@@ -101,15 +101,15 @@ TEST(CustomGeometryTile, InvokeTileChanged) {
CircleLayer layer("circle", "source");
- mapbox::geometry::feature_collection<double> features;
- features.push_back(mapbox::geometry::feature<double> {
+ mapbox::feature::feature_collection<double> features;
+ features.push_back(mapbox::feature::feature<double> {
mapbox::geometry::point<double>(0, 0)
});
CustomTileLoader loader(nullptr, nullptr);
auto mb =std::make_shared<Mailbox>(*Scheduler::GetCurrent());
ActorRef<CustomTileLoader> loaderActor(loader, mb);
-
+
CustomGeometryTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, CustomGeometrySource::TileOptions(),
loaderActor);
diff --git a/test/tile/geojson_tile.test.cpp b/test/tile/geojson_tile.test.cpp
index c05e04bc8d..fb5f3ca6d7 100644
--- a/test/tile/geojson_tile.test.cpp
+++ b/test/tile/geojson_tile.test.cpp
@@ -50,10 +50,8 @@ TEST(GeoJSONTile, Issue7648) {
CircleLayer layer("circle", "source");
- mapbox::geometry::feature_collection<int16_t> features;
- features.push_back(mapbox::geometry::feature<int16_t> {
- mapbox::geometry::point<int16_t>(0, 0)
- });
+ mapbox::feature::feature_collection<int16_t> features;
+ features.push_back(mapbox::feature::feature<int16_t> { mapbox::geometry::point<int16_t>(0, 0) });
GeoJSONTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, features);
@@ -84,10 +82,8 @@ TEST(GeoJSONTile, Issue9927) {
CircleLayer layer("circle", "source");
- mapbox::geometry::feature_collection<int16_t> features;
- features.push_back(mapbox::geometry::feature<int16_t> {
- mapbox::geometry::point<int16_t>(0, 0)
- });
+ mapbox::feature::feature_collection<int16_t> features;
+ features.push_back(mapbox::feature::feature<int16_t> { mapbox::geometry::point<int16_t>(0, 0) });
GeoJSONTile tile(OverscaledTileID(0, 0, 0), "source", test.tileParameters, features);
diff --git a/test/util/merge_lines.test.cpp b/test/util/merge_lines.test.cpp
index 032a09ba21..f76a1ea72a 100644
--- a/test/util/merge_lines.test.cpp
+++ b/test/util/merge_lines.test.cpp
@@ -19,7 +19,7 @@ LineString<int16_t> emptyLine;
class SymbolFeatureStub : public SymbolFeature {
public:
- SymbolFeatureStub(optional<FeatureIdentifier> id_, FeatureType type_, GeometryCollection geometry_,
+ SymbolFeatureStub(FeatureIdentifier id_, FeatureType type_, GeometryCollection geometry_,
PropertyMap properties_, optional<std::u16string> text_,
optional<std::string> icon_, std::size_t index_) :
SymbolFeature(std::make_unique<StubGeometryTileFeature>(std::move(id_), type_, std::move(geometry_), std::move(properties_)))
diff --git a/vendor/geojson-vt-cpp b/vendor/geojson-vt-cpp
-Subproject e172e9c78f4a2af3bfc21a0380390b97e17c5c7
+Subproject 32020bdcbf6d08787577738c9c94ca68e7f836f
diff --git a/vendor/geojson.hpp b/vendor/geojson.hpp
-Subproject 9cd6742162573870b15efaa77e49477f5535b60
+Subproject 97f81eadb66f985af4ce59c003bce8718654198
diff --git a/vendor/geometry.hpp b/vendor/geometry.hpp
-Subproject 40e78bafb0225d7bf86bb81ea7b28ce7855f147
+Subproject c83a2ab18a225254f128b6f5115aa39d04f2de2
diff --git a/vendor/kdbush.hpp b/vendor/kdbush.hpp
-Subproject 85492b6c06d1eeb474972466d68daaa4658b8b6
+Subproject bbbbf6030f46d28add4d8e1b1436b89af3ffb92
diff --git a/vendor/supercluster.hpp b/vendor/supercluster.hpp
-Subproject 4db2c42e9c2cadfe957fdec37f67756e98bbf1b
+Subproject 274ec138306c7b110bf4dde47706aeb43dc8147
diff --git a/vendor/vector-tile b/vendor/vector-tile
-Subproject d46ae6110372eeecb0e1dc954aa6213785e188c
+Subproject 5084dba54d2245980ffeac27ecbe47d2dd73a9d