diff options
Diffstat (limited to 'platform/android/src')
-rw-r--r-- | platform/android/src/geojson/feature.cpp | 15 | ||||
-rw-r--r-- | platform/android/src/geojson/geometry.cpp | 7 |
2 files changed, 16 insertions, 6 deletions
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 |