summaryrefslogtreecommitdiff
path: root/platform/android/src/geojson/geometry_collection.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/android/src/geojson/geometry_collection.cpp')
-rw-r--r--platform/android/src/geojson/geometry_collection.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/platform/android/src/geojson/geometry_collection.cpp b/platform/android/src/geojson/geometry_collection.cpp
index ad0af71214..cca909126d 100644
--- a/platform/android/src/geojson/geometry_collection.cpp
+++ b/platform/android/src/geojson/geometry_collection.cpp
@@ -5,36 +5,34 @@ namespace mbgl {
namespace android {
namespace geojson {
-jni::Object<GeometryCollection> GeometryCollection::New(jni::JNIEnv& env, const mapbox::geometry::geometry_collection<double>& collection) {
+jni::Local<jni::Object<GeometryCollection>> GeometryCollection::New(jni::JNIEnv& env, const mapbox::geometry::geometry_collection<double>& collection) {
// Create an array of geometries
- auto jarray = jni::SeizeLocal(env, jni::Array<jni::Object<Geometry>>::New(env, collection.size()));
+ auto jarray = jni::Array<jni::Object<Geometry>>::New(env, collection.size());
for (size_t i = 0; i < collection.size(); i++) {
- jarray->Set(env, i, *jni::SeizeLocal(env, Geometry::New(env, collection.at(i))));
+ jarray.Set(env, i, Geometry::New(env, collection.at(i)));
}
// create the GeometryCollection
- static auto javaClass = jni::Class<GeometryCollection>::Singleton(env);
+ static auto& javaClass = jni::Class<GeometryCollection>::Singleton(env);
static auto method = javaClass.GetStaticMethod<jni::Object<GeometryCollection> (jni::Object<java::util::List>)>(env, "fromGeometries");
- return javaClass.Call(env, method, *jni::SeizeLocal(env, java::util::Arrays::asList(env, *jarray)));
+ return javaClass.Call(env, method, java::util::Arrays::asList(env, jarray));
}
-mapbox::geometry::geometry_collection<double> GeometryCollection::convert(jni::JNIEnv &env, jni::Object<GeometryCollection> jCollection) {
+mapbox::geometry::geometry_collection<double> GeometryCollection::convert(jni::JNIEnv &env, const jni::Object<GeometryCollection>& jCollection) {
// Get geometries
- static auto javaClass = jni::Class<GeometryCollection>::Singleton(env);
+ static auto& javaClass = jni::Class<GeometryCollection>::Singleton(env);
static auto getGeometries = javaClass.GetMethod<jni::Object<java::util::List> ()>(env, "geometries");
// Turn into array
- auto jarray = jni::SeizeLocal(env,
- java::util::List::toArray<Geometry>(env,
- *jni::SeizeLocal(env, jCollection.Call(env, getGeometries))));
+ auto jarray = java::util::List::toArray<Geometry>(env, jCollection.Call(env, getGeometries));
// Convert each geometry
mapbox::geometry::geometry_collection<double> collection{};
- auto size = jarray->Length(env);
+ auto size = jarray.Length(env);
for (jni::jsize i = 0; i < size; i++) {
- collection.push_back(Geometry::convert(env, *jni::SeizeLocal(env, jarray->Get(env, i))));
+ collection.push_back(Geometry::convert(env, jarray.Get(env, i)));
}
return collection;