syagbasan / android-maps-extensions

Automatically exported from code.google.com/p/android-maps-extensions
0 stars 1 forks source link

Possibility to add some markers outside of cluster groupin #10

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Will be very usefull if will be possible add market which will not be grouped 
with another and will be still visible. For example I need to display search 
result and then POIs arount it and search result locaiton must be still 
visibled.

Original issue reported on code.google.com by tomas.pr...@gmail.com on 17 Apr 2013 at 10:07

GoogleCodeExporter commented 8 years ago
Sounds reasonable.

To make it more general such an interface can be introduced:

interface ClusterGrouper {

   int getClusterGroup(Marker marker);
}

When implemented and added to ClusteringSettings its method is called when 
Marker is added and returned value indicates the group in which markers are 
clustered together. Negative value indicates it shouldn't be clustered at all.

Any improvements to this API?

Original comment by maciek.g...@gmail.com on 17 Apr 2013 at 3:25

GoogleCodeExporter commented 8 years ago
Or simply setClusterGroup() directly on the Marker class.
I also found that possible workaround is simpy use getMap().addMarker().

Original comment by tomas.pr...@gmail.com on 18 Apr 2013 at 12:17

GoogleCodeExporter commented 8 years ago
Yes. That's a good workaround.

setClusterGroup would imply changing group is possible. If that is useful, 
probably should be added to MarkerOptions too. Any thought on when would it be 
useful to change that?

Original comment by maciek.g...@gmail.com on 18 Apr 2013 at 12:40

GoogleCodeExporter commented 8 years ago
You have right. So. What about add it only to MarkerOptions, because it is not 
necessary change it after was added. MarkerOptions is used only to build new 
marker.

Original comment by tomas.pr...@gmail.com on 18 Apr 2013 at 2:17

GoogleCodeExporter commented 8 years ago
After thinking about this for a bit, I believe changing clustering group can be 
very useful.
For example one could have marker appearing from top of the screen to target 
location (like this: 
http://stackoverflow.com/questions/16604206/drop-marker-slowly-from-top-of-scree
n-to-location-on-android-map-v2) and during this animation marker would not be 
clustered, but after animation ends it joins cluster.

Original comment by maciek.g...@gmail.com on 22 May 2013 at 8:52

GoogleCodeExporter commented 8 years ago
Can u please provide some detailed explanation or procedure.I didnt get how to 
avoid a marker from getting clustered.I tried with the code mentioned in first 
comment.I created an interface in clustering settings.And I overrided the 
method in that interface in newly created class by implementing 
clusterGrouper.I passed the marker which I want,not to be clustered as an 
argument in the constructor of the class and comapred the marker passed from 
the constructor with  the marker from overrided method.If they were the same 
then I passed a negative value else returned some positive value.

Please  help me with this code

import pl.mg6.android.maps.extensions.ClusteringSettings.ClusterGrouper;
import pl.mg6.android.maps.extensions.Marker;
public class ImplementClusterGrouper implements ClusterGrouper  {
Marker mainmarker;
    public ImplementClusterGrouper(Marker mark) {
        // TODO Auto-generated constructor stub
    mainmarker=mark;
    }

    @Override
    public int getClusterGroup(Marker marker) {
        // TODO Auto-generated method stub
        if(marker==mainmarker){
        return -1;
    }
        else{
            return marker.getMarkers().size();
        }
    }

}

Original comment by pncooldu...@gmail.com on 9 Jun 2013 at 11:16

GoogleCodeExporter commented 8 years ago
This is not yet implemented with such an interface.

A workaround for now is to use getMap().addMarker() instead of getExtendedMap() 
on SupportMapFragment or MapView.
This will work ok for a single marker, but can be problematic for more, because 
you will get null Marker in onMarkerClick, onInfoWindowClick and other 
callbacks.

Original comment by maciek.g...@gmail.com on 9 Jun 2013 at 12:10

GoogleCodeExporter commented 8 years ago
Issue 19 has been merged into this issue.

Original comment by maciek.g...@gmail.com on 13 Jun 2013 at 5:52

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Issue 22 has been merged into this issue.

Original comment by maciek.g...@gmail.com on 21 Jun 2013 at 10:08

GoogleCodeExporter commented 8 years ago
Hello everybody,

I have just pushed few commits that resolve this issue into develop branch.
If you don't use git, you may get it from: 
https://github.com/mg6maciej/android-maps-extensions/archive/develop.zip

The function added is Marker.setClusterGroup(int) like suggested by Tomas at 
the beginning.

Check out ClusterGroupsActivity.java in demo for a simple example and let me 
know how it works for you if you integrate it in your apps.

Original comment by maciek.g...@gmail.com on 9 Aug 2013 at 8:21

GoogleCodeExporter commented 8 years ago

Original comment by maciek.g...@gmail.com on 12 Aug 2013 at 1:07

GoogleCodeExporter commented 8 years ago
Issue 39 has been merged into this issue.

Original comment by maciek.g...@gmail.com on 4 Dec 2013 at 6:22