Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

migrate to use mapbox-java3.0 #10920

Merged
merged 1 commit into from
Feb 8, 2018
Merged

migrate to use mapbox-java3.0 #10920

merged 1 commit into from
Feb 8, 2018

Conversation

osana
Copy link
Contributor

@osana osana commented Jan 12, 2018

migrated to use mapbox-java3.0
old 2.2.9 telemetry is still used though

closes #10663

@osana osana added the Android Mapbox Maps SDK for Android label Jan 12, 2018
@osana osana force-pushed the osana-mbjava3-10663 branch 2 times, most recently from a315df3 to 6fd77bf Compare January 19, 2018 16:26
@osana osana force-pushed the osana-mbjava3-10663 branch 8 times, most recently from d9a6051 to 58a21c4 Compare January 26, 2018 17:29
@osana
Copy link
Contributor Author

osana commented Jan 26, 2018

This should be ready for review. In the test app: Query Source Features and Query feature properties seem to work. A couple of points to consider:

  • writing more test to make sure JNI changes are well tested (I would suggest to do it on a new ticket)
  • there are now more native - java calls due to the api changes in mapbox-java. If there is a performance implication we can bring back the fromLngLat methods that take double arrays (as now we are limited to List<Point> parameters).

@osana osana requested a review from cammace January 26, 2018 17:38
@osana osana force-pushed the osana-mbjava3-10663 branch 3 times, most recently from 0d249d6 to e2b19fc Compare February 2, 2018 04:39
@osana osana self-assigned this Feb 2, 2018
@osana
Copy link
Contributor Author

osana commented Feb 2, 2018

Still have one remaining crash that I cannot figure out.
@tobrun could you have a look.
It crashes in test app . styles: FillExtrusions

It crashes while executing in
FillExtrusionActivity.onCreate()

whiel doing : GeoJsonSource source = new GeoJsonSource("extrusion-source", domTower);
It is probably something very stupid . The problem seems to be while calling
nativeSetGeometry(geometry);

It crashes pretty reliably.

I see that Navigation repo has mapboxSdk 5.3 and mapbox-java3.0 which is bad match to have at the moment so it is important to resolve this. I think Navigation people just got luck that it works.

cc @tobrun

@osana osana force-pushed the osana-mbjava3-10663 branch 4 times, most recently from 7ec560e to 5788f61 Compare February 6, 2018 15:24
Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, just one question and a couple nits related to commented code


static constexpr auto Type() { return "LineString"; };

static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object<LineString>);

static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object<java::util::List/*<Position>*/>);
static mapbox::geojson::line_string convert(jni::JNIEnv&, jni::Object<java::util::List/*<Point>*/>);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

}

return multiLineString;
}

mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<java::util::List<Position>>*/> jPositionListsList) {
mapbox::geojson::multi_line_string MultiLineString::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<java::util::List<Position>>*/> jPointListsList) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

return point;
}

mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<Double>*/> jDoubleList) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

mapbox::geojson::point Point::convert(jni::JNIEnv &env, jni::Object<java::util::List/*<Double>*/> jDoubleList) {
auto jDoubleArray = java::util::List::toArray<double>(env, jDoubleList);
// static jni::jclass* javaClass = jni::NewGlobalRef(env, &jni::FindClass(env, "java/lang/Double")).release();
//static auto method = jni::GetMethodID(env, javaClass, "doubleValue", "()D");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code

@@ -3,6 +3,7 @@ apply plugin: 'com.android.library'
dependencies {
api dependenciesList.mapboxAndroidTelemetry
api dependenciesList.mapboxJavaGeoJSON
api dependenciesList.mapboxJavaTurf
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the reason why we need this in the SDK?

//
// return &jarray;
// }

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

commented code above

@osana osana changed the title migrated to use mapbox-java3.0 migrate to use mapbox-java3.0 Feb 7, 2018
old 2.2.9 telementry is still used though
@osana
Copy link
Contributor Author

osana commented Feb 7, 2018

Updated PR with requested changes
@tobrun

Copy link
Member

@tobrun tobrun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, can you cherry-pick this to release-boba after merging?

if (jPositionListsList) {
auto multiLine = MultiLineString::convert(env, jPositionListsList);
if (jPointListsList) {
auto multiLine = MultiLineString::convert(env, jPointListsList);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobrun could it be that DeleteLocalRef() for multiline was and is missing here between lines 31 & 32

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it seems that we aren't DeleteLocalRef on jPointListsList as we are doing in the other classes eg.

jni::DeleteLocalRef(env, jPointListsList);
. Could you add that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tobrun Looks like a false alarm on my side:

/src/platform/android/src/geojson/polygon.cpp:32:34: error: no viable conversion from 'mapbox::geometry::multi_line_string<double, std::vector>' to 'jni::jobject *'
          jni::DeleteLocalRef(env, multiLine);
                                   ^~~~~~~~~```

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update to Mapbox Java 3.0
2 participants