Search in sources :

Example 1 with EventHandler

use of org.discotools.gwt.leaflet.client.events.handler.EventHandler 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 EventHandler

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

the class LeafletMarkerFactory method create.

public static Marker create(MapMarker mapMarker, final EventHandler... markerEventHandlers) {
    final Marker marker;
    if (mapMarker instanceof IconMapMarker) {
        marker = createIconMapMarker((IconMapMarker) mapMarker);
    } else if (mapMarker instanceof PieMapMarker) {
        marker = createPieMapMarker((PieMapMarker) mapMarker);
    } else if (mapMarker instanceof BubbleMapMarker) {
        marker = createBubbleMapMarker((BubbleMapMarker) mapMarker);
    } else {
        final Options options = new Options();
        setModel(options.getJSObject(), mapMarker);
        marker = new Marker(toLatLng(mapMarker), options);
    }
    if (markerEventHandlers != null) {
        for (EventHandler handler : markerEventHandlers) {
            EventHandlerManager.addEventHandler(marker, EventHandler.Events.click, handler);
        }
    }
    return marker;
}
Also used : IconOptions(org.discotools.gwt.leaflet.client.types.IconOptions) Options(org.discotools.gwt.leaflet.client.Options) MarkerOptions(org.discotools.gwt.leaflet.client.marker.MarkerOptions) IconMapMarker(org.activityinfo.legacy.shared.reports.content.IconMapMarker) PieMapMarker(org.activityinfo.legacy.shared.reports.content.PieMapMarker) EventHandler(org.discotools.gwt.leaflet.client.events.handler.EventHandler) BubbleMapMarker(org.activityinfo.legacy.shared.reports.content.BubbleMapMarker) BubbleMapMarker(org.activityinfo.legacy.shared.reports.content.BubbleMapMarker) PieMapMarker(org.activityinfo.legacy.shared.reports.content.PieMapMarker) CircleMarker(org.discotools.gwt.leaflet.client.marker.CircleMarker) IconMapMarker(org.activityinfo.legacy.shared.reports.content.IconMapMarker) MapMarker(org.activityinfo.legacy.shared.reports.content.MapMarker) Marker(org.discotools.gwt.leaflet.client.marker.Marker)

Aggregations

EventHandler (org.discotools.gwt.leaflet.client.events.handler.EventHandler)2 BubbleMapMarker (org.activityinfo.legacy.shared.reports.content.BubbleMapMarker)1 IconMapMarker (org.activityinfo.legacy.shared.reports.content.IconMapMarker)1 MapMarker (org.activityinfo.legacy.shared.reports.content.MapMarker)1 PieMapMarker (org.activityinfo.legacy.shared.reports.content.PieMapMarker)1 AiLatLng (org.activityinfo.model.type.geo.AiLatLng)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 Event (org.discotools.gwt.leaflet.client.events.Event)1 MapOptions (org.discotools.gwt.leaflet.client.map.MapOptions)1 CircleMarker (org.discotools.gwt.leaflet.client.marker.CircleMarker)1 Marker (org.discotools.gwt.leaflet.client.marker.Marker)1 MarkerOptions (org.discotools.gwt.leaflet.client.marker.MarkerOptions)1 IconOptions (org.discotools.gwt.leaflet.client.types.IconOptions)1 LatLng (org.discotools.gwt.leaflet.client.types.LatLng)1