-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add MapObjectManager for multi-layer support with KML/GeoJSON renderers #380
Conversation
MarkerManager, PolygonManager, PolylineManager, and GroundOverlayManager used to create collections for map objects in KML and GeoJSON renderers. This allows them to set up listeners for these map objects while also allowing other collections of any of these map objects to be used external to the KML/GeoJSON objects on the map, which can implement their own listeners through their own collections. MapObjectManager is an abstract base class based on MarkerManger, now used for MarkerManager and the newly implemented PolygonManager, PolylineManager, and GroundOverlayManager.
- Added CircleManager - Instantiate managers in Renderer constructor if null parameters
# Conflicts: # library/src/com/google/maps/android/collections/MarkerManager.java # library/src/com/google/maps/android/data/Renderer.java
Merged latest changes from master and updated so it's mergeable again. |
These changes are important in order to be able to use the KML functionality alongside other usages of markers on the map, including clustering. The same applies for polygons, polylines, ground overlays, and circles. This allows each unique use case for each of these map objects to to be able to maintain separate listeners. |
I've created a new multi-layer demo activity in PR #598 (which is based on this PR branch) that adds the following to a single map to test multiple layer interactions:
I've started testing this PR with the multi-layer demo, and here's what I see so far:
(Note that KML Polygon click listening is also broken in the master branch - see #558) I haven't started digging into why the other items aren't functioning as intended (assuming I understand the intent of this PR correctly), but @jeffdgr8 let me know if you have any thoughts. |
@barbeau the object managers work by acting as a hub for the map event listeners, which delegate the specific events to the collections created by the managers in the different map layers. It's required to create these object managers and share them between the layers using the constructors that take them as parameters. I created a PR for your demo https://github.com/CUTR-at-USF/android-maps-utils/pull/1 that does this and confirmed all the click listeners are working, except for the polygon, which is apparently broken (#558). I also hadn't added these shared object managers to the GeoJsonLayer yet, so I did this in this commit 609008d. |
@jeffdgr8 Thanks!! I'll take another look. |
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.
@jeffdgr8 Thanks for all your work on this feature to align the management of the various spatial data types to allow multiple simultaneous layers on the map! And for your patience waiting for this to be reviewed.
This looks good to me, and I've tested with PR #598 and everything seems to work as intended (modulo known issues in the master branch #558 and #538 EDIT Looks like this PR fixes #538).
One small item - I've added a few requests for clarification in the Javadocs to make sure the behavior is clear to others going forward. If you can review/update we should be able to get this merged! Thanks!
library/src/main/java/com/google/maps/android/data/geojson/GeoJsonLayer.java
Show resolved
Hide resolved
@barbeau I made those changes to the doc comments. I also removed the |
Thanks @jeffdgr8!! |
That's great! |
@bartekpacia you can find the multilayer docs at https://developers.google.com/maps/documentation/android-sdk/utility/multilayer |
MarkerManager, PolygonManager, PolylineManager, GroundOverlayManager, and CircleManager used to create collections for map objects in KML and GeoJSON renderers. This allows them to set up listeners for these map objects while also allowing other collections of any of these map objects to be used external to the KML/GeoJSON objects on the map, which can implement their own listeners through their own collections.
MapObjectManager is an abstract base class based on MarkerManger, now used for MarkerManager and the newly implemented PolygonManager, PolylineManager, GroundOverlayManager, and CircleManager.
Fix #459, Fix #420, Fix #430, Fix #594, Fix #538