Giter VIP home page Giter VIP logo

Comments (7)

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024

Original comment by [email protected] on 18 May 2013 at 4:44

  • Added labels: Type-Enhancement

from android-maps-extensions.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Splitting is possible. Just need to disable clustering when hitting certain 
zoom level (see code below).




private boolean clusteringEnabled;

in onCameraChange:

if (cameraPosition.zoom > 20.7) {
  if (clusteringEnabled) {
    map.setClustering(new ClusteringSettings().enabled(false).addMarkersDynamically(true));
    clusteringEnabled = false;
  }
} else {
  if (!clusteringEnabled) {
    // your normal clustering settings
    clusteringEnabled = true;
  }
}

Original comment by [email protected] on 18 May 2013 at 4:59

from android-maps-extensions.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
It wokrs great! Thanks!

Original comment by [email protected] on 20 May 2013 at 8:45

from android-maps-extensions.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Now it is also possible to achieve spliting a single cluster into markers by 
setting different cluster group on each marker (or just -1 in the next release 
after 1.5.1).

This was resolved as part of Issue 10.

Original comment by [email protected] on 25 Aug 2013 at 1:43

  • Changed state: FixedNotReleased

from android-maps-extensions.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
To split specific cluster use

Marker cluster = ...
for (Marker marker : cluster.getMarkers()) {
    marker.setClusterGroup(ClusterGroup.NOT_CLUSTERED);
}

Original comment by [email protected] on 31 Aug 2013 at 4:06

  • Changed state: Fixed

from android-maps-extensions.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
Just wanted to point that when using the proposed solution for disabling 
clustering when zooming in to a certain zoom level, you may also want to change 
this in DelegatingOnCameraChangeListener:

From:

@Override
public void onCameraChange(CameraPosition cameraPosition) {
   markerManager.onCameraChange(cameraPosition);
   if (onCameraChangeListener != null) {
      onCameraChangeListener.onCameraChange(cameraPosition);
   }
}

To:

@Override
public void onCameraChange(CameraPosition cameraPosition) {
   if (onCameraChangeListener != null) {
      onCameraChangeListener.onCameraChange(cameraPosition);
   }
   markerManager.onCameraChange(cameraPosition);
}

Otherwise, if you zoom out the map very quickly to a very little zoom level 
after being in a non-clustered zoom level, first all the markers are drawn to 
the map, becoming unresponsive for a while, and later clustering is reapplied.

Original comment by [email protected] on 29 Dec 2013 at 12:47

from android-maps-extensions.

GoogleCodeExporter avatar GoogleCodeExporter commented on August 15, 2024
@#6 eereza

That's a good idea for a custom modification in your code when implementing my 
suggestion from comment #2, but I can't do that in the code, because it would 
be inconsistent, e.g. when trying to use GoogleMap.getDisplayedMarkers in 
onCameraChange, you would get a list of markers before clustering is applied.

If I were to use my #2 suggestion, I would probably add 
BeforeCameraChangeListener and make the code look like:

@Override
public void onCameraChange(CameraPosition cameraPosition) {
   if (beforeCameraChangeListener != null) {
      beforeCameraChangeListener.beforeCameraChange(cameraPosition);
   }
   markerManager.onCameraChange(cameraPosition);
   if (onCameraChangeListener != null) {
      onCameraChangeListener.onCameraChange(cameraPosition);
   }
}

and put code from #2 into beforeCameraChange... or just hardcode it before 
markerManager is called.

Original comment by [email protected] on 29 Dec 2013 at 10:28

from android-maps-extensions.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.