any ways how do you uncluster a map that has been MarkerClusterer
and redisplay a simple marker view
assume a master js object myMap that is a global refernce to all map
goodies eg
var myMap = {
Icons: null,
map: null, //new google.maps.Map
bounds: null, //new google.maps.LatLngBounds()
geocoder: null, //new google.maps.Geocoder();
trafficInfo: null, //new google.maps.TrafficLayer();
markerCluster:null, //new MarkerClusterer
markerOverlays : [], //array of marker we add to map
}
assume a marker array of valid marker's is displayed on a map
and a control is added to toggle between MarkerClusterer view
and a a simple marker view
The issue is that when showOverlays(myMap.orderOverlays);
is called the markers wont show back up on the map
after the call to myMap.orderCluster.clearMarkers() ;
but I can iterrate the array of markers & they all look good
in the sense that each element in the marker array has the normal
marker properties
Its like when the orginal marker array myMap.markerOverlay is passed
to the the
MarkerClusterer construtor some magic juju is done to the normal
array of markers
OR This is the wrong way to toggle markers & MarkerClusterer
in code fir the control handkler we have
if (myMap.orderCluster) {
if (myMap.orderCluster.getTotalClusters() > 0) {
if (myMap.orderCluster.getMap()) {
myMap.orderCluster.clearMarkers() ;
myMap.orderCluster = null;
showOverlays(myMap.orderOverlays);
}
else
myMap.orderCluster.setMap(myMap.Map);
}
else {
var mcOptions = { gridSize: 50, maxZoom: 15 };
myMap.orderCluster = new MarkerClusterer(myMap.map,
myMap.orderOverlays, mcOptions);
}
}
else {
var mcOptions = { gridSize: 50, maxZoom: 15 };
myMap.orderCluster = new MarkerClusterer(ecMap.map,
myMap.orderOverlays, mcOptions);
}
function showOverlays(aOverlays) {
if (aOverlays) {
//alert(aOverlays.length);
for (i in aOverlays) {
aOverlays[i].setMap(myMap.map)
}
}
}
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-js-api-v3?hl=en.