-
-
Notifications
You must be signed in to change notification settings - Fork 19
feat: Added 'addImages' to StyleController and enhanced 'addLayer' #307
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
base: main
Are you sure you want to change the base?
Conversation
… into 'addLayer'.
…le network images
Codecov Report❌ Patch coverage is 🚀 New features to boost your workflow:
|
Hi @josxha, since we are currently using jni in The same applies now that we have switched to JNI for the |
…pdated jnigen.yml.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces formatting changes to automatically generated JNI Dart bindings files, improving code readability by adding multi-line parameter formatting for constructors, methods, and function calls. The changes are purely cosmetic, affecting code style without altering functionality.
lib/src/platform/android/jni/org/maplibre/android/maps/NativeMapView.dart
Show resolved
Hide resolved
Hi @gabbopalma, thanks for enhancing the functionality. Sorry for taking me that long to respond. You wrote a couple of unchecked bulletpoints in the pr description. What is the current state of this pr?
Thanks for taking the extra effort. If it's handled by jni, no need to update the kotlin implementation. If it it's no longer required, we can just remove them. In case it is required by iOS but not Android, an empty override should be fine.
This is awesome news! Big step to a complete ffi/jni solution. You can remove it or ignore the warning, up to you. // ignore: unused_field I included this pr in the |
Hi @josxha, thanks for the review! I will completely remove MapLibreHostApi, in order to improve the goal of full jni/ffi implementation. |
Hi @josxha, I successfully removed MapLibreHostApi, but I noticed that you added the
|
Its only usage is currently in the iOS implementation, right? I think I used it in an attempt to get rid of some memory leaks. flutter-maplibre/maplibre_ios/ios/maplibre_ios/Sources/maplibre_ios/MapViewDelegate.swift Lines 112 to 119 in 60b218e
Is it correct that the main scope of this pr is to enhance the FFI capabilities of the StyleController? I'd recommend to keep the
Did you activate the swift package manager? iOS needs the SwiftPM to run successfully. flutter config --enable-swift-package-manager |
Sure, this is the main scope of the PR. Since we want to restore it, and handle the change in another PR, do we want reintroduce
Of course nope ahahah, I just did it, thanks |
Ahh, I see. Probably not for the sake of an unused override fun dispose() {
// free any resources
} How about your changes from #162? It makes use of the |
I'll be a little busy these days because I'm traveling. I'll look at the changes related to #162 and try to integrate them into jni/ffi (unfortunately, it's a very old implementation and, on second thought, there are better ways of doing it) |
No worries, take your time and enjoy your vacation! Alright, then let's delay the functionality in #162. In that case, what ever is the easiest to you, probably to keep it removed? |
Yes, we can leave it removed for now. If you agree, I'll try to implement the drag gestures on the Dart side to remove some platform-specific code and try to don't reintroduce something similar to MapLibreHostApi |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @gabbopalma, I did a code review and added a couple of comments. Could you take a look when you find some time?
I'd like to put out a release by tomorrow but no need to rush, we can merge whenever ready and also release it with a following release.
// Each point is displayed as a layer of markers due to the | ||
// randomly generated 'iconImage' property. | ||
// Do not follow this approach, as it is not efficient. | ||
// Instead, use a single 'MarkerLayer' with a list of points. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use a more easy and state of the art example implementation for users here.
You can use two MarkerLayers that start with some initial points. When the map gets clicked, update the points of the 2nd layer.
);*/ | ||
await _hostApi.addImage(id, bytes); | ||
// TODO: implement addImage | ||
throw UnimplementedError('addImage is not implemented on iOS yet.'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed functionality on ios. Please keep the existing implementation or use an ffi equivalent.
Future<void> addImages(Map<String, Uint8List> images) { | ||
// TODO: implement addImages | ||
throw UnimplementedError('addImages is not implemented on iOS yet.'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add an implementation here please? You can use multiple calls to addImage().
@override | ||
Future<void> addLayer( | ||
StyleLayer layer, { | ||
String? aboveLayerId, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aboveLayerId
has currently no implementation. Please either add an implementation or add an assert and todo.
import MapLibre | ||
|
||
class MapLibreView: NSObject, FlutterPlatformView, MLNMapViewDelegate, | ||
MapLibreHostApi, UIGestureRecognizerDelegate |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the MapLibreHostApi
on Android but still need to have on it on iOS for the dispose method until we can get rid of the dispose()
method.
flutter-maplibre/maplibre_ios/ios/maplibre_ios/Sources/maplibre_ios/MapViewDelegate.swift
Lines 112 to 119 in 22a9d55
func dispose() throws { | |
print("### dispose MapLibre view ### \(_viewId) ###") | |
MapLibreRegistry.removeMap(viewId: _viewId) | |
_mapView.removeFromSuperview() | |
_mapView.delegate = nil | |
_mapView = nil | |
_view.removeFromSuperview() | |
} |
Features
addImages
method to support loading multiple images at onceaboveLayerId
parameter toaddLayer
method for more flexible layer positioningChanges
StyleController
: NewaddImages
method to add multiple images in a single callStyleController
: ExtendedaddLayer
to support positioning layers both above and below existing layersaddImages
method with multiple pinsExamples
Adding multiple images
Layer positioning
TODO
addImage
andaddImages
methodsaboveLayerId
parameterNote: This PR is currently in draft status while working on the JNI implementation for image handling