Search in sources :

Example 1 with Event

use of org.discotools.gwt.leaflet.client.events.Event in project activityinfo by bedatadriven.

the class MapEditorMapView method createMap.

private void createMap() {
    MapOptions mapOptions = new MapOptions();
    mapOptions.setCenter(new LatLng(content.getExtents().getCenterY(), content.getExtents().getCenterX()));
    mapOptions.setZoom(6);
    mapOptions.setProperty("crs", new EPSG3857());
    map = new LeafletMap(mapOptions);
    add(map);
    layout();
    EventHandlerManager.addEventHandler(map.getMap(), Events.moveend, new EventHandler() {

        @Override
        public void handle(Event event) {
            updateModelFromMap();
        }
    });
    EventHandlerManager.addEventHandler(map.getMap(), Events.zoomend, new EventHandler() {

        @Override
        public void handle(Event event) {
            updateModelFromMap();
        }
    });
    overlays = new LeafletReportOverlays(map.getMap());
}
Also used : EPSG3857(org.discotools.gwt.leaflet.client.crs.epsg.EPSG3857) LeafletReportOverlays(org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletReportOverlays) MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) EventHandler(org.discotools.gwt.leaflet.client.events.handler.EventHandler) LeafletMarkerDrilldownEventHandler(org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletMarkerDrilldownEventHandler) Event(org.discotools.gwt.leaflet.client.events.Event) AiLatLng(org.activityinfo.model.type.geo.AiLatLng) LatLng(org.discotools.gwt.leaflet.client.types.LatLng)

Example 2 with Event

use of org.discotools.gwt.leaflet.client.events.Event in project activityinfo by bedatadriven.

the class LocationMap method createNewLocationMarker.

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);
}
Also used : MapOptions(org.discotools.gwt.leaflet.client.map.MapOptions) Options(org.discotools.gwt.leaflet.client.Options) MouseEvent(org.discotools.gwt.leaflet.client.events.MouseEvent) Event(org.discotools.gwt.leaflet.client.events.Event) StoreEvent(com.extjs.gxt.ui.client.store.StoreEvent) BaseEvent(com.extjs.gxt.ui.client.event.BaseEvent) AiLatLng(org.activityinfo.model.type.geo.AiLatLng) Marker(org.discotools.gwt.leaflet.client.marker.Marker)

Aggregations

AiLatLng (org.activityinfo.model.type.geo.AiLatLng)2 Event (org.discotools.gwt.leaflet.client.events.Event)2 MapOptions (org.discotools.gwt.leaflet.client.map.MapOptions)2 BaseEvent (com.extjs.gxt.ui.client.event.BaseEvent)1 StoreEvent (com.extjs.gxt.ui.client.store.StoreEvent)1 LeafletMarkerDrilldownEventHandler (org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletMarkerDrilldownEventHandler)1 LeafletReportOverlays (org.activityinfo.ui.client.component.report.editor.map.symbols.LeafletReportOverlays)1 Options (org.discotools.gwt.leaflet.client.Options)1 EPSG3857 (org.discotools.gwt.leaflet.client.crs.epsg.EPSG3857)1 MouseEvent (org.discotools.gwt.leaflet.client.events.MouseEvent)1 EventHandler (org.discotools.gwt.leaflet.client.events.handler.EventHandler)1 Marker (org.discotools.gwt.leaflet.client.marker.Marker)1 LatLng (org.discotools.gwt.leaflet.client.types.LatLng)1