コード例 #1
0
ファイル: LocationMap.java プロジェクト: umohi/activityinfo
  @Override
  protected void afterRender() {
    super.afterRender();

    Extents countryBounds = searchPresenter.getCountry().getBounds();

    MapOptions mapOptions = new MapOptions();
    mapOptions.setCenter(new LatLng(countryBounds.getCenterY(), countryBounds.getCenterX()));
    mapOptions.setZoom(6);
    mapOptions.setProperty("crs", new EPSG3857());

    TileLayer baseLayer = new TileLayer(MapboxLayers.MAPBOX_STREETS, new Options());

    markerLayer = new LayerGroup(new ILayer[0]);

    map = new Map(getElement().getElementsByTagName("div").getItem(0), mapOptions);
    map.addLayer(baseLayer);
    map.addLayer(markerLayer);

    bindEvents();
  }
コード例 #2
0
ファイル: LocationMap.java プロジェクト: umohi/activityinfo
  private void createNewLocationMarker() {
    DivIcon icon = createIcon("");

    Options markerOptions = new Options();
    markerOptions.setProperty("icon", icon);
    markerOptions.setProperty("draggable", true);

    newLocationMarker = new Marker(newLatLng(newLocationPresenter.getLatLng()), markerOptions);

    EventHandlerManager.addEventHandler(
        newLocationMarker,
        org.discotools.gwt.leaflet.client.events.handler.EventHandler.Events.dragend,
        new EventHandler<Event>() {

          @Override
          public void handle(Event event) {
            newLocationPresenter.setLatLng(
                new AiLatLng(
                    newLocationMarker.getLatLng().lat(), newLocationMarker.getLatLng().lng()));
          }
        });

    map.addLayer(newLocationMarker);
  }