Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Further embrace jni in the MapController #70

Closed
Tracked by #80
josxha opened this issue Oct 6, 2024 · 0 comments · Fixed by #83
Closed
Tracked by #80

[FEATURE] Further embrace jni in the MapController #70

josxha opened this issue Oct 6, 2024 · 0 comments · Fixed by #83
Labels
android Android specific issue feature New feature or request
Milestone

Comments

@josxha
Copy link
Owner

josxha commented Oct 6, 2024

Feature Description

With jnigen and the generated JNI classes it's possible to replace pigeon with direct interop. This has a performance boost (sometimes even 10x!) and supports synchronous calls. Some calls to the MapLibre Android SDK need to be on the UI thread. This thread is called the platform thread inside dart and can get called via runOnPlatformThread. Methods that require the platform thread can stay async while the other methods can become sync.

Checklist

  • Replace pigeon with JNI inside MapLibreMapStateJni. Reference implementation for something that needs to run on the platform thread:
    Future<LngLatBounds> getVisibleRegion() async {
    final projection = _jniProjection; // necessary to use it in platform thread
    final jniBounds = await runOnPlatformThread<jni.LatLngBounds>(() {
    final region = projection.getVisibleRegion();
    final bounds = region.latLngBounds;
    region.latLngBounds.release();
    region.release();
    return bounds;
    });
    final bounds = LngLatBounds(
    longitudeWest: jniBounds.longitudeWest,
    longitudeEast: jniBounds.longitudeEast,
    latitudeSouth: jniBounds.latitudeSouth,
    latitudeNorth: jniBounds.latitudeNorth,
    );
    jniBounds.release();
    return bounds;
    }
  • Make MapController methods that don't require the platform thread synchronous.
@josxha josxha added the feature New feature or request label Oct 6, 2024
@josxha josxha added this to the v0.1.0 milestone Oct 6, 2024
@josxha josxha linked a pull request Oct 9, 2024 that will close this issue
29 tasks
@josxha josxha added the android Android specific issue label Oct 10, 2024
josxha added a commit that referenced this issue Oct 15, 2024
- [x] update GitHub milestone
- [x] create versioned docs
- [x] update CHANGELOG.md
- [x] bump version in pubspec.yaml
- [x] prepare GitHub release


## Todo
- [x] Gestures can't be disabled on Android
- [x] #70
- [x] Test paint and layout properties for the annotation layer on
Android
- [x] rename initial parameters to initial[parameter],
#92
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
android Android specific issue feature New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant