-
Notifications
You must be signed in to change notification settings - Fork 119
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
Marker Cluster Plugin #49
Conversation
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.
Just small notes. I realize there're a bunch of TODO
and UNSUPPORTED
that probably come from the original library. I'd check which ones are worth ticketing. Otherwise, let's at least add a note saying something like "This TODO item was part of the original library (http://...), we welcome contributions if you want to work on it. See https://github.com/mapbox/mapbox-plugins-android#contributing for details."
plugins/cluster/build.gradle
Outdated
compile('com.mapbox.mapboxsdk:mapbox-android-sdk:5.1.0-beta.3@aar') { | ||
transitive = true | ||
} | ||
// javadocDeps 'com.mapbox.mapboxsdk:mapbox-android-sdk:5.0.2' |
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.
Was this left commented on purpose? Should we remove it instead?
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.
This setup was copied from the traffic plugin and will be required for release. Since there is a need for a final 5.1.0 of the map SDK (dependency on new OnCameraIdle API). I would leave this untouched until the release of this plugin.
package="com.mapbox.mapboxsdk.plugins.cluster" | ||
> | ||
|
||
<application android:allowBackup="true" |
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.
I believe we can remove the application tag from here.
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.
yes 👍
import java.util.Map; | ||
import java.util.Set; | ||
|
||
// TODO: add OnMarkerDragListener |
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.
Ticket?
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.
} | ||
|
||
private Bounds createBoundsFromSpan(Point p, double span) { | ||
// TODO: Use a span that takes into account the visual size of the marker, not just its |
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.
Ticket?
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.
This is a todo from the original implementation
|
||
private final Algorithm<T> algorithm; | ||
|
||
// TODO: evaluate maxSize parameter for LruCache. |
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.
Ticket?
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.
this is a todo from the original implementation
* | ||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a> | ||
*/ | ||
public class ExampleUnitTest { |
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.
Looks like we can remove this file.
|
||
final Set<MarkerWithPosition> markersToRemove = markers; | ||
final LatLngBounds visibleBounds = mProjection.getVisibleRegion().latLngBounds; | ||
// TODO: Add some padding, so that markers can animate in from off-screen. |
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.
Ticket?
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.
this is a todo from the original implementation
for (final MarkerWithPosition marker : markersToRemove) { | ||
boolean onScreen = visibleBounds.contains(marker.position); | ||
// Don't animate when zooming out more than 3 zoom levels. | ||
// TODO: drop animation based on speed of device & number of markers to animate. |
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.
Ticket?
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.
this is a todo from the original implementation
return null; | ||
} | ||
|
||
// TODO: make this configurable. |
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.
Ticket?
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.
this is a todo from the original implementation
private static final TimeInterpolator ANIMATION_INTERP = new DecelerateInterpolator(); | ||
|
||
/** | ||
* Animates a markerWithPosition from one position to another. TODO: improve performance for |
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.
Ticket?
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.
this is a todo from the original implementation
@zugaldia I was able to make the code work with a configurable flag for MarkerView though the performance wasn't great. I'm thinking on punting on Markers as we aim to deprecate MarkerView in upcoming releases in mapbox/mapbox-gl-native#9365. |
Small issue with this plugin is there is no option to disable clustering at certain zoom level, say we need to plot 5 markers in 5 mtrs radius even at last zoom level we are not able to see all markers. Is there any workaround for this? |
👍 on reducing the scope to markers for now. |
a06a718
to
6bcfc42
Compare
Is there a timeframe on getting this PR merged? I'm currently in the process of migrating from Google Maps and this is one of the main features missing on MapBox for my usage. |
cace667
to
167d01c
Compare
@simon-the-canadian I'm working on rebasing this PR on latest changes of master. cc @lilykaiser |
@tobrun Are you guys planning on releasing an artifact to maven soonish? |
When I run this code. Not working for me. |
This PR ports 2 open-source clustering algorithms from googlemaps/android-maps-utils.
cc @mapbox/android