some help to implement markerClusterer on a map of the GWT Google Maps API.
I want to do is to move the map WIDGET in my JSNI method that implements markerClusterer (see code)
and display it. thanks for the help!
**The map shows, but no method iniMarkerCluster. when i use the Google Maps Javascript API works great MarkerClustarer,
but I need to use the GWT API Google Maps I hope can guideme.
thank you very much!
package cl.syscom.JS.client;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.maps.client.MapOptions;
import com.google.gwt.maps.client.MapTypeId;
import com.google.gwt.maps.client.MapWidget;
import com.google.gwt.maps.client.base.LatLng;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.Widget;
/**
* Entry point classes define <code>onModuleLoad()</code>.
*/
public class PruebaJS implements EntryPoint {
final private static int ZOOM = 3;
final private static LatLng CENTER = new LatLng(-33.437912, -70.650535);
final private static String MAP_TYPE = new MapTypeId().getRoadmap();
private MapWidget mapa;
// this works well
private void inicializaMapa() {
final MapOptions options = new MapOptions();
options.setZoom(ZOOM);
options.setCenter(CENTER);
options.setMapTypeId(MAP_TYPE);
options.setDraggable(true);
options.setNavigationControl(true);
options.setMapTypeControl(true);
mapa = new MapWidget(options);
mapa.setSize("500px", "400px");
}
/* code JSNI*/
public native void iniMarkerCluster(Widget map) /*-{
var markers = [];
for ( var i = 0; i < 100; i++) {
var dataPhoto = $wnd.data.photos[i];
var latLng = new $wnd.google.maps.LatLng(dataPhoto.latitude,
dataPhoto.longitude);
var marker = new $wnd.google.maps.Marker({
position : latLng
});
markers.push(marker);
}
var markerCluster = new $wnd.MarkerClusterer(map, markers);
}-*/;
public void onModuleLoad() {
inicializaMapa();
iniMarkerCluster(mapa);
RootPanel.get("mapaGWT").add(mapa);
}
}