Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions benchmark/parse/filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,8 @@

#include <rapidjson/document.h>

#include <map>

using namespace mbgl;

typedef std::multimap<std::string, Value> Properties;

style::Filter parse(const char* expression) {
rapidjson::GenericDocument<rapidjson::UTF8<>, rapidjson::CrtAllocator> doc;
doc.Parse<0>(expression);
Expand All @@ -29,7 +25,7 @@ static void Parse_Filter(benchmark::State& state) {

static void Parse_EvaluateFilter(benchmark::State& state) {
const style::Filter filter = parse(R"FILTER(["==", "foo", "bar"])FILTER");
const Properties properties = { { "foo", std::string("bar") } };
const PropertyMap properties = { { "foo", std::string("bar") } };

while (state.KeepRunning()) {
filter(FeatureType::Unknown, [&] (const std::string& key) -> optional<Value> {
Expand Down
1 change: 1 addition & 0 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ print_flags zlib static_libs cflags ldflags
print_flags nunicode static_libs cflags ldflags
print_flags libzip static_libs cflags ldflags
print_flags geometry cflags
print_flags geojson static_libs cflags ldflags
print_flags geojsonvt static_libs cflags ldflags
print_flags variant cflags
print_flags rapidjson static_libs cflags ldflags
Expand Down
11 changes: 11 additions & 0 deletions include/mbgl/style/filter_evaluator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,24 @@ class FilterEvaluator {
return false;
}

bool operator()(const NullValue&,
const NullValue&) const {
// Should be unreachable; null is not currently allowed by the style specification.
assert(false);
return false;
}

bool operator()(const std::vector<Value>&,
const std::vector<Value>&) const {
// Should be unreachable; nested values are not currently allowed by the style specification.
assert(false);
return false;
}

bool operator()(const std::unordered_map<std::string, Value>&,
const std::unordered_map<std::string, Value>&) const {
// Should be unreachable; nested values are not currently allowed by the style specification.
assert(false);
return false;
}
};
Expand Down
6 changes: 3 additions & 3 deletions include/mbgl/util/feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
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;
class Feature : public mapbox::geometry::feature<double> {
public:
Feature(geometry_type&& geometry_)
: mapbox::geometry::feature<double> { std::move(geometry_) } {}

optional<uint64_t> id;
};

} // namespace mbgl
17 changes: 17 additions & 0 deletions include/mbgl/util/geometry.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,21 @@ Point<S> convertPoint(const Point<T>& p) {
return Point<S>(p.x, p.y);
}

struct ToFeatureType {
template <class T>
FeatureType operator()(const Point<T> &) const { return FeatureType::Point; }
template <class T>
FeatureType operator()(const MultiPoint<T> &) const { return FeatureType::Point; }
template <class T>
FeatureType operator()(const LineString<T> &) const { return FeatureType::LineString; }
template <class T>
FeatureType operator()(const MultiLineString<T> &) const { return FeatureType::LineString; }
template <class T>
FeatureType operator()(const Polygon<T> &) const { return FeatureType::Polygon; }
template <class T>
FeatureType operator()(const MultiPolygon<T> &) const { return FeatureType::Polygon; }
template <class T>
FeatureType operator()(const mapbox::geometry::geometry_collection<T> &) const { return FeatureType::Unknown; }
};

} // namespace mbgl
3 changes: 2 additions & 1 deletion mbgl.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@
'<@(protozero_cflags)',
'<@(boost_cflags)',
'<@(geometry_cflags)',
'<@(geojson_cflags)',
'<@(geojsonvt_cflags)',
'<@(rapidjson_cflags)',
'<@(variant_cflags)',
Expand All @@ -207,7 +208,7 @@
'<@(opengl_ldflags)',
],
'libraries': [
'<@(geojsonvt_static_libs)',
'<@(geojson_static_libs)',
],
},

Expand Down
5 changes: 3 additions & 2 deletions platform/android/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ SQLITE_VERSION=3.9.1
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
LIBZIP_VERSION=0.11.2
GEOMETRY_VERSION=0.5.0
GEOJSONVT_VERSION=4.1.2-cxx11abi
GEOMETRY_VERSION=0.8.0
GEOJSON_VERSION=0.1.4
GEOJSONVT_VERSION=6.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
JNI_HPP_VERSION=2.0.0
Expand Down
4 changes: 2 additions & 2 deletions platform/darwin/src/MGLFeature.mm
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ - (id)attributeForKey:(NSString *)key {
*/
class PropertyValueEvaluator {
public:
id operator()(const std::nullptr_t &) const {
id operator()(const mbgl::NullValue &) const {
return [NSNull null];
}

Expand Down Expand Up @@ -260,7 +260,7 @@ static CLLocationCoordinate2D toLocationCoordinate2D(const mbgl::Point<T> &point
GeometryEvaluator<double> evaluator;
MGLShape <MGLFeaturePrivate> *shape = mapbox::geometry::geometry<double>::visit(feature.geometry, evaluator);
if (feature.id) {
shape.identifier = @(*feature.id);
shape.identifier = mbgl::FeatureIdentifier::visit(*feature.id, PropertyValueEvaluator());
}
shape.attributes = attributes;
[shapes addObject:shape];
Expand Down
2 changes: 1 addition & 1 deletion platform/darwin/test/MGLFeatureTests.mm
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ - (void)testPropertyConversion {

mapbox::geometry::point<double> point = { -90.066667, 29.95 };
mbgl::Feature pointFeature(point);
pointFeature.id = UINT64_MAX;
pointFeature.id = { UINT64_MAX };
pointFeature.properties["null"] = nullptr;
pointFeature.properties["bool"] = true;
pointFeature.properties["unsigned int"] = UINT64_MAX;
Expand Down
8 changes: 4 additions & 4 deletions platform/ios/ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1739,7 +1739,7 @@
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
"$(geojsonvt_static_libs)",
"$(geojson_static_libs)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios;
PRODUCT_NAME = Mapbox;
Expand Down Expand Up @@ -1779,7 +1779,7 @@
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
"$(geojsonvt_static_libs)",
"$(geojson_static_libs)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.sdk.ios;
PRODUCT_NAME = Mapbox;
Expand Down Expand Up @@ -1833,7 +1833,7 @@
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
"$(geojsonvt_static_libs)",
"$(geojson_static_libs)",
);
PRODUCT_NAME = Mapbox;
PUBLIC_HEADERS_FOLDER_PATH = Headers;
Expand Down Expand Up @@ -1863,7 +1863,7 @@
"$(sqlite_ldflags)",
"$(zlib_ldflags)",
"$(opengl_ldflags)",
"$(geojsonvt_static_libs)",
"$(geojson_static_libs)",
);
PRODUCT_NAME = Mapbox;
PUBLIC_HEADERS_FOLDER_PATH = Headers;
Expand Down
5 changes: 3 additions & 2 deletions platform/ios/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ PROTOZERO_VERSION=1.3.0
BOOST_VERSION=1.60.0
SQLITE_VERSION=system
ZLIB_VERSION=system
GEOMETRY_VERSION=0.5.0
GEOJSONVT_VERSION=4.1.2
GEOMETRY_VERSION=0.8.0
GEOJSON_VERSION=0.1.4
GEOJSONVT_VERSION=6.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0
Expand Down
4 changes: 2 additions & 2 deletions platform/ios/scripts/package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ if [[ "${BUILD_FOR_DEVICE}" == true ]]; then
-o ${OUTPUT}/static/${NAME}.framework/${NAME} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphoneos/lib} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \
`find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a`
`find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojson.a`

cp -rv ${PRODUCTS}/${BUILDTYPE}-iphoneos/${NAME}.bundle ${STATIC_BUNDLE_DIR}
fi
Expand Down Expand Up @@ -149,7 +149,7 @@ else
libtool -static -no_warning_for_no_symbols \
-o ${OUTPUT}/static/${NAME}.framework/${NAME} \
${LIBS[@]/#/${PRODUCTS}/${BUILDTYPE}-iphonesimulator/lib} \
`find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojsonvt.a`
`find mason_packages/ios-${IOS_SDK_VERSION} -type f -name libgeojson.a`

cp -rv ${PRODUCTS}/${BUILDTYPE}-iphonesimulator/${NAME}.bundle ${STATIC_BUNDLE_DIR}
fi
Expand Down
5 changes: 3 additions & 2 deletions platform/linux/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ SQLITE_VERSION=3.9.1
LIBUV_VERSION=1.7.5
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
GEOMETRY_VERSION=0.5.0
GEOJSONVT_VERSION=4.1.2${CXX11ABI:-}
GEOMETRY_VERSION=0.8.0
GEOJSON_VERSION=0.1.4${CXX11ABI:-}
GEOJSONVT_VERSION=6.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0${CXX11ABI:-}
Expand Down
4 changes: 2 additions & 2 deletions platform/macos/macos.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1039,7 +1039,7 @@
OTHER_LDFLAGS = (
"$(zlib_ldflags)",
"$(opengl_ldflags)",
"$(geojsonvt_static_libs)",
"$(geojson_static_libs)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL;
PRODUCT_NAME = Mapbox;
Expand Down Expand Up @@ -1078,7 +1078,7 @@
OTHER_LDFLAGS = (
"$(zlib_ldflags)",
"$(opengl_ldflags)",
"$(geojsonvt_static_libs)",
"$(geojson_static_libs)",
);
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxGL;
PRODUCT_NAME = Mapbox;
Expand Down
5 changes: 3 additions & 2 deletions platform/macos/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ GLFW_VERSION=3.1.2
SQLITE_VERSION=3.9.1
ZLIB_VERSION=system
NUNICODE_VERSION=1.6
GEOMETRY_VERSION=0.5.0
GEOJSONVT_VERSION=4.1.2
GEOMETRY_VERSION=0.8.0
GEOJSON_VERSION=0.1.4
GEOJSONVT_VERSION=6.1.0
VARIANT_VERSION=1.1.0
RAPIDJSON_VERSION=1.0.2
GTEST_VERSION=1.7.0
Expand Down
7 changes: 4 additions & 3 deletions platform/node/src/node_feature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ using namespace mapbox::geometry;

using Value = mbgl::Value;
using Feature = mbgl::Feature;
using FeatureIdentifier = mbgl::FeatureIdentifier;
using Geometry = mbgl::Feature::geometry_type;
using GeometryCollection = mapbox::geometry::geometry_collection<double>;
using Properties = mbgl::Feature::property_map;
using Properties = mbgl::PropertyMap;

template <class T>
struct ToType {
Expand Down Expand Up @@ -76,7 +77,7 @@ struct ToCoordinatesOrGeometries {
};

struct ToValue {
v8::Local<v8::Value> operator()(std::nullptr_t) {
v8::Local<v8::Value> operator()(mbgl::NullValue) {
Nan::EscapableHandleScope scope;
return scope.Escape(Nan::Null());
}
Expand Down Expand Up @@ -159,7 +160,7 @@ v8::Local<v8::Object> toJS(const Feature& feature) {
Nan::Set(result, Nan::New("properties").ToLocalChecked(), toJS(feature.properties));

if (feature.id) {
Nan::Set(result, Nan::New("id").ToLocalChecked(), Nan::New(double(*feature.id)));
Nan::Set(result, Nan::New("id").ToLocalChecked(), FeatureIdentifier::visit(*feature.id, ToValue()));
}

return scope.Escape(result);
Expand Down
2 changes: 1 addition & 1 deletion platform/node/src/node_feature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ 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&);
v8::Local<v8::Object> toJS(const mbgl::PropertyMap&);

}
5 changes: 3 additions & 2 deletions platform/qt/scripts/configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ CXX11ABI=${CXX11ABI:-$(scripts/check-cxx11abi.sh)}
UNIQUE_RESOURCE_VERSION=dev
PROTOZERO_VERSION=1.3.0
BOOST_VERSION=1.60.0
GEOMETRY_VERSION=0.5.0
GEOJSONVT_VERSION=4.1.2${CXX11ABI:-}
GEOMETRY_VERSION=0.8.0
GEOJSON_VERSION=0.1.4${CXX11ABI:-}
GEOJSONVT_VERSION=6.1.0
GTEST_VERSION=1.7.0${CXX11ABI:-}
LIBJPEG_TURBO_VERSION=1.4.2
NUNICODE_VERSION=1.6
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/annotation/fill_annotation_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using namespace style;

FillAnnotationImpl::FillAnnotationImpl(AnnotationID id_, FillAnnotation annotation_, uint8_t maxZoom_)
: ShapeAnnotationImpl(id_, maxZoom_),
annotation(std::move(annotation_)) {
annotation({ ShapeAnnotationGeometry::visit(annotation_.geometry, CloseShapeAnnotation{}), annotation_.opacity, annotation_.color, annotation_.outlineColor }) {
}

void FillAnnotationImpl::updateStyle(Style& style) const {
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/annotation/line_annotation_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ using namespace style;

LineAnnotationImpl::LineAnnotationImpl(AnnotationID id_, LineAnnotation annotation_, uint8_t maxZoom_)
: ShapeAnnotationImpl(id_, maxZoom_),
annotation(std::move(annotation_)) {
annotation({ ShapeAnnotationGeometry::visit(annotation_.geometry, CloseShapeAnnotation{}), annotation_.opacity, annotation_.width, annotation_.color }) {
}

void LineAnnotationImpl::updateStyle(Style& style) const {
Expand Down
Loading