Skip to content

Dev-iL/OverlappingMarkerSpiderfier-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Overlapping Marker Spiderfier for Android (Android Maps Extensions)

This code is an attempt to reproduce an excellent code by jawj, in Java, intended to be used on Android, alongside the excellent android-maps-extensions.

THIS IS A PROOF OF CONCEPT VERSION

For a thorough documentation please refer to jawj’s OverlappingMarkerSpiderfier repository.

The actual code was last updated on 12-March-2014.

Disclaimer

Before proceeding to read \ use the code, please consider the following:

  1. Since the original library is written in JavaScript (JS), and considering I had absolutely zero knowledge in JS and in CoffeeScript (CS) when undertaking this, it is very likely that some things got lost in translation.
  2. I was following the original flow of the CS (more or less). I pretty much worked blindly without much filtering of what’s relevant to Android and what’s not so expect some redundant code. The upside of this method is, however, that the original comments\documentation apply quite well.
  3. Any relation between what you are about to see and “proper” Java code is purely coincidental. Make sure you’re sitting before proceeding.
  4. The code is absolutely unoptimized in terms of memory\performance.
  5. Any functionality customizations (such as Polyline properties, radii, etc.) must currently be changed via hardcoding.
  6. You will have to put up with my sarcasm.

Having managed your expectations, this code:

  • Works. And is very stable at that – inside are merely 2 try-catch blocks, which I’m not sure are even needed.
  • Has ample room for improvement if you’re up for it. Any help will be appreciated!

How to Use

See sample app. Make sure you have a valid Google Maps API key.

Notes

  • This class Overrides the map’s OnCameraChangeListener. If you have your own listener, just move the code from the class’ built-in listener to your own.
  • The developer is assumed to be working with android-maps-extensions.
  • It is highly advised to control the zoom at which spiderfication occurs (i.e. switch the OnMarkerClickListener ’s behavior from zoom to spiderfication only after a certain zoom level).
  • Spiderfication only works on instanceof ClusterMarker.
  • Unspiderfication is performed on zoom level change (hence the aforementioned listener override) & if another cluster is clicked.

Preview

Watch several demos on YouTube:
See the spiderfication demo playlist here.

h3 Known Bugs

  • For certain combinations of GoogleMap.clusterSize and CameraPosition.zoom clusters are only partially clusterfied (i.e. the result is a cluster with one ore more polylines sticking out of it).

TODO

  • Rewrite the class keeping only functional methods.

License

This software is released under the APACHE LICENSE 2.0.

About

A port of a script by the same name to Java (Android)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages