Skip to content

kodapan/kodapan-gwt-google-map-v3

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This is a branch of http://code.google.com/p/gwt-maps3/
Licensed under the MIT license.

GWT bindings for the Google Maps version 3 Javascript API.


Classes of interest:

EventListener<EventArgument>
Map, MapWidget
InfoWindow, InfoWindowFacade
Marker, Polygon, Polyline, Rectangle


Example use:


<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN" "http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
<module>

  <entry-point class='GoogleMap'/>

  <inherits name='com.google.gwt.user.User'/>
  <source path="client"/>

  <inherits name='se.kodapan.gwt.google.maps.v3.V3'/>
  <script src="http://maps.google.com/maps/api/js?sensor=false"/>
</module>


public class GoogleMap implements EntryPoint {

  private MapWidget map;

  public void onModuleLoad() {

   MapOptions mapOptions = MapOptions.newInstance();
    mapOptions.setMapTypeId();

    map = new MapWidget(mapOptions);
    LatLngBounds bounds = LatLngBounds.newInstance();

    bounds.extend(LatLng.newInstance(54.99644908059339, 4.418624635742162));
    bounds.extend(LatLng.newInstance(67.48749503376553, 39.87825036425784));
    map.fitBounds(bounds);

    map.getMap().addListener("click", new EventListener<MouseEvent>() {
      @Override
      public void run(MouseEvent mouseEvent) {
        map.getMap().panTo(mouseEvent.getLatLng());
        Marker marker = Marker.newInstance(mouseEvent.getLatLng());
        marker.setMap(map.getMap());
        new InfoWindowFacade(marker, new Label("Hello, Sweden")).open(map.getMap());
      }
    });

    RootLayoutPanel.get().add(map);


  }
}

I find there is often a bit of overhead in calling the widget getMap() java script Map object
but I'm not sure what to do with it.

About

GWT bindings for Google Maps version 3

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages